Redesign Session+Route Template Meta Script API

Remove special-cased script types. Allow Action-Scripts to be re-used
for session-setup or route-templates.
This commit is contained in:
Robin Gareus
2017-08-18 20:41:35 +02:00
parent e951e68780
commit e0a83a758e
14 changed files with 344 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
ardour {
["type"] = "TrackSetup",
["type"] = "EditorAction",
name = "Add tracks",
description = [[
This template creates audio tracks.
@@ -12,7 +12,17 @@ You will be prompted for:
]]
}
function session_setup ()
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;
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())
@@ -31,11 +41,11 @@ function session_setup ()
end
-- create tracks
local tl = Session:new_audio_track (1, 1, nil, rv['tracks'], "", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
local tl = Session:new_audio_track (1, 1, nil, rv['tracks'], "", insert_at, ARDOUR.TrackMode.Normal)
-- 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
end
end end