2018-07-17 13:55:43 -04:00
|
|
|
ardour {
|
|
|
|
["type"] = "EditorAction",
|
|
|
|
name = "Reset Mixer",
|
|
|
|
author = "Ben Loftis, Nikolaus Gullotta",
|
|
|
|
description = [[Resets key Mixer settings after user-prompt (warning: this cannot be undone)]]
|
|
|
|
}
|
|
|
|
|
|
|
|
function factory() return function()
|
|
|
|
|
|
|
|
local dlg = {
|
|
|
|
{ type = "label", align ="left", colspan="3", title = "Select the items to reset:" },
|
|
|
|
{ type = "checkbox", key = "fader", default = true, title = "Fader" },
|
|
|
|
{ type = "checkbox", key = "mute", default = true, title = "Mute" },
|
|
|
|
{ type = "checkbox", key = "trim", default = true, title = "Trim + Phase" },
|
|
|
|
{ type = "checkbox", key = "plug", default = true, title = "Plug-ins" },
|
2018-08-01 13:13:59 -04:00
|
|
|
{ type = "checkbox", key = "sends", default = true, title = "Sends and inserts" },
|
2018-07-17 13:55:43 -04:00
|
|
|
{ type = "checkbox", key = "dest", default = false, title = "Remove plug-ins instead of bypassing?" },
|
|
|
|
{ type = "label", colspan="3", title = "" },
|
|
|
|
{ type = "label", colspan="3", title = "Note that this is a script which can be user-edited to match your needs." },
|
|
|
|
{ type = "label", colspan="3", title = "" },
|
|
|
|
}
|
|
|
|
|
|
|
|
local pref = LuaDialog.Dialog("Reset Mixer", dlg):run()
|
|
|
|
if not(pref) then goto end_script end
|
|
|
|
assert(pref, 'Dialog box was cancelled or is ' .. type(pref))
|
|
|
|
|
|
|
|
Session:cancel_all_solo()
|
|
|
|
-- loop over all tracks
|
|
|
|
for t in Session:get_routes():iter() do
|
|
|
|
if not t:is_monitor() and not t:is_auditioner() then
|
|
|
|
--zero the fader and input trim
|
|
|
|
if pref["fader"] then t:gain_control():set_value(1, 1) end
|
|
|
|
if pref["trim"] then
|
|
|
|
t:trim_control():set_value(1, 1)
|
|
|
|
t:phase_control():set_value(0, 1)
|
|
|
|
end
|
|
|
|
if pref["mute"] then t:mute_control():set_value(0, 1) end
|
|
|
|
if not(t:pan_azimuth_control():isnil()) then
|
|
|
|
if pref["pan"] then
|
|
|
|
t:pan_azimuth_control():set_value(0.5, 1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
local proc = t:nth_processor (i)
|
|
|
|
local queue = {}
|
|
|
|
|
|
|
|
repeat
|
2018-08-01 13:13:59 -04:00
|
|
|
|
|
|
|
if not(proc:to_ioprocessor():isnil()) then
|
|
|
|
--check if processor is a send or insert
|
|
|
|
if proc:to_ioprocessor():display_to_user() then
|
|
|
|
queue[#queue + 1] = proc
|
2018-07-17 13:55:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-08-01 13:13:59 -04:00
|
|
|
if not(proc:to_insert():isnil()) then
|
|
|
|
--check if processor is foreign to us
|
|
|
|
if not(proc:to_insert():is_channelstrip()) and proc:display_to_user() and not(proc:to_insert():is_nonbypassable()) then
|
|
|
|
--if it is, queue it for later
|
|
|
|
queue[#queue + 1] = proc
|
|
|
|
end
|
2018-07-17 13:55:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
i = i + 1
|
|
|
|
proc = t:nth_processor(i)
|
|
|
|
until proc:isnil()
|
|
|
|
|
|
|
|
for p = 1, #queue do
|
2018-08-01 13:13:59 -04:00
|
|
|
if pref['sends'] then
|
|
|
|
if not(queue[p]:to_ioprocessor():isnil()) then
|
|
|
|
if not(pref["dest"]) then
|
|
|
|
queue[p]:deactivate()
|
|
|
|
else
|
|
|
|
t:remove_processor(queue[p], nil, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2018-07-17 13:55:43 -04:00
|
|
|
if pref['plug'] then
|
2018-08-01 13:13:59 -04:00
|
|
|
print(queue[p]:display_name())
|
2018-07-17 13:55:43 -04:00
|
|
|
if not(pref["dest"]) then
|
|
|
|
queue[p]:deactivate()
|
|
|
|
else
|
|
|
|
t:remove_processor(queue[p], nil, true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
::end_script::
|
2018-07-17 16:16:04 -04:00
|
|
|
collectgarbage()
|
2018-07-17 13:55:43 -04:00
|
|
|
end end
|