2 ["type"] = "EditorAction",
3 name = "Generic Audio Track",
4 description = [[Example ]]
7 -- If a route_setup function is present in an Editor Action Script
8 -- the script is also listed in the "add track/bus" dialog as meta-template
10 -- The function is expected to return a Lua table. The table may be empty.
11 function route_setup ()
12 local e = Session:engine()
13 local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector())
16 -- keys control which AddRouteDialog controls are made sensitive.
17 -- The following keys accept a default value to pre-seed the dialog.
18 ['how_many'] = t[4]:size(),
21 ['track_mode'] = ARDOUR.TrackMode.Normal,
23 -- these keys just need to be set (to something other than nil)
24 -- in order to set the control sensitives
25 ['insert_at'] = ARDOUR.PresentationInfo.max_order,
26 ['group'] = false, -- return value will be a RouteGroup*
27 ['instrument'] = nil, -- return value will be a PluginInfoPtr
31 -- The Script can be used as EditorAction in which case it can
32 -- optionally provide instantiation parmaters
33 function action_params ()
36 ['how_many'] = { title = "How Many tracks to add", default = "1" },
37 ["name"] = { title = "Track Name Prefix", default = "Audio" },
42 function factory (params) return function ()
43 -- When called from the AddRouteDialog, 'params' will be a table with
44 -- keys as described in route_setup() above.
46 local p = params or route_setup ()
47 local name = p["name"] or 'Audio'
48 local how_many = p["how_many"] or 1
49 local channels = p["channels"] or 1
50 local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
51 local group = p["group"] or nil
52 local mode = p["track_mode"] or ARDOUR.TrackMode.Normal
53 local strict_io = p["strict_io"] or false
56 if ARDOUR.config():get_output_auto_connect() == ARDOUR.AutoConnectOption.AutoConnectMaster then
57 if not Session:master_out():isnil() then
58 chan_out = Session:master_out():n_inputs ():n_audio ()
66 local tl = Session:new_audio_track (channels, chan_out, group, how_many, name, insert_at, mode)
70 t:set_strict_io (true)