Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 03-16-2018, 06:38 PM   #1
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,629
Default API: GetLastTouchedFX() is broken with subprojects

GetLastTouchedFX() returns the track number, but if the last touched FX is in another project tab than the current one, the returned track number appears to always be 0 (i.e. master track).

We should either support a last-touched FX per project, in which case GetLastTouchedFX() should receive a project number as an argument (presumably spun off as a new function GetLastTouchedFXEx() or something) or if last-toucehd FX is a global thing, then it should return the project number for the FX, and return the correct track number.

(Edit: updated from newer findings)

Last edited by tack; 03-17-2018 at 06:46 AM.
tack is offline   Reply With Quote
Old 03-17-2018, 02:50 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 10,359
Default

That would make sense
The long workarround is to first get all tracks of all projects, and for projects where track count is superior than the ID you get from the LastTouched funxtion, GetTrack and compare with the list of tracks you stored untill you find the right track (and so, project).

Definitly sounds less efficient.

IMHO it would be better to have a project parameter rather than having it return project ID (though it may not solve the same desire).
X-Raym is offline   Reply With Quote
Old 03-17-2018, 06:33 AM   #3
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,629
Default

Quote:
Originally Posted by X-Raym View Post
IMHO it would be better to have a project parameter rather than having it return project ID (though it may not solve the same desire).
I thought this too but it actually looks like last touched fx is not per project, rather it's global.

Now as I look more closely, I see that if the last touched fx is from another tab, GetLastTouchedFX() returns true but indicates the track number is 0 (i.e. master track). This is wrong and unfortunately also renders your proposed workaround inoperable. (The idea still has problems anyway, because it's possible the track number in the other project is actually valid in the current project. But we do what we can to work around these frustrating API limitations, don't we. )

So the general problem here is that GetLastTouchedFX() is incompatible with subprojects.

Last edited by tack; 03-17-2018 at 06:43 AM.
tack is offline   Reply With Quote
Old 03-20-2018, 04:24 PM   #4
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,629
Default

Just saw:

Code:
v5.78rc2 - March 18 2018
+ API: GetLastTouchedFX() and GetFocusedFX() only succeed if FX is in active project [t=204540]
Thanks!
tack is offline   Reply With Quote
Old 01-02-2020, 08:38 AM   #5
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,552
Default

Quote:
Originally Posted by tack View Post
Just saw:

Code:
v5.78rc2 - March 18 2018
+ API: GetLastTouchedFX() and GetFocusedFX() only succeed if FX is in active project [t=204540]
Thanks!
It would have been great (and saved me quite some time) if this had been put in the API description https://www.reaper.fm/sdk/reascript/...tLastTouchedFX

It is by no means obvious what "Returns true if the last touched FX parameter is valid, false otherwise" really means, especially since it talks about the *parameter*, not the FX.

Thanks for this thread, it finally solved some things for me.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.