From 92521b7d7490e9814e90f0c8726e108d1530294a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 19 Aug 2017 22:28:25 +0200 Subject: unify session-template names --- scripts/_template_band.lua | 95 ------------------------------------- scripts/_template_example.lua | 60 ----------------------- scripts/session_template_band.lua | 95 +++++++++++++++++++++++++++++++++++++ scripts/session_template_record.lua | 60 +++++++++++++++++++++++ 4 files changed, 155 insertions(+), 155 deletions(-) delete mode 100644 scripts/_template_band.lua delete mode 100644 scripts/_template_example.lua create mode 100644 scripts/session_template_band.lua create mode 100644 scripts/session_template_record.lua (limited to 'scripts') diff --git a/scripts/_template_band.lua b/scripts/_template_band.lua deleted file mode 100644 index ccfb26d7c6..0000000000 --- a/scripts/_template_band.lua +++ /dev/null @@ -1,95 +0,0 @@ -ardour { - ["type"] = "SessionInit", - name = "Live Band Recording Session", - 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 factory () return function () - - --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") - 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 end diff --git a/scripts/_template_example.lua b/scripts/_template_example.lua deleted file mode 100644 index 9656fd1473..0000000000 --- a/scripts/_template_example.lua +++ /dev/null @@ -1,60 +0,0 @@ -ardour { - ["type"] = "SessionInit", - name = "Recording Session", - description = [[Add as many mono tracks to the new session as there are physical audio inputs and optionally record-arm them.]] -} - ----- For use with templates: Session Template setup-hook --- --- If a script named 'template.lua' exists in a session-template folder --- the function produced by the 'factory' function of the script is called --- once after creating the session from the template. --- --- (e.g. ~/.config/ardour5/templates/Template-Name/template.lua) --- --- ----- For use as meta-session (specic session-setup scripts) --- --- Every Lua script in the script-folder of type "SessionInit" --- is listed as implicit template in the new-session dialog. --- The function produced by the scripts `factory` function is called --- once after creating a new, empty session. --- ----- For use as meta-session (general purpose Actions) --- --- In some cases normal action scripts can also serve as session-setup --- To include those ActionScripts in the template-list the script needs --- to implement an additional function --- function session_setup () return true end; --- The script's factory will be called without any parameters - -function factory () return function () - 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 = "heading", title = "Customize Session: " .. Session:name () }, - { 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, 2, 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 - - Session:save_state(""); -end end diff --git a/scripts/session_template_band.lua b/scripts/session_template_band.lua new file mode 100644 index 0000000000..ccfb26d7c6 --- /dev/null +++ b/scripts/session_template_band.lua @@ -0,0 +1,95 @@ +ardour { + ["type"] = "SessionInit", + name = "Live Band Recording Session", + 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 factory () return function () + + --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") + 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 end diff --git a/scripts/session_template_record.lua b/scripts/session_template_record.lua new file mode 100644 index 0000000000..9656fd1473 --- /dev/null +++ b/scripts/session_template_record.lua @@ -0,0 +1,60 @@ +ardour { + ["type"] = "SessionInit", + name = "Recording Session", + description = [[Add as many mono tracks to the new session as there are physical audio inputs and optionally record-arm them.]] +} + +---- For use with templates: Session Template setup-hook +-- +-- If a script named 'template.lua' exists in a session-template folder +-- the function produced by the 'factory' function of the script is called +-- once after creating the session from the template. +-- +-- (e.g. ~/.config/ardour5/templates/Template-Name/template.lua) +-- +-- +---- For use as meta-session (specic session-setup scripts) +-- +-- Every Lua script in the script-folder of type "SessionInit" +-- is listed as implicit template in the new-session dialog. +-- The function produced by the scripts `factory` function is called +-- once after creating a new, empty session. +-- +---- For use as meta-session (general purpose Actions) +-- +-- In some cases normal action scripts can also serve as session-setup +-- To include those ActionScripts in the template-list the script needs +-- to implement an additional function +-- function session_setup () return true end; +-- The script's factory will be called without any parameters + +function factory () return function () + 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 = "heading", title = "Customize Session: " .. Session:name () }, + { 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, 2, 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 + + Session:save_state(""); +end end -- cgit v1.2.3