2 ["type"] = "EditorAction",
3 name = "Create Audio Tracks Interactively",
5 This template creates audio tracks.
7 You will be prompted for:
8 ... the number of tracks to add
9 ... the name of the tracks ( default: Audio %d )
10 ... whether they are mono or stereo (default mono)
11 ... whether to record-arm the tracks (default: no)
15 function route_setup ()
18 ['Insert_at'] = ARDOUR.PresentationInfo.max_order;
22 function factory (params) return function ()
23 local p = params or route_setup ()
24 local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
26 local e = Session:engine()
27 -- from the engine's POV readable/capture ports are "outputs"
28 local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector())
29 -- table 't' holds argument references. t[4] is the C.StringVector (return value)
30 local tracks = t[4]:size();
32 local dialog_options = {
33 { type = "number", key = "tracks", title = "Create Tracks", min = 1, max = 128, step = 1, digits = 0, default = tracks },
34 { type = "checkbox", key = "recarm", default = false, title = "Record Arm Tracks" },
37 local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
39 if (not rv or rv['tracks'] == 0) then
44 local tl = Session:new_audio_track (1, 1, nil, rv['tracks'], "", insert_at, ARDOUR.TrackMode.Normal)
45 -- and optionally record-arm them
47 for track in tl:iter() do
48 track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)