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 = "dest", default = false, title = "Remove plug-ins instead of bypassing?" },
\r
17 { type = "label", colspan="3", title = "" },
\r
18 { type = "label", colspan="3", title = "Note that this is a script which can be user-edited to match your needs." },
\r
19 { type = "label", colspan="3", title = "" },
\r
22 local pref = LuaDialog.Dialog("Reset Mixer", dlg):run()
\r
23 if not(pref) then goto end_script end
\r
24 assert(pref, 'Dialog box was cancelled or is ' .. type(pref))
\r
26 Session:cancel_all_solo()
\r
27 -- loop over all tracks
\r
28 for t in Session:get_routes():iter() do
\r
29 if not t:is_monitor() and not t:is_auditioner() then
\r
30 --zero the fader and input trim
\r
31 if pref["fader"] then t:gain_control():set_value(1, 1) end
\r
32 if pref["trim"] then
\r
33 t:trim_control():set_value(1, 1)
\r
34 t:phase_control():set_value(0, 1)
\r
36 if pref["mute"] then t:mute_control():set_value(0, 1) end
\r
37 if not(t:pan_azimuth_control():isnil()) then
\r
39 t:pan_azimuth_control():set_value(0.5, 1)
\r
44 local proc = t:nth_processor (i)
\r
48 "recorder", "latcomp-", "player",
\r
49 "Polarity", "Trim", "Fader",
\r
50 "meter-", "main outs", "Monitor",
\r
54 local name = proc:display_name()
\r
55 --check if processor is foreign to us
\r
56 protected_proc = false
\r
57 for _, v in pairs(protected) do
\r
58 if string.find(name, v) then
\r
59 --processor is not foreign to us
\r
60 protected_proc = true
\r
64 if not(protected_proc) and proc:display_to_user() then
\r
66 queue[#queue + 1] = proc
\r
70 proc = t:nth_processor(i)
\r
73 for p = 1, #queue do
\r
74 if pref['plug'] then
\r
75 if not(pref["dest"]) then
\r
76 queue[p]:deactivate()
\r
78 t:remove_processor(queue[p], nil, true)
\r