Cleaup meter-tap: reduce nesting and remove code-dup

This commit is contained in:
Robin Gareus 2019-04-08 16:12:19 +02:00
parent 3ec261ae5d
commit 57616fdb11
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -17,34 +17,26 @@ function factory () return function ()
} }
local rv = LuaDialog.Dialog("Change all Meter Taps:", dialog_options):run() local rv = LuaDialog.Dialog("Change all Meter Taps:", dialog_options):run()
if rv then if not rv then return end -- user cancelled
meter_point = rv['select']
if rv['select-tracks'] then local rl;
local sel = Editor:get_selection () if rv['select-tracks'] then
for route in sel.tracks:routelist():iter() do rl = Editor:get_selection ()
if not(route:to_track():isnil()) then else
if rv['rec-tracks'] then rl = Session:get_routes()
if route:rec_enable_control():get_value() == 1.0 then end
route:to_track():set_meter_point(meter_point, false)
end local meter_point = rv['select']
else
route:to_track():set_meter_point(meter_point, false) for route in rl:iter() do
end if not(route:to_track():isnil()) then
end if rv['rec-tracks'] then
end if route:rec_enable_control():get_value() == 1.0 then
else route:to_track():set_meter_point(meter_point, false)
for route in Session:get_routes():iter() do
if not(route:to_track():isnil()) then
if rv['rec-tracks'] then
if route:rec_enable_control():get_value() == 1.0 then
route:to_track():set_meter_point(meter_point, false)
end
else
route:to_track():set_meter_point(meter_point, false)
end
end end
else
route:to_track():set_meter_point(meter_point, false)
end end
end end
end end
end end end end