summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/add_route_dialog.cc21
-rw-r--r--gtk2_ardour/session_dialog.cc2
-rw-r--r--scripts/_route_template_generic_audio.lua (renamed from scripts/_route_template_example.lua)0
-rw-r--r--scripts/_route_template_generic_midi.lua78
-rw-r--r--scripts/route_template_interactive_audio.lua (renamed from scripts/_route_template_interactive_audio.lua)2
5 files changed, 96 insertions, 7 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc
index 383039c55b..05df3c71e3 100644
--- a/gtk2_ardour/add_route_dialog.cc
+++ b/gtk2_ardour/add_route_dialog.cc
@@ -302,7 +302,7 @@ AddRouteDialog::trk_template_row_selected ()
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());
@@ -329,7 +329,9 @@ AddRouteDialog::trk_template_row_selected ()
}
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()) {
@@ -342,6 +344,8 @@ AddRouteDialog::trk_template_row_selected ()
mode_combo.set_active_text (_("Tape"));
}
break;
+ default: // "NonLayered" enum is still present for session-format compat
+ break;
}
}
@@ -368,7 +372,7 @@ AddRouteDialog::trk_template_row_selected ()
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);
@@ -743,6 +747,7 @@ AddRouteDialog::refill_channel_setups ()
}
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));
@@ -751,7 +756,8 @@ AddRouteDialog::refill_channel_setups ()
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 ());
@@ -761,8 +767,9 @@ AddRouteDialog::refill_channel_setups ()
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;
}
}
@@ -785,6 +792,10 @@ AddRouteDialog::refill_channel_setups ()
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()) {
diff --git a/gtk2_ardour/session_dialog.cc b/gtk2_ardour/session_dialog.cc
index 6741984d7f..b73514c1aa 100644
--- a/gtk2_ardour/session_dialog.cc
+++ b/gtk2_ardour/session_dialog.cc
@@ -568,7 +568,7 @@ SessionDialog::populate_session_templates ()
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}");
diff --git a/scripts/_route_template_example.lua b/scripts/_route_template_generic_audio.lua
index a3642bf54d..a3642bf54d 100644
--- a/scripts/_route_template_example.lua
+++ b/scripts/_route_template_generic_audio.lua
diff --git a/scripts/_route_template_generic_midi.lua b/scripts/_route_template_generic_midi.lua
new file mode 100644
index 0000000000..a62197d137
--- /dev/null
+++ b/scripts/_route_template_generic_midi.lua
@@ -0,0 +1,78 @@
+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
diff --git a/scripts/_route_template_interactive_audio.lua b/scripts/route_template_interactive_audio.lua
index e53eab4587..99cdf7f3cb 100644
--- a/scripts/_route_template_interactive_audio.lua
+++ b/scripts/route_template_interactive_audio.lua
@@ -1,6 +1,6 @@
ardour {
["type"] = "EditorAction",
- name = "Create Audio Tracks interactively",
+ name = "Create Audio Tracks Interactively",
description = [[
This template creates audio tracks.