2 ["type"] = "EditorAction",
\r
3 name = "Reset Mixer",
\r
4 author = "Ben Loftis, Nikolaus Gullotta",
\r
5 description = [[Resets key Mixer settings after user-prompt (warning: this cannot be undone)]]
\r
8 function factory() return function()
\r
11 { type = "label", align ="left", colspan="3", title = "Select the items to reset:" },
\r
12 { type = "checkbox", key = "fader", default = true, title = "Fader" },
\r
13 { type = "checkbox", key = "mute", default = true, title = "Mute" },
\r
14 { type = "checkbox", key = "trim", default = true, title = "Trim + Phase" },
\r
15 { type = "checkbox", key = "plug", default = true, title = "Plug-ins" },
\r
16 { type = "checkbox", key = "sends", default = true, title = "Sends and inserts" },
\r
17 { type = "checkbox", key = "dest", default = false, title = "Remove plug-ins instead of bypassing?" },
\r
18 { type = "label", colspan="3", title = "" },
\r
19 { type = "label", colspan="3", title = "Note that this is a script which can be user-edited to match your needs." },
\r
20 { type = "label", colspan="3", title = "" },
\r
23 local pref = LuaDialog.Dialog("Reset Mixer", dlg):run()
\r
24 if not(pref) then goto end_script end
\r
25 assert(pref, 'Dialog box was cancelled or is ' .. type(pref))
\r
27 Session:cancel_all_solo()
\r
28 -- loop over all tracks
\r
29 for t in Session:get_routes():iter() do
\r
30 if not t:is_monitor() and not t:is_auditioner() then
\r
31 --zero the fader and input trim
\r
32 if pref["fader"] then t:gain_control():set_value(1, 1) end
\r
33 if pref["trim"] then
\r
34 t:trim_control():set_value(1, 1)
\r
35 t:phase_control():set_value(0, 1)
\r
37 if pref["mute"] then t:mute_control():set_value(0, 1) end
\r
38 if not(t:pan_azimuth_control():isnil()) then
\r
40 t:pan_azimuth_control():set_value(0.5, 1)
\r
45 local proc = t:nth_processor (i)
\r
50 if not(proc:to_ioprocessor():isnil()) then
\r
51 --check if processor is a send or insert
\r
52 if proc:to_ioprocessor():display_to_user() then
\r
53 queue[#queue + 1] = proc
\r
57 if not(proc:to_insert():isnil()) then
\r
58 --check if processor is foreign to us
\r
59 if not(proc:to_insert():is_channelstrip()) and proc:display_to_user() and not(proc:to_insert():is_nonbypassable()) then
\r
60 --if it is, queue it for later
\r
61 queue[#queue + 1] = proc
\r
66 proc = t:nth_processor(i)
\r
69 for p = 1, #queue do
\r
70 if pref['sends'] then
\r
71 if not(queue[p]:to_ioprocessor():isnil()) then
\r
72 if not(pref["dest"]) then
\r
73 queue[p]:deactivate()
\r
75 t:remove_processor(queue[p], nil, true)
\r
79 if pref['plug'] then
\r
80 print(queue[p]:display_name())
\r
81 if not(pref["dest"]) then
\r
82 queue[p]:deactivate()
\r
84 t:remove_processor(queue[p], nil, true)
\r