fix mistaken "do not roll" conclusion in TransportFSM::compute_should_roll()
[ardour.git] / scripts / meter_tap.lua
1 ardour {
2     ["type"] = "EditorAction",
3     name = "Meter Tap",
4     author = "Ardour Lua Taskforce",
5     description = [[Change Metering  Point for tracks in your session.]]
6 }
7
8 function factory () return function ()
9
10         local dialog_options = {
11                 { type = "label", colspan = 5, title = "" },
12                 { type = "radio", col = 1, colspan = 7, key = "select", title = "", values ={ ["Set All: Input"] = ARDOUR.MeterPoint.MeterInput, ["Set All: Pre Fader"] = ARDOUR.MeterPoint.MeterPreFader, ["Set All: Post Fader"] = ARDOUR.MeterPoint.MeterPostFader, ["Set All: Output"] = ARDOUR.MeterPoint.MeterOutput, ["Set All: Custom"] = ARDOUR.MeterPoint.MeterCustom}, default = "Set All: Input"},
13                 { type = "label", colspan = 5, title = "" },
14                 { type = "checkbox", col=1, colspan = 1, key = "select-tracks", default = true, title = "Selected tracks only"},
15                 { type = "checkbox", col=2, colspan = 1, key = "rec-tracks", default = true, title = "Record Enabled tracks only"},
16                 { type = "label", colspan = 5, title = "" },
17         }
18
19         local rv = LuaDialog.Dialog("Change all Meter Taps:", dialog_options):run()
20         if not rv then return end -- user cancelled
21
22         local rl;
23         if rv['select-tracks'] then
24                 rl = Editor:get_selection ()
25         else
26                 rl = Session:get_routes()
27         end
28
29         local meter_point = rv['select']
30
31         for route in rl:iter() do
32                 if not(route:to_track():isnil()) then
33                         if rv['rec-tracks'] then
34                                 if route:rec_enable_control():get_value() == 1.0 then
35                                         route:to_track():set_meter_point(meter_point, false)
36                                 end
37                         else
38                                 route:to_track():set_meter_point(meter_point, false)
39                         end
40                 end
41         end
42 end end