2017-08-17 16:31:17 -04:00
|
|
|
ardour {
|
2017-08-18 14:41:35 -04:00
|
|
|
["type"] = "EditorAction",
|
2017-08-19 18:18:58 -04:00
|
|
|
name = "Create Audio Tracks Interactively",
|
2017-08-17 16:31:17 -04:00
|
|
|
description = [[
|
|
|
|
This template creates audio tracks.
|
|
|
|
|
|
|
|
You will be prompted for:
|
|
|
|
... the number of tracks to add
|
|
|
|
... the name of the tracks ( default: Audio %d )
|
|
|
|
... whether they are mono or stereo (default mono)
|
|
|
|
... whether to record-arm the tracks (default: no)
|
|
|
|
]]
|
|
|
|
}
|
|
|
|
|
2017-08-18 14:41:35 -04:00
|
|
|
function route_setup ()
|
|
|
|
return
|
|
|
|
{
|
|
|
|
['Insert_at'] = ARDOUR.PresentationInfo.max_order;
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
function factory (params) return function ()
|
|
|
|
local p = params or route_setup ()
|
|
|
|
local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
|
|
|
|
|
2017-08-17 16:31:17 -04:00
|
|
|
local e = Session:engine()
|
|
|
|
-- from the engine's POV readable/capture ports are "outputs"
|
|
|
|
local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector())
|
|
|
|
-- table 't' holds argument references. t[4] is the C.StringVector (return value)
|
|
|
|
local tracks = t[4]:size();
|
|
|
|
|
|
|
|
local dialog_options = {
|
|
|
|
{ type = "number", key = "tracks", title = "Create Tracks", min = 1, max = 128, step = 1, digits = 0, default = tracks },
|
|
|
|
{ type = "checkbox", key = "recarm", default = false, title = "Record Arm Tracks" },
|
|
|
|
}
|
|
|
|
|
|
|
|
local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
|
|
|
|
local rv = dlg:run()
|
|
|
|
if (not rv or rv['tracks'] == 0) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- create tracks
|
2017-08-18 14:41:35 -04:00
|
|
|
local tl = Session:new_audio_track (1, 1, nil, rv['tracks'], "", insert_at, ARDOUR.TrackMode.Normal)
|
2017-08-17 16:31:17 -04:00
|
|
|
-- and optionally record-arm them
|
|
|
|
if rv['recarm'] then
|
|
|
|
for track in tl:iter() do
|
|
|
|
track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
|
|
|
|
end
|
|
|
|
end
|
2017-08-18 14:41:35 -04:00
|
|
|
end end
|