Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-30-2019, 09:36 PM   #1
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default how to focus somewhere else after using reaper.TrackFX_GetOpen(track..) ?

i would like to continue using my keyboard shortcuts after using this action, without having to enable: Options > Ignore FX Chain keyboard shortcuts (send to main window).

Anyway to do it? i guess so because SWS/S&M: Toggle show FX chain windows for selected tracks
works this way, in which the shortcut used always works.

Thanks!
deeb is offline   Reply With Quote
Old 04-01-2019, 10:21 PM   #2
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

here is a snippet to show what i am looking for:
note: Options > Ignore FX Chain keyboard shortcuts (send to main window) should be disabled ... because with this one it works.

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

track = reaper.GetSelectedTrack(0, 0) 

reaper.TrackFX_GetByName(track, "3BandEQ" , 1 )     

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
Another issue that it seems to happen is that i am forced to have a plugin in the chain in order to reaper.TrackFX_GetOpen(track, 0) returns true even when FxChain already open.
How can i solve this? seems like a Nitpick or "bug" !

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

Last edited by deeb; 04-01-2019 at 10:32 PM.
deeb is offline   Reply With Quote
Old 04-02-2019, 02:20 AM   #3
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by deeb View Post
Code:
deleteChain() -- to make sure the chain is clean

if reaper.TrackFX_GetOpen(track, 0) == false then
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?
Edgemeal is offline   Reply With Quote
Old 04-02-2019, 03:40 AM   #4
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

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?
Thanks edgemeal for the input! Well the fxchain gui is open although no effects on it, but reaper is asking for me to choose an effect for index 0. Open means fxbrowser is visible and not if has effects or not. No? This is my interpretation .. probably wrong

Last edited by deeb; 04-02-2019 at 03:57 AM.
deeb is offline   Reply With Quote
Old 04-05-2019, 09:06 PM   #5
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by deeb View Post
i would like to continue using my keyboard shortcuts after using this action, without having to enable: Options > Ignore FX Chain keyboard shortcuts (send to main window).

Anyway to do it? i guess so because SWS/S&M: Toggle show FX chain windows for selected tracks
works this way, in which the shortcut used always works.

Thanks!
one more try! Thanks edgemeal : )
deeb is offline   Reply With Quote
Old 04-10-2019, 04:10 PM   #6
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

My only other thought is to check if the fx index is valid first, if not then close the chain window or whatever,...

Code:
...

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

fx_index = 0 -- the fx index were interested in.

if fx_index > reaper.TrackFX_GetCount(track)-1 then
  msg('FX index is out of range, close chain if open')
  reaper.TrackFX_Show(track, fx_index, 0) -- =0 for hidechain
else  
  if not reaper.TrackFX_GetOpen(track, fx_index) then
     msg ("1 - TrackFX is closed so it opens")
     reaper.TrackFX_SetOpen(track, fx_index, true)
  else
     msg ("2 - TrackFX is opened so it closes")
     reaper.TrackFX_SetOpen(track, fx_index, false) 
  end
end
Edgemeal is offline   Reply With Quote
Old 04-10-2019, 04:33 PM   #7
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

Quote:
Originally Posted by deeb View Post
i would like to continue using my keyboard shortcuts after using this action, without having to enable: Options > Ignore FX Chain keyboard shortcuts (send to main window).
focus arrange after it should work I think (not tested)

Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_BR_FOCUS_ARRANGE_WND"), 0)
(needs SWS installed)
nofish is offline   Reply With Quote
Old 04-15-2019, 07:32 PM   #8
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

thank you guys! at the end i found a solution for both issues i was having!
thank you Edgemeal for the recipe!
deeb 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 05:24 PM.


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