From 6044355f0b5a6f525f25b7d904094b2428acbd30 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Thu, 2 Jan 2025 07:57:55 -0500 Subject: [PATCH 1/3] Release Toggle bypass or offline of selected FX in the focused FX chain window v1.0 --- ...cted FX in the focused FX chain window.lua | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua diff --git a/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua b/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua new file mode 100644 index 000000000..a08fce17d --- /dev/null +++ b/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua @@ -0,0 +1,40 @@ +-- @description Toggle bypass or offline of selected FX in the focused FX chain window +-- @author cfillion +-- @version 1.0 +-- @metapackage +-- @provides +-- [main] . > cfillion_Toggle bypass of selected FX in the focused FX chain window.lua +-- [main] . > cfillion_Toggle offline of selected FX in the focused FX chain window.lua +-- @link +-- https://cfillion.ca +-- Request post https://forum.cockos.com/showpost.php?p=2834699 +-- @donation https://reapack.com/donate + +local script_name = select(2, reaper.get_action_context()):match('([^/\\_]+)%.lua$') +local what = script_name:match('bypass') and 'Enabled' or 'Offline' +reaper.Undo_BeginBlock(); +(function() + local rv, track_id, item_id, take_id, fx_id, parm = reaper.GetTouchedOrFocusedFX(1) + if not rv then return end + local track = reaper.CSurf_TrackFromID(track_id + 1, false) + local get, set, obj + if item_id < 0 then + which, obj = 'Track', track + else + local item = reaper.GetTrackMediaItem(track, item_id) + local take = reaper.GetMediaItemTake(item, take_id) + which, obj = 'Take', take + end + + local get = reaper[which..'FX_Get'..what] + local set = reaper[which..'FX_Set'..what] + local chain = reaper.CF_GetFocusedFXChain() + if not chain then return end + local i = -1 + while true do + i = reaper.CF_EnumSelectedFX(chain, i) + if i < 0 then break end + set(obj, i, not get(obj, i)) + end +end)() +reaper.Undo_EndBlock(script_name, 0) From 5b9cf81c81bf227a16d621eaad0dafbf67c5b6d4 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Thu, 2 Jan 2025 08:04:10 -0500 Subject: [PATCH 2/3] Update cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua --- ...offline of selected FX in the focused FX chain window.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua b/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua index a08fce17d..6b90046ac 100644 --- a/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua +++ b/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua @@ -15,6 +15,7 @@ local what = script_name:match('bypass') and 'Enabled' or 'Offline' reaper.Undo_BeginBlock(); (function() local rv, track_id, item_id, take_id, fx_id, parm = reaper.GetTouchedOrFocusedFX(1) + fx_id = fx_id & ~0xFFFFFF if not rv then return end local track = reaper.CSurf_TrackFromID(track_id + 1, false) local get, set, obj @@ -25,7 +26,7 @@ reaper.Undo_BeginBlock(); local take = reaper.GetMediaItemTake(item, take_id) which, obj = 'Take', take end - + local get = reaper[which..'FX_Get'..what] local set = reaper[which..'FX_Set'..what] local chain = reaper.CF_GetFocusedFXChain() @@ -34,7 +35,7 @@ reaper.Undo_BeginBlock(); while true do i = reaper.CF_EnumSelectedFX(chain, i) if i < 0 then break end - set(obj, i, not get(obj, i)) + set(obj, fx_id|i, not get(obj, fx_id|i)) end end)() reaper.Undo_EndBlock(script_name, 0) From 24b971e3b44884d9c7de059f269f4610a9c9f6d5 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Thu, 2 Jan 2025 08:04:35 -0500 Subject: [PATCH 3/3] Update cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua --- ...or offline of selected FX in the focused FX chain window.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua b/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua index 6b90046ac..7b6d96429 100644 --- a/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua +++ b/FX/cfillion_Toggle bypass or offline of selected FX in the focused FX chain window.lua @@ -26,7 +26,7 @@ reaper.Undo_BeginBlock(); local take = reaper.GetMediaItemTake(item, take_id) which, obj = 'Take', take end - + local get = reaper[which..'FX_Get'..what] local set = reaper[which..'FX_Set'..what] local chain = reaper.CF_GetFocusedFXChain()