mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 08:14:58 +01:00
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:
parent
e951e68780
commit
e0a83a758e
14 changed files with 344 additions and 77 deletions
|
|
@ -1,11 +1,52 @@
|
|||
ardour {
|
||||
["type"] = "TrackSetup",
|
||||
name = "Route Test",
|
||||
description = [[ FOR TESTING AND PROTOTYING ONLY ]]
|
||||
["type"] = "EditorAction",
|
||||
name = "Generic Audio Track",
|
||||
description = [[Example ]]
|
||||
}
|
||||
|
||||
-- DON'T COUNT ON THIS TO REMAIN AS IS.
|
||||
-- This may turn into a factory method, re-usable as ActionScript.
|
||||
function session_setup ()
|
||||
Session:new_audio_track (1, 1, nil, 1, "Hello", ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
|
||||
-- If a route_setup function is present in an Editor Action Script
|
||||
-- the script is also listed in the "add track/bus" dialog as meta-template
|
||||
--
|
||||
-- The function is expected to return a Lua table. The table may be empty.
|
||||
function route_setup ()
|
||||
local e = Session:engine()
|
||||
local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector())
|
||||
return
|
||||
{
|
||||
-- keys control which AddRouteDialog controls are made sensitive.
|
||||
-- The following keys accept a default value to pre-seed the dialog
|
||||
['how_many'] = t[4]:size(),
|
||||
['name'] = 'Audio',
|
||||
['channels'] = 2,
|
||||
-- these keys just need to be set (to something other than nil)
|
||||
['insert_at'] = ARDOUR.PresentationInfo.max_order,
|
||||
['group'] = false,
|
||||
--[[
|
||||
['track_mode'] = ARDOUR.TrackMode.Normal,
|
||||
['strict_io'] = true,
|
||||
--]]
|
||||
}
|
||||
end
|
||||
|
||||
-- The Script can be used as EditorAction in which case it can
|
||||
-- optionally provide instantiation parmaters
|
||||
function action_params ()
|
||||
return
|
||||
{
|
||||
['how_many'] = { title = "How Many tracks to add", default = "1" },
|
||||
["name"] = { title = "Track Name Prefix", default = "Audio" },
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
function factory (params) return function ()
|
||||
local p = params or route_setup ()
|
||||
local name = p["name"] or 'Audio'
|
||||
local how_many = p["how_many"] or 1
|
||||
local channels = p["channels"] or 1
|
||||
local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
|
||||
local group = p["group"] or nil
|
||||
|
||||
Session:new_audio_track (channels, channels, group, how_many, name, insert_at, ARDOUR.TrackMode.Normal)
|
||||
|
||||
end end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue