trk_template_desc.set_sensitive (true);
manual_label.set_sensitive (false);
- add_label.set_sensitive (false);
+ add_label.set_sensitive (rs.find ("how_many") != rs.end ());
type_label.set_sensitive (false);
name_label.set_sensitive (rs.find ("name") != rs.end());
}
if ((it = rs.find ("how_many")) != rs.end()) {
- routes_adjustment.set_value (atoi (it->second.c_str()));
+ if (atoi (it->second.c_str()) > 0) {
+ routes_adjustment.set_value (atoi (it->second.c_str()));
+ }
}
if ((it = rs.find ("track_mode")) != rs.end()) {
mode_combo.set_active_text (_("Tape"));
}
break;
+ default: // "NonLayered" enum is still present for session-format compat
+ break;
}
}
trk_template_desc.set_sensitive (true);
manual_label.set_sensitive (false);
- add_label.set_sensitive (false);
+ add_label.set_sensitive (true);
type_label.set_sensitive (false);
name_label.set_sensitive (true);
group_label.set_sensitive (false);
}
trk_template_model->clear();
+ bool selected_default = false;
/* Add any Lua scripts (factory templates) found in the scripts folder */
LuaScriptList& ms (LuaScripting::instance ().scripts (LuaScriptInfo::EditorAction));
continue;
}
TreeModel::Row row;
- if ( (*s)->name == "Add tracks") { //somewhat-special, most-used template
+ if ( (*s)->name == "Create Audio Tracks Interactively" && Profile->get_mixbus ()) {
+ // somewhat-special, Ben says: "most-used template"
row = *(trk_template_model->prepend ());
} else {
row = *(trk_template_model->append ());
row[track_template_columns.description] = (*s)->description;
row[track_template_columns.created_with] = _("{Factory Template}");
- if ( (*s)->name == "Add tracks") { //somewhat-special, most-used template
+ if ((*s)->name == "Create Audio Tracks Interactively" && Profile->get_mixbus ()) {
trk_template_chooser.get_selection()->select(row);
+ selected_default = true;
}
}
row[track_template_columns.description] = _("Use the controls, below, to add tracks.");
row[track_template_columns.created_with] = "";
+ if (!selected_default) {
+ trk_template_chooser.get_selection()->select(row);
+ }
+
set_popdown_strings (channel_combo, channel_combo_strings);
if (!channel_current_choice.empty()) {
LuaScriptList& ms (LuaScripting::instance ().scripts (LuaScriptInfo::SessionInit));
for (LuaScriptList::const_iterator s = ms.begin(); s != ms.end(); ++s) {
TreeModel::Row row = *(template_model->append ());
- row[session_template_columns.name] = "Meta: " + (*s)->name;
+ row[session_template_columns.name] = (*s)->name;
row[session_template_columns.path] = "urn:ardour:" + (*s)->path;
row[session_template_columns.description] = (*s)->description;
row[session_template_columns.created_with_short] = _("{Factory Template}");
+++ /dev/null
-ardour {
- ["type"] = "EditorAction",
- name = "Generic Audio Track",
- description = [[Example ]]
-}
-
--- 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,
- ['track_mode'] = ARDOUR.TrackMode.Normal,
- ['strict_io'] = true,
- -- these keys just need to be set (to something other than nil)
- -- in order to set the control sensitives
- ['insert_at'] = ARDOUR.PresentationInfo.max_order,
- ['group'] = false, -- return value will be a RouteGroup*
- ['instrument'] = nil, -- return value will be a PluginInfoPtr
- }
-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 ()
- -- When called from the AddRouteDialog, 'params' will be a table with
- -- keys as described in route_setup() above.
-
- 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
- local mode = p["track_mode"] or ARDOUR.TrackMode.Normal
- local strict_io = p["strict_io"] or false
- local chan_out = 0
-
- if ARDOUR.config():get_output_auto_connect() == ARDOUR.AutoConnectOption.AutoConnectMaster then
- if not Session:master_out():isnil() then
- chan_out = Session:master_out():n_inputs ():n_audio ()
- end
- end
-
- if chan_out == 0 then
- chan_out = channels;
- end
-
- local tl = Session:new_audio_track (channels, chan_out, group, how_many, name, insert_at, mode)
-
- if strict_io then
- for t in tl:iter() do
- t:set_strict_io (true)
- end
- end
-
-end end
--- /dev/null
+ardour {
+ ["type"] = "EditorAction",
+ name = "Generic Audio Track",
+ description = [[Example ]]
+}
+
+-- 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,
+ ['track_mode'] = ARDOUR.TrackMode.Normal,
+ ['strict_io'] = true,
+ -- these keys just need to be set (to something other than nil)
+ -- in order to set the control sensitives
+ ['insert_at'] = ARDOUR.PresentationInfo.max_order,
+ ['group'] = false, -- return value will be a RouteGroup*
+ ['instrument'] = nil, -- return value will be a PluginInfoPtr
+ }
+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 ()
+ -- When called from the AddRouteDialog, 'params' will be a table with
+ -- keys as described in route_setup() above.
+
+ 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
+ local mode = p["track_mode"] or ARDOUR.TrackMode.Normal
+ local strict_io = p["strict_io"] or false
+ local chan_out = 0
+
+ if ARDOUR.config():get_output_auto_connect() == ARDOUR.AutoConnectOption.AutoConnectMaster then
+ if not Session:master_out():isnil() then
+ chan_out = Session:master_out():n_inputs ():n_audio ()
+ end
+ end
+
+ if chan_out == 0 then
+ chan_out = channels;
+ end
+
+ local tl = Session:new_audio_track (channels, chan_out, group, how_many, name, insert_at, mode)
+
+ if strict_io then
+ for t in tl:iter() do
+ t:set_strict_io (true)
+ end
+ end
+
+end end
--- /dev/null
+ardour {
+ ["type"] = "EditorAction",
+ name = "Generic MIDI Track",
+ description = [[Example]]
+}
+
+-- 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 ()
+ return
+ {
+ -- keys control which AddRouteDialog controls are made sensitive.
+ -- The following keys accept a default value to pre-seed the dialog.
+ ['how_many'] = 1,
+ ['name'] = 'MIDI',
+ ['channels'] = nil,
+ ['track_mode'] = nil,
+ ['strict_io'] = true,
+ -- these keys just need to be set (to something other than nil)
+ -- in order to set the control sensitives
+ ['insert_at'] = ARDOUR.PresentationInfo.max_order,
+ ['group'] = false, -- return value will be a RouteGroup*
+ ['instrument'] = true, -- return value will be a PluginInfoPtr
+ }
+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 = "MIDI" },
+ ["instrument"] = { title = "Add Instrument", default = "true" },
+ }
+end
+
+
+function factory (params) return function ()
+ -- When called from the AddRouteDialog, 'params' will be a table with
+ -- keys as described in route_setup() above.
+
+ local p = params or route_setup ()
+ local name = p["name"] or 'Audio'
+ local how_many = p["how_many"] or 1
+ local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
+ local group = p["group"] or nil
+ local strict_io = p["strict_io"] or false
+ local instrument = p["instrument"] or nil
+
+ -- used in 'action-script mode'
+ if instrument == "true" then
+ instrument = ARDOUR.LuaAPI.new_plugin_info ("http://gareus.org/oss/lv2/gmsynth", ARDOUR.PluginType.LV2) -- general midi synth
+ if instrument:isnil () then
+ instrument = ARDOUR.LuaAPI.new_plugin_info ("https://community.ardour.org/node/7596", ARDOUR.PluginType.LV2) -- reasonable synth
+ end
+ if instrument:isnil () then
+ LuaDialog.Message ("MIDI track add", "Cannot find instrument plugin",
+ LuaDialog.MessageType.Info, LuaDialog.ButtonType.Close):run ()
+ return
+ end
+ end
+
+ -- add no instrument
+ if type (instrument) ~= "userdata" then
+ instrument = ARDOUR.PluginInfo ()
+ end
+
+ Session:new_midi_track(
+ ARDOUR.ChanCount(ARDOUR.DataType ("midi"), 1),
+ ARDOUR.ChanCount(ARDOUR.DataType ("audio"), 2),
+ strict_io,
+ instrument, nil,
+ group, how_many, name, insert_at, ARDOUR.TrackMode.Normal)
+
+end end
+++ /dev/null
-ardour {
- ["type"] = "EditorAction",
- name = "Create Audio Tracks interactively",
- 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 route_setup ()
- return
- {
- ['Insert_at'] = ARDOUR.PresentationInfo.max_order;
- }
-end
-
-function factory (params) return function ()
- local p = params or route_setup ()
- local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
-
- 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'], "", insert_at, 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 end
--- /dev/null
+ardour {
+ ["type"] = "EditorAction",
+ name = "Create Audio Tracks Interactively",
+ 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 route_setup ()
+ return
+ {
+ ['Insert_at'] = ARDOUR.PresentationInfo.max_order;
+ }
+end
+
+function factory (params) return function ()
+ local p = params or route_setup ()
+ local insert_at = p["insert_at"] or ARDOUR.PresentationInfo.max_order;
+
+ 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'], "", insert_at, 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 end