X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fmeter_tap.lua;h=645af522bd7e97003d46a57dcf3be43d2687dce7;hb=refs%2Fheads%2Fcarl-master;hp=6f8f62c22917dff79618a59a8650380450c0ce15;hpb=7496f06fa31389e6c287e02f7357dd72fdde37e4;p=ardour.git diff --git a/scripts/meter_tap.lua b/scripts/meter_tap.lua index 6f8f62c229..645af522bd 100644 --- a/scripts/meter_tap.lua +++ b/scripts/meter_tap.lua @@ -17,34 +17,26 @@ function factory () return function () } local rv = LuaDialog.Dialog("Change all Meter Taps:", dialog_options):run() - if rv then - meter_point = rv['select'] - if rv['select-tracks'] then - local sel = Editor:get_selection () - for route in sel.tracks:routelist():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 - 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 + if not rv then return end -- user cancelled + + local rl; + if rv['select-tracks'] then + rl = Editor:get_selection () + else + rl = Session:get_routes() + end + + local meter_point = rv['select'] + + for route in rl: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 - end end