--------------------------------------------------------
user_value = 40 ----- from 0 to 100 percent !
--------------------------------------------------------
function bla() end
function nothing() reaper.defer(bla) end
if not tonumber(user_value)
or user_value < 0
or user_value > 100
then
reaper.MB("Incorrect value at the beginning of the script", "Error", 0)
nothing() return
end
local retval, tracknumber, itemnumber, fxnumber = reaper.GetFocusedFX2()
if tracknumber == 0 then
track = reaper.GetMasterTrack()
else
track = reaper.GetTrack(0,tracknumber-1)
end
if retval then
reaper.Undo_BeginBlock()
if retval == 1 then
local wet_param = reaper.TrackFX_GetNumParams(track, fxnumber) - 2
reaper.TrackFX_SetParam( track, fxnumber, wet_param , user_value/100 )
elseif retval == 2 then
local item = reaper.GetTrackMediaItem(track, itemnumber)
local take = reaper.GetActiveTake(item)
local wet_param = reaper.TakeFX_GetNumParams(take, fxnumber) - 2
reaper.TakeFX_SetParam( take, fxnumber, wet_param, user_value/100 )
end
reaper.Undo_EndBlock('Set Dry/Wet parameter for focused FX by X value', -1)
end