2 ["type"] = "EditorAction",
5 This template helps create the tracks for a typical pop/rock band.
7 You will be prompted to assemble your session from a list of track types.
9 Each track will be pre-assigned with a color.
11 Optionally, tracks may be assigned to sensible Groups ( vocals, guitars, drums )
13 Optionally, tracks may be assigned Gates and other plugins.
17 function session_setup ()
21 function route_setup ()
24 ['Insert_at'] = ARDOUR.PresentationInfo.max_order;
28 function factory () return function ()
30 local p = params or route_setup ()
31 local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
33 --prompt the user for the tracks they'd like to instantiate
34 local dialog_options = {
35 { type = "heading", title = "Select the tracks you'd like\nto add to your session: ", col=0, align = "left", colspan = 1},
36 { type = "heading", title = "Name", col=1, colspan = 1 },
37 { type = "heading", title = "Stereo?", col=2, colspan = 1 },
39 { type = "checkbox", key = "check-ldvox", default = false, title = "Lead Vocal", col=0 },
40 { type = "entry", key = "name-ldvox", default = "Lead Vocal", title = "", col=1 },
41 { type = "checkbox", key = "stereo-ldvox", default = false, title = "", col=2 },
43 { type = "checkbox", key = "check-bass", default = false, title = "Bass", col=0 },
44 { type = "entry", key = "name-bass", default = "Bass", title = "", col=1 },
45 { type = "checkbox", key = "stereo-bass", default = false, title = "", col=2 },
47 { type = "checkbox", key = "check-piano", default = false, title = "Piano", col=0 },
48 { type = "entry", key = "name-piano", default = "Piano", title = "", col=1 },
49 { type = "checkbox", key = "stereo-piano", default = false, title = "", col=2 },
51 { type = "checkbox", key = "check-electric-piano", default = false, title = "Electric Piano", col=0 },
52 { type = "entry", key = "name-electric-piano", default = "E Piano", title = "", col=1 },
53 { type = "checkbox", key = "stereo-electric-piano", default = false, title = "", col=2 },
55 { type = "checkbox", key = "check-organ", default = false, title = "Organ", col=0 },
56 { type = "entry", key = "name-organ", default = "Organ", title = "", col=1 },
57 { type = "checkbox", key = "stereo-organ", default = false, title = "", col=2 },
59 { type = "checkbox", key = "check-electric-guitar", default = false, title = "Electric Guitar", col=0 },
60 { type = "entry", key = "name-electric-guitar", default = "E Guitar", title = "", col=1 },
61 { type = "checkbox", key = "stereo-electric-guitar", default = false, title = "", col=2 },
63 { type = "checkbox", key = "check-solo-guitar", default = false, title = "Lead Guitar", col=0 },
64 { type = "entry", key = "name-solo-guitar", default = "Ld Gtr", title = "", col=1 },
65 { type = "checkbox", key = "stereo-solo-guitar", default = false, title = "", col=2 },
67 { type = "checkbox", key = "check-accoustic-guitar", default = false, title = "Acoustic Guitar", col=0 },
68 { type = "entry", key = "name-accoustic-guitar", default = "Ac Gtr", title = "", col=1 },
69 { type = "checkbox", key = "stereo-accoustic-guitar", default = false, title = "", col=2 },
71 { type = "checkbox", key = "check-basic-kit", default = false, title = "Basic Drum Mics", col=0 },
72 { type = "label", title = "(Kick + Snare)", col=1, colspan = 1, align = "left"},
73 -- { type = "checkbox", key = "stereo-overhead-mono", default = false, title = "", col=2 },
75 { type = "checkbox", key = "check-full-kit", default = false, title = "Full Drum Mics", col=0 },
76 { type = "label", title = "(Kick, Snare, HiHat, 3 Toms)", col=1, colspan = 1, align = "left"},
77 -- { type = "checkbox", key = "stereo-overhead-mono", default = false, title = "", col=2 },
79 { type = "checkbox", key = "check-overkill-kit", default = false, title = "Overkill Drum Mics", col=0 },
80 { type = "label", title = "(Kick (2x), Snare(2x), HiHat, 3 Toms)", col=1, colspan = 1, align = "left"},
81 -- { type = "checkbox", key = "stereo-overhead-mono", default = false, title = "", col=2 },
83 { type = "checkbox", key = "check-overhead", default = false, title = "Drum Overheads", col=0 },
84 -- { type = "entry", key = "name-ldvox", default = "Lead Vocal", title = "", col=1 },
85 { type = "checkbox", key = "stereo-overhead", default = false, title = "", col=2 },
87 { type = "checkbox", key = "check-room", default = false, title = "Drum Room", col=0 },
88 -- { type = "entry", key = "name-ldvox", default = "Lead Vocal", title = "", col=1 },
89 { type = "checkbox", key = "stereo-room", default = false, title = "", col=2 },
91 { type = "checkbox", key = "check-bgvox", default = false, title = "Background Vocals (3x)", col=0 },
92 -- { type = "entry", key = "name-ldvox", default = "Lead Vocal", title = "", col=1 },
93 { type = "checkbox", key = "stereo-bgvox", default = false, title = "", col=2 },
95 { type = "hseparator", title="", col=0, colspan = 3},
97 { type = "checkbox", key = "group", default = false, title = "Group Track(s)?", col=0 },
98 { type = "checkbox", key = "gates", default = false, title = "Add Gate(s)?", col=0 },
99 { type = "checkbox", key = "char", default = false, title = "Add Character Plugin(s)?", col=0 },
102 local dlg = LuaDialog.Dialog ("Template Setup", dialog_options)
108 -- helper function to reference processors
109 function processor(t, s) --takes a track (t) and a string (s) as arguments
111 local proc = t:nth_processor(i)
113 if ( proc:display_name() == s ) then
118 proc = t:nth_processor(i)
122 --INSTANTIATING MIDI TRACKS IS TOO DAMN HARD
123 function create_midi_track(name, chan_count) -- call this function with a name argument and output channel count
124 Session:new_midi_track(ARDOUR.ChanCount(ARDOUR.DataType ("midi"), 1), ARDOUR.ChanCount(ARDOUR.DataType ("audio"), chan_count), true, ARDOUR.PluginInfo(), nil, nil, 1, name, 1, ARDOUR.TrackMode.Normal)
129 drum_group = Session:new_route_group("Drums")
130 drum_group:set_rgba(0x425CADff)
131 bass_group = Session:new_route_group("Bass")
132 bass_group:set_rgba(0x1AE54Eff)
133 guitar_group = Session:new_route_group("Guitars")
134 guitar_group:set_rgba(0xB475CBff)
135 key_group = Session:new_route_group("Keys")
136 key_group:set_rgba(0xDA8032ff)
137 vox_group = Session:new_route_group("Vox")
138 vox_group:set_rgba(0xC54249ff)
141 local track_count = 0;
142 if rv['check-basic-kit'] then
143 local names = {"Kick", "Snare"}
145 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
146 for track in tl:iter() do
147 local gate = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
148 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
149 if rv['group'] then drum_group:add(track) end
150 if rv['gates'] then track:add_processor_by_index(eg, 0, nil, true) end
154 track_count = track_count+2
157 if rv['check-full-kit'] then
158 local names = {"Kick", "Snare", "Hi-Hat", "Hi-tom", "Mid-tom", "Fl-tom"}
160 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
161 for track in tl:iter() do
162 local eg = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
163 local tg = ARDOUR.LuaAPI.new_plugin(Session, "XT-TG Tom Gate (Mono)", ARDOUR.PluginType.LV2, "")
164 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
165 if rv['group'] then drum_group:add(track) end
167 if string.find(track:name(), '-tom') then
168 track:add_processor_by_index(tg, 0, nil, true)
170 track:add_processor_by_index(eg, 0, nil, true)
176 track_count = track_count+6
179 if rv['check-overkill-kit'] then
180 local names = {"Kick In", "Kick Out", "Snare Top", "Snare Btm", "Hi-Hat", "Hi-tom", "Mid-tom", "Fl-tom"}
182 local tl = Session:new_audio_track (1, 1, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
183 for track in tl:iter() do
184 local eg = ARDOUR.LuaAPI.new_plugin(Session, "XT-EG Expander Gate (Mono)", ARDOUR.PluginType.LV2, "")
185 local tg = ARDOUR.LuaAPI.new_plugin(Session, "XT-TG Tom Gate (Mono)", ARDOUR.PluginType.LV2, "")
186 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
187 if rv['group'] then drum_group:add(track) end
189 if string.find(track:name(), '-tom') then
190 track:add_processor_by_index(tg, 0, nil, true)
192 track:add_processor_by_index(eg, 0, nil, true)
198 track_count = track_count+8
201 if rv['check-overhead'] then
202 local names = { "OH" }
204 if rv["stereo-bass"] then ch = 2 end --stereo
206 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
207 for track in tl:iter() do
208 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
209 if rv['group'] then drum_group:add(track) end
213 track_count = track_count+ch
217 if rv['check-room'] then
218 local names = { "Drum Room" }
220 if rv["stereo-bass"] then ch = 2 end --stereo
222 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
223 for track in tl:iter() do
224 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
225 if rv['group'] then drum_group:add(track) end
229 track_count = track_count+ch
232 if rv['check-bass'] then
233 local names = { rv["name-bass"] }
235 if rv["stereo-bass"] then ch = 2 end --stereo
237 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
238 for track in tl:iter() do
239 local bc = ARDOUR.LuaAPI.new_plugin(Session, "XT-BC Bass Character (Mono)", ARDOUR.PluginType.LV2, "")
240 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
241 if rv['group'] then bass_group:add(track) end
242 if rv['char'] then track:add_processor_by_index(bc, 0, nil, true) end
246 track_count = track_count+ch
249 if rv['check-electric-guitar'] then
250 local names = { rv["name-electric-guitar"] }
252 if rv["stereo-electric-guitar"] then ch = 2 end --stereo
254 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
255 for track in tl:iter() do
256 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
257 if rv['group'] then guitar_group:add(track) end
261 track_count = track_count+ch
264 if rv['check-solo-guitar'] then
265 local names = { rv["name-solo-guitar"] }
267 if rv["stereo-solo-guitar"] then ch = 2 end --stereo
269 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
270 for track in tl:iter() do
271 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
272 if rv['group'] then guitar_group:add(track) end
276 track_count = track_count+ch
279 if rv['check-acoustic-guitar'] then
280 local names = { rv["name-acoustic-guitar"] }
282 if rv["stereo-acoustic-guitar"] then ch = 2 end --stereo
284 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
285 for track in tl:iter() do
286 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
287 if rv['group'] then guitar_group:add(track) end
291 track_count = track_count+ch
294 if rv['check-piano'] then
295 local names = { rv["name-piano"] }
297 if rv["stereo-piano"] then ch = 2 end --stereo
299 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
300 for track in tl:iter() do
301 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
302 if rv['group'] then key_group:add(track) end
306 track_count = track_count+ch
309 if rv['check-electric-piano'] then
310 local names = { rv["name-electric-piano"] }
312 if rv["stereo-electric-piano"] then ch = 2 end --stereo
314 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
315 for track in tl:iter() do
316 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
317 if rv['group'] then key_group:add(track) end
321 track_count = track_count+ch
324 if rv['check-organ'] then
325 local names = { rv["name-organ"] }
327 if rv["stereo-organ"] then ch = 2 end --stereo
329 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
330 for track in tl:iter() do
331 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
332 if rv['group'] then key_group:add(track) end
336 track_count = track_count+ch
339 if rv['check-ldvox'] then
340 local names = { rv["name-ldvox"] }
342 if rv["stereo-ldvox"] then ch = 2 end --stereo
344 local tl = Session:new_audio_track ( ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
345 for track in tl:iter() do
346 local vc = ARDOUR.LuaAPI.new_plugin(Session, "XT-VC Vocal Character (Mono)", ARDOUR.PluginType.LV2, "")
347 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
348 if rv['group'] then vox_group:add(track) end
349 if rv['char'] then track:add_processor_by_index(vc, 0, nil, true) end
353 track_count = track_count+ch
356 if rv['check-bgvox'] then
357 local names = { rv["name-bgvox"] }
359 if rv["stereo-bgvox"] then ch = 2 end --stereo
361 local tl = Session:new_audio_track (ch, ch, nil, 1, names[i], insert_at, ARDOUR.TrackMode.Normal)
362 for track in tl:iter() do
363 --track:rec_enable_control ():set_value (1, PBD.GroupControlDisposition.NoGroup)
364 if rv['group'] then vox_group:add(track) end
368 track_count = track_count+ch
371 --determine the number of tracks we can record
372 local e = Session:engine()
373 local _, t = e:get_backend_ports ("", ARDOUR.DataType("audio"), ARDOUR.PortFlags.IsOutput | ARDOUR.PortFlags.IsPhysical, C.StringVector()) -- from the engine's POV readable/capture ports are "outputs"
374 local num_inputs = t[4]:size(); -- table 't' holds argument references. t[4] is the C.StringVector (return value)
376 --ToDo: if track_count > num_inputs, we should warn the user to check their routing.
378 --fit all tracks on the screen
379 Editor:access_action("Editor","fit_all_tracks")
381 Session:save_state("");