|
|
|
10-14-2021, 03:11 AM
|
#1
|
Human being with feelings
Join Date: Jan 2011
Posts: 284
|
Delta conflict with Amagalma script
Hi guys!
New DELTA (difference between dry and wet) function is in conflict with this Script: amagalma_Toggle wet 0-100% (or current value) for focused FX.lua
I am using this script very often to compare before/after without latency issues (like simple plugin bypass do).
Is it problem with DELTA implementation? Or script?
Or is it workaround to TOGGLE between current fx value and 0% fx?
|
|
|
10-14-2021, 03:28 AM
|
#2
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
What happens when you run the script? Can you post the script here?
|
|
|
10-14-2021, 03:50 AM
|
#3
|
Human being with feelings
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
|
amagalma will need to update the script for v6.37, script is assuming Wet param is last.
|
|
|
10-14-2021, 03:53 AM
|
#4
|
Human being with feelings
Join Date: Sep 2021
Location: Berlin
Posts: 1,935
|
Quote:
Originally Posted by andivax
Hi guys!
New DELTA (difference between dry and wet) function is in conflict with this Script: amagalma_Toggle wet 0-100% (or current value) for focused FX.lua
I am using this script very often to compare before/after without latency issues (like simple plugin bypass do).
Is it problem with DELTA implementation? Or script?
Or is it workaround to TOGGLE between current fx value and 0% fx?
|
It's the script; it assumes that wet/dry is the last parameter in the parameter list.
Here's a fixed script, but I think I found a bug in reaper.TakeFX_GetParamFromIdent(), so it might not work 100% yet:
Code:
-- @description amagalma_Toggle wet 0-100% (or current value) for focused FX
-- @author amagalma
-- @version 1.0
-- @about
-- # Toggles wet from 0% to current value (or 100%) for the FX in focus
local reaper, math = reaper, math
local focus, track, item, fx = reaper.GetFocusedFX()
function round(num, numDecimalPlaces)
local mult = 10^(numDecimalPlaces or 0)
if num >= 0 then return math.floor(num * mult + 0.5) / mult
else return math.ceil(num * mult - 0.5) / mult end
end
if focus == 1 then --------------- TRACK FX ---------------
if track == 0 then
track = reaper.GetMasterTrack(0)
else
track = reaper.GetTrack(0, track-1)
end
-- check if it is really visible
local hwnd = reaper.TrackFX_GetFloatingWindow( track, fx )
local chain_vis = reaper.TrackFX_GetChainVisible( track )
if hwnd or chain_vis > -1 then
local wetparam = reaper.TrackFX_GetParamFromIdent( track, fx, ":wet" )
local val = reaper.TrackFX_GetParam( track, fx, wetparam )
local fxguid = reaper.TrackFX_GetFXGUID( track, fx )
local _, name = reaper.TrackFX_GetFXName( track, fx, "" )
if val > 0 then -- store value and set wet to 0%
reaper.SetExtState( "ToggleWet", fxguid, val, false )
reaper.TrackFX_SetParam( track, fx, wetparam, 0 )
reaper.Undo_OnStateChangeEx( "Set " .. name .. " to 0% wet", 2, -1 )
else -- set to previous value if exists or 100%
if reaper.HasExtState( "ToggleWet" , fxguid ) then
val = tonumber(reaper.GetExtState( "ToggleWet", fxguid ))
else
val = 1
end
reaper.TrackFX_SetParam( track, fx, wetparam, val )
reaper.DeleteExtState( "ToggleWet", fxguid, false )
val = round (val * 100)
reaper.Undo_OnStateChangeEx( "Set " .. name .. " to " .. val .. "% wet", 2, -1 )
end
else
reaper.defer(function () end)
end
elseif focus == 2 then --------------- TAKE FX ---------------
item = reaper.GetMediaItem(0, item)
track = reaper.GetMediaItemTrack(item)
local take = reaper.GetMediaItemTake(item, fx >> 16)
-- check if it is really visible
local hwnd = reaper.TakeFX_GetFloatingWindow( take, fx )
local chain_vis = reaper.TakeFX_GetChainVisible( take )
if hwnd or chain_vis > -1 then
local wetparam = reaper.TakeFX_GetParamFromIdent( take, fx, ":wet" )
local val = reaper.TakeFX_GetParam( take, fx, wetparam )
local fxguid = reaper.TakeFX_GetFXGUID( take, fx )
local _, name = reaper.TakeFX_GetFXName( take, fx, "" )
if val > 0 then -- store value and set wet to 0%
reaper.SetExtState( "ToggleWet", fxguid, val, false )
reaper.TakeFX_SetParam( take, fx, wetparam, 0 )
reaper.Undo_OnStateChangeEx( "Set " .. name .. " to 0% wet", 4, -1 )
else -- set to previous value if exists or 100%
if reaper.HasExtState( "ToggleWet" , fxguid ) then
val = tonumber(reaper.GetExtState( "ToggleWet", fxguid ))
else
val = 1
end
reaper.TakeFX_SetParam( take, fx, wetparam, val )
reaper.DeleteExtState( "ToggleWet", fxguid, false )
val = round (val * 100)
reaper.Undo_OnStateChangeEx( "Set " .. name .. " to " .. val .. "% wet", 4, -1 )
end
else
reaper.defer(function () end)
end
elseif focus == 0 then
reaper.defer(function () end)
end
|
|
|
10-14-2021, 03:58 AM
|
#5
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,750
|
Ah, I see. The script makes an assumption about where the wet/dry parameter is in the parameter list. The script should call TrackFX_GetParamFromIdent(":wet") instead.
|
|
|
10-14-2021, 04:21 AM
|
#6
|
Human being with feelings
Join Date: Jan 2011
Posts: 284
|
Thanks guys!
Shwa for clarification and sockmonkey72 for fixing the script.
It is WORKING as expected now.
i will send Amagalma the link to this topic.
|
|
|
10-16-2021, 05:13 AM
|
#7
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thanks sockmonkey72!
The fix will break the script for versions previous to v6.37, though.
I'll update the script so that it works for all versions.
edit: fixed in v1.01
Last edited by amagalma; 10-16-2021 at 05:27 AM.
|
|
|
10-16-2021, 05:51 AM
|
#8
|
Human being with feelings
Join Date: Jan 2011
Posts: 284
|
Quote:
Originally Posted by amagalma
Thanks sockmonkey72!
The fix will break the script for versions previous to v6.37, though.
I'll update the script so that it works for all versions.
edit: fixed in v1.01
|
Thank you! Donated a little bit ))
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:30 AM.
|