Use XMLNode::set_property API in copy-mixer Session utility

This commit is contained in:
Tim Mayberry 2016-08-30 14:01:52 +10:00
parent a6d71df0d0
commit 0c75813129
1 changed files with 7 additions and 9 deletions

View File

@ -39,37 +39,35 @@ trim_state_for_mixer_copy (Session*s, XMLNode& node)
*/
XMLProperty const * target = (*i)->property (X_("name"));
if (!target) {
(*i)->add_property ("type", "dangling-aux-send");
(*i)->set_property ("type", "dangling-aux-send");
continue;
}
boost::shared_ptr<Route> r = s->route_by_name (target->value ());
if (!r || boost::dynamic_pointer_cast<Track> (r)) {
(*i)->add_property ("type", "dangling-aux-send");
(*i)->set_property ("type", "dangling-aux-send");
continue;
}
(*i)->add_property ("target", r->id ().to_s ());
(*i)->set_property ("target", r->id ().to_s ());
}
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 (*s, 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);
(*i)->set_property ("bitslot", bitslot);
(*i)->set_property ("name", name);
}
else if (type && type->value () == X_("intreturn")) {
// ignore, in case bus existed in old session,
// tracks in old session may be connected to it.
// if the bus is new, new_route_from_template()
// will have re-created an ID.
(*i)->add_property ("type", "ignore-aux-return");
(*i)->set_property ("type", "ignore-aux-return");
}
else if (type && type->value () == X_("return")) {
// Return::set_state() generates a new one
@ -78,7 +76,7 @@ trim_state_for_mixer_copy (Session*s, XMLNode& node)
else if (type && type->value () == X_("port")) {
// PortInsert::set_state() handles the bitslot
(*i)->remove_property (X_("bitslot"));
(*i)->add_property ("ignore-name", "1");
(*i)->set_property ("ignore-name", "1");
}
}
}