2 ["type"] = "EditorAction",
\r
3 name = "Reset Mixer",
\r
4 author = "Ben Loftis, Nikolaus Gullotta, Maxime Lecoq",
\r
5 description = [[Resets key Mixer settings after user-prompt (warning: this cannot be undone)]]
\r
8 function factory() return function()
\r
10 local sp_radio_buttons = { Unreset="unreset", Bypass="bypass", Remove="remove" }
\r
13 { type = "label", align ="left", colspan="3", title = "Please select below the items you want to reset:" },
\r
14 { type = "label", align ="left", colspan="3", title = "(Warning: this cannot be undone!)\n" },
\r
16 { type = "label", align ="left", colspan="3", title = "Levels:" },
\r
17 { type = "checkbox", key = "fader", default = false, title = "Fader" },
\r
18 { type = "checkbox", key = "mute", default = false, title = "Mute" },
\r
19 { type = "checkbox", key = "solo", default = false, title = "Solo" },
\r
20 { type = "checkbox", key = "trim", default = false, title = "Trim + Phase" },
\r
22 { type = "label", align ="left", colspan="3", title = "\nPan:" },
\r
23 { type = "checkbox", key = "pan", default = false, title = "Pan" },
\r
24 { type = "checkbox", key = "panwidth", default = false, title = "Pan width" },
\r
26 { type = "label", align ="left", colspan="3", title = "\nSignal processors:" },
\r
27 { type = "radio", key = "sends", title = "Sends", values=sp_radio_buttons, default="Unreset" },
\r
28 { type = "radio", key = "inserts", title = "Inserts", values=sp_radio_buttons, default="Unreset" },
\r
29 { type = "radio", key = "plug-ins", title = "Plug-ins", values=sp_radio_buttons, default="Unreset" },
\r
31 { type = "label", align ="left", colspan="3", title = "\nAutomation (switch to manual mode):" },
\r
32 { type = "checkbox", key = "autogain", default = false, title = "Gain" },
\r
33 { type = "checkbox", key = "autopan", default = false, title = "Pan" },
\r
34 { type = "checkbox", key = "autopanwidth", default = false, title = "Pan width" },
\r
36 { type = "label", align ="left", colspan="3", title = "" },
\r
39 local pref = LuaDialog.Dialog("Reset Mixer", dlg):run()
\r
41 if not(pref) then goto pass_script end
\r
42 assert(pref, 'Dialog box was cancelled or is ' .. type(pref))
\r
44 -- Manage signal processors state or removal according
\r
45 -- to the user prompt settings and log trace.
\r
46 function handle_processor(effect_type_name, track, proc)
\r
47 local action_name = pref[effect_type_name]
\r
48 local proc_name = proc:display_name()
\r
49 local track_name = track:name()
\r
50 local proc_handled = false
\r
52 if(action_name == "bypass") then
\r
53 if(proc:active()) then
\r
57 elseif(action_name == "remove") then
\r
58 track:remove_processor(proc, nil, true)
\r
62 if(proc_handled) then print(action_name, effect_type_name, proc_name, "on track", track_name) end
\r
66 -- (could be handled in track loop but it's simplier to do it on the session)
\r
67 if pref["solo"] then Session:cancel_all_solo() end
\r
69 -- loop over all tracks
\r
70 for t in Session:get_routes():iter() do
\r
72 if not t:is_monitor() and not t:is_auditioner() then
\r
75 if pref["autogain"] then t:gain_control():set_automation_state(ARDOUR.AutoState.Off) end
\r
76 if pref["autopan"] then t:pan_azimuth_control():set_automation_state(ARDOUR.AutoState.Off) end
\r
77 if pref["autopanwidth"] then
\r
78 local pwc = t:pan_width_control()
\r
79 if(not pwc:isnil()) then -- careful stereo track
\r
80 pwc:set_automation_state(ARDOUR.AutoState.Off)
\r
85 if pref["fader"] then t:gain_control():set_value(1, 1) end
\r
86 if pref["trim"] then
\r
87 t:trim_control():set_value(1, 1)
\r
88 t:phase_control():set_value(0, 1)
\r
90 if pref["mute"] then t:mute_control():set_value(0, 1) end
\r
93 if not(t:pan_azimuth_control():isnil()) then
\r
94 if pref["pan"] then t:pan_azimuth_control():set_value(0.5, 1) end
\r
96 if not(t:pan_width_control():isnil()) then
\r
97 if pref["panwidth"] then t:pan_width_control():set_value(1, 1) end
\r
100 -- signal processors management
\r
102 local proc = t:nth_processor (i)
\r
104 -- collect user procs
\r
105 repeat -- loop over the track procs
\r
108 if not(proc:to_ioprocessor():isnil()) then
\r
109 --check if processor is a send or insert
\r
110 if proc:to_ioprocessor():display_to_user() then
\r
111 handle_processor("sends", t, proc)
\r
116 if not(proc:to_insert():isnil()) then
\r
117 --check if processor is foreign to us
\r
118 if not(proc:to_insert():display_to_user()) then
\r
119 handle_processor("inserts", t, proc)
\r
123 -- regular user plug-in
\r
124 if not(proc:to_plugininsert():isnil()) then
\r
125 handle_processor("plug-ins", t, proc)
\r
128 -- prepare the next proc to be inspected
\r
130 proc = t:nth_processor(i)
\r
132 until proc:isnil() -- end repeat track procs
\r
134 end -- if monitor or auditioner
\r
136 end -- loop over all tracks
\r