Skip to content

Commit 0abc962

Browse files
authored
Release Floating FX bypass toggle v1.1 (ReaTeam#1425)
- Added toggle wet knob function
1 parent f5b35d9 commit 0abc962

File tree

1 file changed

+66
-11
lines changed

1 file changed

+66
-11
lines changed

Diff for: FX/80icio_Floating FX bypass toggle.lua

+66-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
-- @description Floating FX bypass toggle
22
-- @author 80icio
3-
-- @version 1.0
3+
-- @version 1.1
4+
-- @changelog - Added toggle wet knob function
45
-- @about
56
-- This script let you toggle any visible floating FX bypass.
67
-- track FX, take FX, input FX or fx chain focused FX
78
-- Please install IMGUI library
89
--
910
-- Thanks to BirdBird & Tycho
1011

12+
1113
r = reaper
1214

1315
dofile(r.GetResourcePath() .. '/Scripts/ReaTeam Extensions/API/imgui.lua') ('0.8.1')
@@ -29,23 +31,26 @@ TakeFX = str_to_bool(r.GetExtState(scriptname,'TakeFX') ) or false
2931

3032
ChainFXwndw = str_to_bool(r.GetExtState(scriptname,'ChainFXwndw') ) or false
3133

34+
WetToggle = str_to_bool(r.GetExtState(scriptname,'WetToggle') ) or false
35+
3236

3337
function exit()
3438
r.SetExtState(scriptname,'trkFX',tostring(trkFX),true)
3539
r.SetExtState(scriptname,'TakeFX',tostring(TakeFX),true)
3640
r.SetExtState(scriptname,'InpFX',tostring(InpFX),true)
3741
r.SetExtState(scriptname,'ChainFXwndw',tostring(ChainFXwndw),true)
42+
r.SetExtState(scriptname,'WetToggle',tostring(WetToggle),true)
3843
end
3944

4045

4146

4247
ctx = r.ImGui_CreateContext(scriptname)
4348

4449
function TFB_GUI()
45-
r.ImGui_SetNextWindowSize( ctx, 220, 105)
50+
r.ImGui_SetNextWindowSize( ctx, 300, 80)
4651
local visible, open = r.ImGui_Begin(ctx, scriptname, true, r.ImGui_WindowFlags_NoResize() | r.ImGui_WindowFlags_NoScrollbar())
4752
if visible then
48-
r.ImGui_BeginTable(ctx, 'options', 2, r.ImGui_TableFlags_SizingStretchProp() )
53+
r.ImGui_BeginTable(ctx, 'options', 3, r.ImGui_TableFlags_SizingStretchProp() )
4954
r.ImGui_TableNextColumn(ctx)
5055

5156
_, trkFX = r.ImGui_Checkbox( ctx, 'Track FX', trkFX )
@@ -55,10 +60,16 @@ function TFB_GUI()
5560

5661
_, TakeFX = r.ImGui_Checkbox( ctx, 'Take FX ', TakeFX )
5762
_, ChainFXwndw = r.ImGui_Checkbox( ctx, 'Chain FX', ChainFXwndw )
58-
r.ImGui_EndTable(ctx)
5963

64+
r.ImGui_TableNextColumn(ctx)
65+
66+
_, WetToggle = r.ImGui_Checkbox( ctx, 'Toggle Wet', WetToggle )
6067
toggleBttn = r.ImGui_Button(ctx,'TOGGLE', -1)
6168

69+
r.ImGui_EndTable(ctx)
70+
71+
72+
6273

6374
r.ImGui_End(ctx)
6475
end
@@ -67,7 +78,7 @@ function TFB_GUI()
6778
end
6879
---------------------------------------END GUI--------------------------
6980
if toggleBttn and (trkFX or InpFX or TakeFX or ChainFXwndw) then
70-
reaper.ClearConsole()
81+
7182
r.Undo_BeginBlock2(0)
7283
for i = -1, r.CountTracks(0) - 1 do
7384

@@ -84,13 +95,29 @@ reaper.ClearConsole()
8495
if trkFX then
8596

8697
if r.TrackFX_GetFloatingWindow( track, index ) then
87-
r.TrackFX_SetEnabled(track, index, not r.TrackFX_GetEnabled(track, index))
98+
if WetToggle then
99+
local wetparam = r.TrackFX_GetParamFromIdent( track, index, ":wet" )
100+
local wetparam_value = r.TrackFX_GetParam(track, index, wetparam)
101+
local wetparam_value = math.floor(wetparam_value + 0.5)
102+
r.TrackFX_SetParam(track, index, wetparam, math.abs(wetparam_value -1) )
103+
else
104+
r.TrackFX_SetEnabled(track, index, not r.TrackFX_GetEnabled(track, index))
105+
end
88106
end
89107
end
90108

91109
if ChainFXwndw then
92110
if index == chainfltngfx then
93-
r.TrackFX_SetEnabled(track, chainfltngfx, not r.TrackFX_GetEnabled(track, chainfltngfx))
111+
112+
if WetToggle then
113+
local wetparam = r.TrackFX_GetParamFromIdent( track, chainfltngfx, ":wet" )
114+
local wetparam_value = r.TrackFX_GetParam(track, chainfltngfx, wetparam)
115+
local wetparam_value = math.floor(wetparam_value + 0.5)
116+
r.TrackFX_SetParam(track, chainfltngfx, wetparam, math.abs(wetparam_value -1) )
117+
else
118+
r.TrackFX_SetEnabled(track, chainfltngfx, not r.TrackFX_GetEnabled(track, chainfltngfx))
119+
end
120+
94121
end
95122
end
96123
--end
@@ -102,13 +129,27 @@ reaper.ClearConsole()
102129
if InpFX then
103130

104131
if r.TrackFX_GetFloatingWindow(track, index + 0x1000000) then
105-
r.TrackFX_SetEnabled(track, index + 0x1000000, not r.TrackFX_GetEnabled(track, index + 0x1000000 ))
132+
if WetToggle then
133+
local wetparam = r.TrackFX_GetParamFromIdent( track, index + 0x1000000, ":wet" )
134+
local wetparam_value = r.TrackFX_GetParam(track, index + 0x1000000, wetparam)
135+
local wetparam_value = math.floor(wetparam_value + 0.5)
136+
r.TrackFX_SetParam(track, index + 0x1000000, wetparam, math.abs(wetparam_value -1) )
137+
else
138+
r.TrackFX_SetEnabled(track, index + 0x1000000, not r.TrackFX_GetEnabled(track, index + 0x1000000 ))
139+
end
106140
end
107141
end
108142

109143
if ChainFXwndw then
110144
if index == INchainfltngfx then
111-
r.TrackFX_SetEnabled(track, INchainfltngfx + 0x1000000, not r.TrackFX_GetEnabled(track, INchainfltngfx + 0x1000000))
145+
if WetToggle then
146+
local wetparam = r.TrackFX_GetParamFromIdent( track, INchainfltngfx + 0x1000000, ":wet" )
147+
local wetparam_value = r.TrackFX_GetParam(track, INchainfltngfx + 0x1000000, wetparam)
148+
local wetparam_value = math.floor(wetparam_value + 0.5)
149+
r.TrackFX_SetParam(track, INchainfltngfx + 0x1000000, wetparam, math.abs(wetparam_value -1) )
150+
else
151+
r.TrackFX_SetEnabled(track, INchainfltngfx + 0x1000000, not r.TrackFX_GetEnabled(track, INchainfltngfx + 0x1000000))
152+
end
112153
end
113154
end
114155
end
@@ -122,12 +163,26 @@ reaper.ClearConsole()
122163
for j = 0, r.TakeFX_GetCount(take) - 1 do
123164

124165
if r.TakeFX_GetFloatingWindow(take, j) then
125-
r.TakeFX_SetEnabled(take, j, not r.TakeFX_GetEnabled(take, j))
166+
if WetToggle then
167+
local wetparam = r.TakeFX_GetParamFromIdent( take, j, ":wet" )
168+
local wetparam_value = r.TakeFX_GetParam(take, j, wetparam)
169+
local wetparam_value = math.floor(wetparam_value + 0.5)
170+
r.TakeFX_SetParam(take, j, wetparam, math.abs(wetparam_value -1) )
171+
else
172+
r.TakeFX_SetEnabled(take, j, not r.TakeFX_GetEnabled(take, j))
173+
end
126174
end
127175

128176
if ChainFXwndw then
129177
if j == TKchainfltngfx then
130-
r.TakeFX_SetEnabled(take, TKchainfltngfx, not r.TakeFX_GetEnabled(take, TKchainfltngfx))
178+
if WetToggle then
179+
local wetparam = r.TakeFX_GetParamFromIdent( take, TKchainfltngfx, ":wet" )
180+
local wetparam_value = r.TakeFX_GetParam(take, TKchainfltngfx, wetparam)
181+
local wetparam_value = math.floor(wetparam_value + 0.5)
182+
r.TakeFX_SetParam(take, TKchainfltngfx, wetparam, math.abs(wetparam_value -1) )
183+
else
184+
r.TakeFX_SetEnabled(take, TKchainfltngfx, not r.TakeFX_GetEnabled(take, TKchainfltngfx))
185+
end
131186
end
132187
end
133188

0 commit comments

Comments
 (0)