Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request : create new actions : "Float FX (number) for monitoring fx" #1895

Open
djabthrash opened this issue Sep 11, 2024 · 5 comments

Comments

@djabthrash
Copy link

Hi !

Now in Reaper we have the following type of actions available for selected tracks :

SWS/S&M: Float FX 1 for selected tracks
SWS/S&M: Float FX 2 for selected tracks
etc ...

I'd need to use similar actions but for MONITORING FX, so actions like :
SWS/S&M: Float FX 1 for monitoring FX
SWS/S&M: Float FX 2 for monitoring FX
etc ...

This would make my life way easier, since i use monitoring FX a ton and and I'd use custom buttons and toolbars to toggle float some of them frequently.

Thanks !

@Buy-One
Copy link

Buy-One commented Sep 11, 2024

The following Lua script will do what you're looking for. Multiply it as many times as the numbers of Monitoring FX whose window you'd like to float and include the relevant FX number in the file name as suggested in the code. The script looks for the number in the file name.


-- NAME SCRIPT INSTANCE 'Float FX n for monitoring FX' where n is FX number in the chain

local is_new_value, scr_name, sect_ID, cmd_ID, mode, resol, val, contextstr = reaper.get_action_context()
local fx_idx = scr_name:match('.+[\\/].-FX (%d+)')
local master = reaper.GetMasterTrack(0)
local fx_cnt = reaper.TrackFX_GetRecCount(master)
local err = (not fx_idx or not tonumber(fx_idx) or fx_idx+0 == 0) and 'Valid FX number wasn\'t found in the script name'
or fx_cnt == 0 and 'No FX in the Monitoring FX chain' or fx_idx+0 > fx_cnt and 'FX No '..fx_idx..' doesn\'t exist in the chain'

	if err then
	reaper.MB(err,'ERROR',0) 
	return reaper.defer(function() do return end end) end

reaper.TrackFX_Show(master, fx_idx-1+0x1000000, 3) -- showFlag 3 float

@djabthrash
Copy link
Author

djabthrash commented Sep 11, 2024

The following Lua script will do what you're looking for. Multiply it as many time as the numbers of Monitoring FX whose window you'd like to float and include the relevant FX number in the file name as suggested in the code. The script looks for the number in the file name.


-- NAME SCRIPT INSTANCE 'Float FX n for monitoring FX' where n is FX number in the chain

local is_new_value, scr_name, sect_ID, cmd_ID, mode, resol, val, contextstr = reaper.get_action_context()
local fx_idx = scr_name:match('.+[\\/].-FX (%d+)')
local master = reaper.GetMasterTrack(0)
local fx_cnt = reaper.TrackFX_GetRecCount(master)
local err = (not fx_idx or not tonumber(fx_idx) or fx_idx+0 == 0) and 'Valid FX number wasn\'t found in the script name'
or fx_cnt == 0 and 'No FX in the Monitoring FX chain' or fx_idx+0 > fx_cnt and 'FX No '..fx_idx..' doesn\'t exist in the chain'

	if err then
	reaper.MB(err,'ERROR',0) 
	return reaper.defer(function() do return end end) end

reaper.TrackFX_Show(master, fx_idx-1+0x1000000, 3) -- showFlag 3 float

@Buy-One : Thanks a ton ! Worked like a charm !

@djabthrash
Copy link
Author

@Buy-One : do you know what I should modify in the script to make it do "toggle float" instead of just "float" ?

@Buy-One
Copy link

Buy-One commented Sep 12, 2024

Here's an updated code for toggling


-- NAME SCRIPT INSTANCE 'Float FX n for monitoring FX' where n is FX number in the chain

local is_new_value, scr_name, sect_ID, cmd_ID, mode, resol, val, contextstr = reaper.get_action_context()
local fx_idx = scr_name:match('.+[\\/].-FX (%d+)')
local master = reaper.GetMasterTrack(0)
local fx_cnt = reaper.TrackFX_GetRecCount(master)
local err = (not fx_idx or not tonumber(fx_idx) or fx_idx+0 == 0) and 'Valid FX number wasn\'t found in the script name'
or fx_cnt == 0 and 'No FX in the Monitoring FX chain' or fx_idx+0 > fx_cnt and 'FX No '..fx_idx..' doesn\'t exist in the chain'

	if err then
	reaper.MB(err,'ERROR',0) 
	return reaper.defer(function() do return end end) end

local fx_idx = fx_idx-1+0x1000000
local showFlag = reaper.TrackFX_GetFloatingWindow(master, fx_idx) and 2 or 3

reaper.TrackFX_Show(master, fx_idx, showFlag) -- showFlag is 3 float or 2 unfloat

@djabthrash
Copy link
Author

Here's an updated code for toggling


-- NAME SCRIPT INSTANCE 'Float FX n for monitoring FX' where n is FX number in the chain

local is_new_value, scr_name, sect_ID, cmd_ID, mode, resol, val, contextstr = reaper.get_action_context()
local fx_idx = scr_name:match('.+[\\/].-FX (%d+)')
local master = reaper.GetMasterTrack(0)
local fx_cnt = reaper.TrackFX_GetRecCount(master)
local err = (not fx_idx or not tonumber(fx_idx) or fx_idx+0 == 0) and 'Valid FX number wasn\'t found in the script name'
or fx_cnt == 0 and 'No FX in the Monitoring FX chain' or fx_idx+0 > fx_cnt and 'FX No '..fx_idx..' doesn\'t exist in the chain'

	if err then
	reaper.MB(err,'ERROR',0) 
	return reaper.defer(function() do return end end) end

local fx_idx = fx_idx-1+0x1000000
local showFlag = reaper.TrackFX_GetFloatingWindow(master, fx_idx) and 2 or 3

reaper.TrackFX_Show(master, fx_idx, showFlag) -- showFlag is 3 float or 2 unfloat

@Buy-One : Thanks again ! Worked perfectly !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants