Update mixer Store/Recall to work with new published bus controls

This commit is contained in:
Nikolaus Gullotta 2020-01-30 09:09:07 -06:00
parent 6069c870f8
commit 327cd513d3
2 changed files with 80 additions and 29 deletions

View file

@ -160,6 +160,7 @@ function factory ()
local group_name = instance["group_name"]
local name = instance["route_name"]
local gc, tc, pc = instance["gain_control"], instance["trim_control"], instance["pan_control"]
local sends = instance["sends"]
if not(substitution == instance["route_id"]) then
print('SUBSTITUTION FOR: ', name, substitution, Session:route_by_id(PBD.ID(substitution)):name())
@ -172,6 +173,28 @@ function factory ()
if rt:isnil() then rt = Session:route_by_name(name) end
if rt:isnil() then goto nextline end
if sends then
for i, data in pairs(sends) do
i = i-1
for j, ctrl in pairs({
rt:send_level_controllable(i),
rt:send_enable_controllable(i),
rt:send_pan_azimuth_controllable(i),
rt:send_pan_azimuth_enable_controllable(i),
}) do
if not(ctrl:isnil()) then
local value = data[j]
if value then
if debug then
print("Setting " .. ctrl:name() .. " to value " .. value)
end
ctrl:set_value(value, PBD.GroupControlDisposition.NoGroup)
end
end
end
end
end
local cur_group_id = route_groupid_interrogate(rt)
if not(group) and (cur_group_id) then
local g = group_by_id(cur_group_id)

View file

@ -130,6 +130,7 @@ function factory () return function ()
gain_control = %s,
trim_control = %s,
pan_control = %s,
sends = {%s},
muted = %s,
soloed = %s,
order = {%s},
@ -161,9 +162,9 @@ function factory () return function ()
local params_string = " [%d] = %s,"
--ensure easy-to-read formatting doesn't make it through
local route_string = string.gsub(route_string, "[\n\t]", "")
local group_string = string.gsub(group_string, "[\n\t]", "")
local processor_string = string.gsub(processor_string, "[\n\t]", "")
local route_string = string.gsub(route_string, "[\n\t%s]", "")
local group_string = string.gsub(group_string, "[\n\t%s]", "")
local processor_string = string.gsub(processor_string, "[\n\t%s]", "")
local sel = Editor:get_selection ()
local groups_to_write = {}
@ -227,6 +228,32 @@ function factory () return function ()
local pan = r:pan_azimuth_control()
if pan:isnil() then pan = false else pan = pan:get_value() end --sometimes a route doesn't have pan, like the master.
-- Get send information, if any.
local send_string = ""
local i = 0
repeat
local fmt = "{%s, %s, %s, %s}"
string.gsub(fmt, "[\n\t]", "")
local values = {}
for j, ctrl in pairs({
r:send_level_controllable(i),
r:send_enable_controllable(i),
r:send_pan_azimuth_controllable(i),
r:send_pan_azimuth_enable_controllable(i),
}) do
if not(ctrl:isnil()) then
values[#values + 1] = ctrl:get_value()
else
values[#values + 1] = "nil"
end
end
send_string = send_string .. string.format(fmt, table.unpack(values))
send_string = send_string .. ","
i = i + 1
until r:send_enable_controllable(i):isnil()
print(send_string)
local order_nmbr = 0
local tmp_order_str, tmp_cache_str = "", ""
for p in order:iter() do
@ -251,6 +278,7 @@ function factory () return function ()
ARDOUR.LuaAPI.ascii_dtostr(r:gain_control():get_value()),
ARDOUR.LuaAPI.ascii_dtostr(r:trim_control():get_value()),
tostring(pan),
send_string,
r:muted(),
r:soloed(),
tmp_order_str,