diff options
author | Nikolaus Gullotta <nik@harrisonconsoles.com> | 2020-01-30 09:09:07 -0600 |
---|---|---|
committer | Nikolaus Gullotta <nik@harrisonconsoles.com> | 2020-01-30 09:10:11 -0600 |
commit | 327cd513d3117c9c893f7b97990644073c6fa6d5 (patch) | |
tree | bd7498e626481cc38093dbd93044c168042b6c2a /scripts | |
parent | 6069c870f88e70ad00954be028d333bb07757f4b (diff) |
Update mixer Store/Recall to work with new published bus controls
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mixer_settings_recall.lua | 27 | ||||
-rw-r--r-- | scripts/mixer_settings_store.lua | 82 |
2 files changed, 80 insertions, 29 deletions
diff --git a/scripts/mixer_settings_recall.lua b/scripts/mixer_settings_recall.lua index 080ecaef3a..9e30bd6c9b 100644 --- a/scripts/mixer_settings_recall.lua +++ b/scripts/mixer_settings_recall.lua @@ -159,7 +159,8 @@ function factory () local group = instance["group"] 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 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()) @@ -170,7 +171,29 @@ function factory () local rt = Session:route_by_id(r_id) if rt:isnil() then rt = Session:route_by_name(name) end - if rt:isnil() then goto nextline 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 diff --git a/scripts/mixer_settings_store.lua b/scripts/mixer_settings_store.lua index 699b92105f..1ec8b51f21 100644 --- a/scripts/mixer_settings_store.lua +++ b/scripts/mixer_settings_store.lua @@ -125,34 +125,35 @@ function factory () return function () empty_last_store(path) local route_string = [[instance = { - route_id = %d, - route_name = '%s', - gain_control = %s, - trim_control = %s, - pan_control = %s, - muted = %s, - soloed = %s, - order = {%s}, - cache = {%s}, - group = %s, - group_name = '%s', - pi_order = %d + route_id = %d, + route_name = '%s', + gain_control = %s, + trim_control = %s, + pan_control = %s, + sends = {%s}, + muted = %s, + soloed = %s, + order = {%s}, + cache = {%s}, + group = %s, + group_name = '%s', + pi_order = %d }]] local group_string = [[instance = { - group_id = %s, - name = '%s', - routes = {%s}, + group_id = %s, + name = '%s', + routes = {%s}, }]] local processor_string = [[instance = { - plugin_id = %d, - type = %d, - display_name = '%s', - owned_by_route_name = '%s', - owned_by_route_id = %d, - parameters = {%s}, - active = %s, + plugin_id = %d, + type = %d, + display_name = '%s', + owned_by_route_name = '%s', + owned_by_route_id = %d, + parameters = {%s}, + active = %s, }]] local group_route_string = " [%d] = %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 = {} @@ -225,7 +226,33 @@ function factory () return function () if route_group then route_group = route_group:name() else route_group = "" end local rid = r:to_stateful():id():to_s() 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. + 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 = "", "" @@ -250,7 +277,8 @@ function factory () return function () r:name(), ARDOUR.LuaAPI.ascii_dtostr(r:gain_control():get_value()), ARDOUR.LuaAPI.ascii_dtostr(r:trim_control():get_value()), - tostring(pan), + tostring(pan), + send_string, r:muted(), r:soloed(), tmp_order_str, |