From cb62706caaab9b809f6d415e6bbe2c1d059d1191 Mon Sep 17 00:00:00 2001 From: 80icio <67228387+80icio@users.noreply.github.com> Date: Sun, 25 Aug 2024 15:58:02 +0200 Subject: [PATCH] Release Floating FX bypass toggle v1.1 - Added toggle wet knob function --- FX/80icio_Floating FX bypass toggle.lua | 77 +++++++++++++++++++++---- 1 file changed, 66 insertions(+), 11 deletions(-) diff --git a/FX/80icio_Floating FX bypass toggle.lua b/FX/80icio_Floating FX bypass toggle.lua index 2a877d3a9..81c03306a 100644 --- a/FX/80icio_Floating FX bypass toggle.lua +++ b/FX/80icio_Floating FX bypass toggle.lua @@ -1,6 +1,7 @@ -- @description Floating FX bypass toggle -- @author 80icio --- @version 1.0 +-- @version 1.1 +-- @changelog - Added toggle wet knob function -- @about -- This script let you toggle any visible floating FX bypass. -- track FX, take FX, input FX or fx chain focused FX @@ -8,6 +9,7 @@ -- -- Thanks to BirdBird & Tycho + r = reaper dofile(r.GetResourcePath() .. '/Scripts/ReaTeam Extensions/API/imgui.lua') ('0.8.1') @@ -29,12 +31,15 @@ TakeFX = str_to_bool(r.GetExtState(scriptname,'TakeFX') ) or false ChainFXwndw = str_to_bool(r.GetExtState(scriptname,'ChainFXwndw') ) or false +WetToggle = str_to_bool(r.GetExtState(scriptname,'WetToggle') ) or false + function exit() r.SetExtState(scriptname,'trkFX',tostring(trkFX),true) r.SetExtState(scriptname,'TakeFX',tostring(TakeFX),true) r.SetExtState(scriptname,'InpFX',tostring(InpFX),true) r.SetExtState(scriptname,'ChainFXwndw',tostring(ChainFXwndw),true) + r.SetExtState(scriptname,'WetToggle',tostring(WetToggle),true) end @@ -42,10 +47,10 @@ end ctx = r.ImGui_CreateContext(scriptname) function TFB_GUI() - r.ImGui_SetNextWindowSize( ctx, 220, 105) + r.ImGui_SetNextWindowSize( ctx, 300, 80) local visible, open = r.ImGui_Begin(ctx, scriptname, true, r.ImGui_WindowFlags_NoResize() | r.ImGui_WindowFlags_NoScrollbar()) if visible then - r.ImGui_BeginTable(ctx, 'options', 2, r.ImGui_TableFlags_SizingStretchProp() ) + r.ImGui_BeginTable(ctx, 'options', 3, r.ImGui_TableFlags_SizingStretchProp() ) r.ImGui_TableNextColumn(ctx) _, trkFX = r.ImGui_Checkbox( ctx, 'Track FX', trkFX ) @@ -55,10 +60,16 @@ function TFB_GUI() _, TakeFX = r.ImGui_Checkbox( ctx, 'Take FX ', TakeFX ) _, ChainFXwndw = r.ImGui_Checkbox( ctx, 'Chain FX', ChainFXwndw ) - r.ImGui_EndTable(ctx) + r.ImGui_TableNextColumn(ctx) + + _, WetToggle = r.ImGui_Checkbox( ctx, 'Toggle Wet', WetToggle ) toggleBttn = r.ImGui_Button(ctx,'TOGGLE', -1) + r.ImGui_EndTable(ctx) + + + r.ImGui_End(ctx) end @@ -67,7 +78,7 @@ function TFB_GUI() end ---------------------------------------END GUI-------------------------- if toggleBttn and (trkFX or InpFX or TakeFX or ChainFXwndw) then -reaper.ClearConsole() + r.Undo_BeginBlock2(0) for i = -1, r.CountTracks(0) - 1 do @@ -84,13 +95,29 @@ reaper.ClearConsole() if trkFX then if r.TrackFX_GetFloatingWindow( track, index ) then - r.TrackFX_SetEnabled(track, index, not r.TrackFX_GetEnabled(track, index)) + if WetToggle then + local wetparam = r.TrackFX_GetParamFromIdent( track, index, ":wet" ) + local wetparam_value = r.TrackFX_GetParam(track, index, wetparam) + local wetparam_value = math.floor(wetparam_value + 0.5) + r.TrackFX_SetParam(track, index, wetparam, math.abs(wetparam_value -1) ) + else + r.TrackFX_SetEnabled(track, index, not r.TrackFX_GetEnabled(track, index)) + end end end if ChainFXwndw then if index == chainfltngfx then - r.TrackFX_SetEnabled(track, chainfltngfx, not r.TrackFX_GetEnabled(track, chainfltngfx)) + + if WetToggle then + local wetparam = r.TrackFX_GetParamFromIdent( track, chainfltngfx, ":wet" ) + local wetparam_value = r.TrackFX_GetParam(track, chainfltngfx, wetparam) + local wetparam_value = math.floor(wetparam_value + 0.5) + r.TrackFX_SetParam(track, chainfltngfx, wetparam, math.abs(wetparam_value -1) ) + else + r.TrackFX_SetEnabled(track, chainfltngfx, not r.TrackFX_GetEnabled(track, chainfltngfx)) + end + end end --end @@ -102,13 +129,27 @@ reaper.ClearConsole() if InpFX then if r.TrackFX_GetFloatingWindow(track, index + 0x1000000) then - r.TrackFX_SetEnabled(track, index + 0x1000000, not r.TrackFX_GetEnabled(track, index + 0x1000000 )) + if WetToggle then + local wetparam = r.TrackFX_GetParamFromIdent( track, index + 0x1000000, ":wet" ) + local wetparam_value = r.TrackFX_GetParam(track, index + 0x1000000, wetparam) + local wetparam_value = math.floor(wetparam_value + 0.5) + r.TrackFX_SetParam(track, index + 0x1000000, wetparam, math.abs(wetparam_value -1) ) + else + r.TrackFX_SetEnabled(track, index + 0x1000000, not r.TrackFX_GetEnabled(track, index + 0x1000000 )) + end end end if ChainFXwndw then if index == INchainfltngfx then - r.TrackFX_SetEnabled(track, INchainfltngfx + 0x1000000, not r.TrackFX_GetEnabled(track, INchainfltngfx + 0x1000000)) + if WetToggle then + local wetparam = r.TrackFX_GetParamFromIdent( track, INchainfltngfx + 0x1000000, ":wet" ) + local wetparam_value = r.TrackFX_GetParam(track, INchainfltngfx + 0x1000000, wetparam) + local wetparam_value = math.floor(wetparam_value + 0.5) + r.TrackFX_SetParam(track, INchainfltngfx + 0x1000000, wetparam, math.abs(wetparam_value -1) ) + else + r.TrackFX_SetEnabled(track, INchainfltngfx + 0x1000000, not r.TrackFX_GetEnabled(track, INchainfltngfx + 0x1000000)) + end end end end @@ -122,12 +163,26 @@ reaper.ClearConsole() for j = 0, r.TakeFX_GetCount(take) - 1 do if r.TakeFX_GetFloatingWindow(take, j) then - r.TakeFX_SetEnabled(take, j, not r.TakeFX_GetEnabled(take, j)) + if WetToggle then + local wetparam = r.TakeFX_GetParamFromIdent( take, j, ":wet" ) + local wetparam_value = r.TakeFX_GetParam(take, j, wetparam) + local wetparam_value = math.floor(wetparam_value + 0.5) + r.TakeFX_SetParam(take, j, wetparam, math.abs(wetparam_value -1) ) + else + r.TakeFX_SetEnabled(take, j, not r.TakeFX_GetEnabled(take, j)) + end end if ChainFXwndw then if j == TKchainfltngfx then - r.TakeFX_SetEnabled(take, TKchainfltngfx, not r.TakeFX_GetEnabled(take, TKchainfltngfx)) + if WetToggle then + local wetparam = r.TakeFX_GetParamFromIdent( take, TKchainfltngfx, ":wet" ) + local wetparam_value = r.TakeFX_GetParam(take, TKchainfltngfx, wetparam) + local wetparam_value = math.floor(wetparam_value + 0.5) + r.TakeFX_SetParam(take, TKchainfltngfx, wetparam, math.abs(wetparam_value -1) ) + else + r.TakeFX_SetEnabled(take, TKchainfltngfx, not r.TakeFX_GetEnabled(take, TKchainfltngfx)) + end end end