summaryrefslogtreecommitdiff
path: root/scripts/_tracks_generic_audio.lua
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-08-18 20:41:35 +0200
committerRobin Gareus <robin@gareus.org>2017-08-18 20:42:55 +0200
commite0a83a758e458b56d55a0e0beceb90129fc02354 (patch)
tree71a03d4965f2d2d2a13b47c457a093d876dedd1b /scripts/_tracks_generic_audio.lua
parente951e6878097b2d4073cf815e8d9693cafaa5884 (diff)
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.
Diffstat (limited to 'scripts/_tracks_generic_audio.lua')
-rw-r--r--scripts/_tracks_generic_audio.lua18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/_tracks_generic_audio.lua b/scripts/_tracks_generic_audio.lua
index 96034647b7..28d174ae8b 100644
--- a/scripts/_tracks_generic_audio.lua
+++ b/scripts/_tracks_generic_audio.lua
@@ -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