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

Release Floating FX bypass toggle v1.1 #1425

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 66 additions & 11 deletions FX/80icio_Floating FX bypass toggle.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
-- @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
-- Please install IMGUI library
--
-- Thanks to BirdBird & Tycho


r = reaper

dofile(r.GetResourcePath() .. '/Scripts/ReaTeam Extensions/API/imgui.lua') ('0.8.1')
Expand All @@ -29,23 +31,26 @@ 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



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 )
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down