13
0

Track templates: add some (unfinished) template files. Hide Created-With column in Ardour.

This commit is contained in:
Ben Loftis 2017-08-17 15:31:17 -05:00
parent 39ffe6d95e
commit 4914b7feea
3 changed files with 143 additions and 0 deletions

View File

@ -130,7 +130,9 @@ AddRouteDialog::AddRouteDialog ()
trk_template_model = TreeStore::create (track_template_columns);
trk_template_chooser.set_model (trk_template_model);
trk_template_chooser.append_column (_("Template"), track_template_columns.name);
#ifdef MIXBUS
trk_template_chooser.append_column (_("Created With"), track_template_columns.created_with);
#endif
trk_template_chooser.set_headers_visible (true);
trk_template_chooser.get_selection()->set_mode (SELECTION_SINGLE);
trk_template_chooser.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &AddRouteDialog::trk_template_row_selected));

100
scripts/_tracks_band.lua Normal file
View File

@ -0,0 +1,100 @@
ardour {
["type"] = "TrackSetup",
name = "Live Band Tracks",
description = [[
This template helps create the tracks for a typical pop/rock band.
You will be prompted to assemble your session from a list of track types.
Each track comes with its pre-assigned grouping, routing, EQ and plugins.
]]
}
function track_setup ()
--prompt the user for the tracks they'd like to instantiate
local dialog_options = {
{ type = "heading", title = "Select the tracks you'd like\n to add to your session: " },
{ type = "checkbox", key = "LeadVox", default = false, title = "Lead Vocal" },
{ type = "checkbox", key = "Bass", default = false, title = "Bass" },
{ type = "checkbox", key = "Piano", default = false, title = "Piano" },
{ type = "checkbox", key = "E. Piano", default = false, title = "E. Piano" },
{ type = "checkbox", key = "Organ", default = false, title = "Organ" },
{ type = "checkbox", key = "ElecGuitar", default = false, title = "Electric Guitar" },
{ type = "checkbox", key = "SoloGuitar", default = false, title = "Guitar Solo" },
{ type = "checkbox", key = "AcousticGuitar", default = false, title = "Acoustic Guitar" },
{ type = "checkbox", key = "basicDrums", default = false, title = "Basic Drum Mics (Kick + Snare)" },
{ type = "checkbox", key = "fullDrums", default = false, title = "Full Drum Mics (Kick, Snare, HiHat, 3 Toms)" },
{ type = "checkbox", key = "overDrums", default = false, title = "Overkill Drum Mics (Kick (2x), Snare(2x), HiHat, 3 Toms)" },
{ type = "checkbox", key = "Drum O-Heads (2 mono)", default = false, title = "Drum O-Heads (2 mono)" },
{ type = "checkbox", key = "Drum O-Heads (Stereo)", default = false, title = "Drum O-Heads (Stereo)" },
{ type = "checkbox", key = "Room (Mono)", default = false, title = "Room (Mono)" },
{ type = "checkbox", key = "Room (Stereo)", default = false, title = "Room (Stereo)" },
{ type = "checkbox", key = "BGV", default = false, title = "Background Vocals (3x)" },
}
local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
local rv = dlg:run()
if (not rv) then
return
end
local track_list = {}
local channel_count = 0
function add_track (io, name)
local tl = Session:new_audio_track (io, io, nil, 1, name, ARDOUR.PresentationInfo.max_order, ARDOUR.TrackMode.Normal)
for track in tl:iter() do
table.insert (track_list, track)
channel_count = channel_count + io
end
end
-- for each selected item, create track(s), add plugins, etc
if rv['Bass'] then
add_track (1, "Bass")
local trk = track_list.front()
local color = 0xff8800ff --orange
trk:presentation_info_ptr ():set_color (color)
end
if rv['Room (Stereo)'] then
add_track (2, "Room (Stereo)")
end
-- TODO add others
-- determine the number of physical inputs
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 num_inputs = t[4]:size()
if num_inputs < channel_count then
-- warn the user if there are less physical inputs than created tracks
LuaDialog.Message ("Session Creation", "Check your routing :)", LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run ()
else
-- otherwise record arm all created tracks
for _, t in ipairs (track_list) do
t:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
end
end
--fit all tracks on the screen
Editor:access_action("Editor","fit_all_tracks")
Session:save_state("");
end

View File

@ -0,0 +1,41 @@
ardour {
["type"] = "TrackSetup",
name = "Add tracks",
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)
]]
}
function track_setup ()
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
local tl = Session:new_audio_track (1, 1, nil, rv['tracks'], "", ARDOUR.PresentationInfo.max_order, 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