View Single Post
Old 04-05-2019, 09:11 PM   #299
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

related to:
https://forum.cockos.com/showthread.php?p=2117965

it seems that i am forced to have a plugin in the chain in order to reaper.TrackFX_GetOpen(track, 0) returns true even when FxChain (0) already open (with no fx selected).
How can i solve this?

check this:

Code:
function msg(param)
   reaper.ShowConsoleMsg("\n"..tostring(param));
end

function deleteChain()
   -- SWS/S&M: Remove selected FX for selected tracks
   reaper.Main_OnCommand(reaper.NamedCommandLookup("_S&M_REMOVE_FX",0),0) 
end   

track = reaper.GetSelectedTrack(0, 0) 

deleteChain() -- to make sure the chain is clean

if reaper.TrackFX_GetOpen(track, 0) == false then
   msg ("1 - TrackFX is closed so it opens")
   reaper.TrackFX_SetOpen(track, 0, 1)
else
   msg ("2 - TrackFX is opened so it closes")
   reaper.TrackFX_SetOpen(track, 1, 0) 
end

and based on answer by edgemeal:
Quote:
Originally Posted by Edgemeal View Post
How can fx ui be open/closed when it doesn't even exist? Maybe the function shouldn't do anything when passing an invalid fx index to it?
I would like to ask for a solution for this, or an alternative like using an argument with -1 index, so that reaper.TrackFX_GetOpen(track, -1) would return true if fxbrowser is open with no fx still selected.
deeb is offline   Reply With Quote