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
20 local pref = LuaDialog.Dialog("Reset Mixer", dlg):run()
\r
21 if not(pref) then goto end_script end
\r
22 assert(pref, 'Dialog box was cancelled or is ' .. type(pref))
\r
24 Session:cancel_all_solo()
\r
25 -- loop over all tracks
\r
26 for t in Session:get_routes():iter() do
\r
27 if not t:is_monitor() and not t:is_auditioner() then
\r
28 --zero the fader and input trim
\r
29 if pref["fader"] then t:gain_control():set_value(1, 1) end
\r
30 if pref["trim"] then
\r
31 t:trim_control():set_value(1, 1)
\r
32 t:phase_control():set_value(0, 1)
\r
34 if pref["mute"] then t:mute_control():set_value(0, 1) end
\r
35 if not(t:pan_azimuth_control():isnil()) then
\r
37 t:pan_azimuth_control():set_value(0.5, 1)
\r
42 local proc = t:nth_processor (i)
\r
47 if not(proc:to_ioprocessor():isnil()) then
\r
48 --check if processor is a send or insert
\r
49 if proc:to_ioprocessor():display_to_user() then
\r
50 queue[#queue + 1] = proc
\r
54 if not(proc:to_insert():isnil()) then
\r
55 --check if processor is foreign to us
\r
56 if not(proc:to_insert():is_channelstrip()) and proc:display_to_user() and not(proc:to_insert():is_nonbypassable()) then
\r
57 --if it is, queue it for later
\r
58 queue[#queue + 1] = proc
\r
63 proc = t:nth_processor(i)
\r
66 for p = 1, #queue do
\r
67 if pref['sends'] then
\r
68 if not(queue[p]:to_ioprocessor():isnil()) then
\r
69 if not(pref["dest"]) then
\r
70 queue[p]:deactivate()
\r
72 t:remove_processor(queue[p], nil, true)
\r
76 if pref['plug'] then
\r
77 print(queue[p]:display_name())
\r
78 if not(pref["dest"]) then
\r
79 queue[p]:deactivate()
\r
81 t:remove_processor(queue[p], nil, true)
\r