Fix Mixer Store/Recall
Two main problems are addressed by this commit. First, storage of parameters was broken because the index for values was set by the parameter count, not the control port count which set_processor_param() expects. Second, the value was not clamped to pd.upper and pd.lower causing some parameters to fail when set. This invalidates previous mixer store files.
This commit is contained in:
parent
250da353d4
commit
858bb4294d
@ -275,18 +275,29 @@ function factory ()
|
||||
if proc:isnil() then goto nextline end
|
||||
local plug = proc:to_insert():plugin(0)
|
||||
|
||||
for k, v in pairs(params) do
|
||||
local label = plug:parameter_label(k)
|
||||
local ctl = 0
|
||||
for j = 0, plug:parameter_count() - 1 do
|
||||
if plug:parameter_is_control(j) then
|
||||
local label = plug:parameter_label(j)
|
||||
value = params[ctl]
|
||||
if value then
|
||||
if string.find(label, "Assign") or string.find(label, "Enable") then --@ToDo: Check Plugin type == LADSPA or VST?
|
||||
enable[k] = v --queue any assignments/enables for after the initial parameter recalling to duck the 'in-on-change' feature
|
||||
enable[ctl] = value -- Queue enable assignment for later
|
||||
goto skip_param
|
||||
end
|
||||
if not(ARDOUR.LuaAPI.set_processor_param(proc, ctl, value)) then
|
||||
print("Could not set ctrl port " .. ctl .. " to " .. value)
|
||||
end
|
||||
end
|
||||
::skip_param::
|
||||
ctl = ctl + 1
|
||||
end
|
||||
print(string.format("%s (Port: %s) -> %s", label, k, v))
|
||||
ARDOUR.LuaAPI.set_processor_param(proc, k, v)
|
||||
end
|
||||
|
||||
for k, v in pairs(enable) do
|
||||
ARDOUR.LuaAPI.set_processor_param(proc, k, v)
|
||||
end
|
||||
|
||||
if act then proc:activate() else proc:deactivate() end
|
||||
end
|
||||
|
||||
|
@ -301,15 +301,26 @@ function factory () return function ()
|
||||
local id = proc:to_stateful():id():to_s()
|
||||
local plug = proc:to_insert ():plugin (0)
|
||||
local ptype = proc:to_insert():plugin(0):get_info().type
|
||||
local n = 0 -- count control-ports
|
||||
for j = 0, plug:parameter_count () - 1 do -- iterate over all plugin parameters
|
||||
|
||||
local n = 0
|
||||
for j = 0, plug:parameter_count() - 1 do -- Iterate over all plugin parameters
|
||||
if plug:parameter_is_control(j) then
|
||||
local label = plug:parameter_label(j)
|
||||
if plug:parameter_is_input(j) and label ~= "hidden" and label:sub(1,1) ~= "#" then
|
||||
--local _, _, pd = ARDOUR.LuaAPI.plugin_automation(proc, n)
|
||||
local val = ARDOUR.LuaAPI.get_processor_param(proc, j, true)
|
||||
print(r:name(), "->", proc:display_name(), label, val)
|
||||
params[j] = val
|
||||
local _, _, pd = ARDOUR.LuaAPI.plugin_automation(proc, n)
|
||||
local val = ARDOUR.LuaAPI.get_processor_param(proc, n, true)
|
||||
|
||||
-- Clamp values at plugin max and min
|
||||
if val < pd.lower then
|
||||
val = pd.lower
|
||||
end
|
||||
|
||||
if val > pd.upper then
|
||||
val = pd.upper
|
||||
end
|
||||
|
||||
print(r:name(), "->", proc:display_name(), "(#".. n ..")", label, val)
|
||||
params[n] = val
|
||||
end
|
||||
n = n + 1
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user