summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-04-26 18:15:53 +0200
committerRobin Gareus <robin@gareus.org>2016-04-26 18:16:14 +0200
commit59f7df38a20c38ee255b0c89e3c693175165652b (patch)
treee3426594860aa25cde69e3ecfa242b6c6d7f2543 /libs
parent09e5730ffdb89838e97e56da33e561c1be09b5d4 (diff)
allow to duplicate tracks with sends or load templates with sends/inserts
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 6555d27f81..ef5ace53e8 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -3184,10 +3184,48 @@ Session::new_route_from_template (uint32_t how_many, XMLNode& node, const std::s
XMLNodeList children = node_copy.children ();
for (XMLNodeList::iterator i = children.begin(); i != children.end(); ++i) {
if ((*i)->name() == X_("Processor")) {
+ /* ForceIDRegeneration does not catch the following */
XMLProperty* role = (*i)->property (X_("role"));
+ XMLProperty* type = (*i)->property (X_("type"));
+ if (role && role->value() == X_("Aux")) {
+ /* check if the target bus exists.
+ * we should not save aux-sends in templates.
+ */
+ XMLProperty* target = (*i)->property (X_("target"));
+ if (!target) {
+ (*i)->add_property ("type", "dangling-aux-send");
+ continue;
+ }
+ boost::shared_ptr<Route> r = route_by_id (target->value());
+ if (!r || boost::dynamic_pointer_cast<Track>(r)) {
+ (*i)->add_property ("type", "dangling-aux-send");
+ continue;
+ }
+ }
if (role && role->value() == X_("Listen")) {
(*i)->remove_property (X_("bitslot"));
}
+ else if (role && (role->value() == X_("Send") || role->value() == X_("Aux"))) {
+ char buf[32];
+ Delivery::Role xrole;
+ uint32_t bitslot = 0;
+ xrole = Delivery::Role (string_2_enum (role->value(), xrole));
+ std::string name = Send::name_and_id_new_send(*this, xrole, bitslot, false);
+ snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
+ (*i)->remove_property (X_("bitslot"));
+ (*i)->remove_property (X_("name"));
+ (*i)->add_property ("bitslot", buf);
+ (*i)->add_property ("name", name);
+ }
+ else if (type && type->value() == X_("return")) {
+ // Return::set_state() generates a new one
+ (*i)->remove_property (X_("bitslot"));
+ }
+ else if (type && type->value() == X_("port")) {
+ // PortInsert::set_state() handles the bitslot
+ (*i)->remove_property (X_("bitslot"));
+ (*i)->add_property ("ignore-name", "1");
+ }
}
}