fix reload of session with new send naming in place, drop "aux-" prefix from name...
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 18 Jan 2012 18:37:26 +0000 (18:37 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 18 Jan 2012 18:37:26 +0000 (18:37 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11264 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/internal_send.cc
libs/ardour/send.cc

index cb9043fcee0bb28d72e401c064ab86b20a434bcb..27e219dd221d95590703993fba19275cb23b4d1e 100644 (file)
@@ -325,7 +325,7 @@ string
 InternalSend::display_name () const
 {
        if (_role == Aux) {
-               return string_compose (X_("aux-%1"), _name);
+               return string_compose (X_("%1"), _name);
        } else {
                return _name;
        }
index fb364e38d65d3a9e72b202f4ec1f06be9b44ce9e..bacb381fe5f392a572d2f58a9c75d23f61c95032 100644 (file)
@@ -42,6 +42,15 @@ using namespace std;
 string
 Send::name_and_id_new_send (Session& s, Role r, uint32_t& bitslot)
 {
+       if (r == Role (0)) {
+               /* this happens during initial construction of sends from XML, 
+                  before they get ::set_state() called. lets not worry about
+                  it.
+               */
+               bitslot = 0;
+               return string ();
+       }
+
        switch (r) {
        case Delivery::Aux:
                return string_compose (_("aux %1"), (bitslot = s.next_aux_send_id ()) + 1);
@@ -61,6 +70,13 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
        : Delivery (s, p, mm, name_and_id_new_send (s, r, _bitslot), r)
        , _metering (false)
 {
+       if (_role == Listen) {
+               /* we don't need to do this but it keeps things looking clean
+                  in a debugger. _bitslot is not used by listen sends.
+               */
+               _bitslot = 0;
+       }
+
        boost_debug_shared_ptr_mark_interesting (this, "send");
 
        _amp.reset (new Amp (_session));
@@ -152,7 +168,10 @@ Send::state (bool full)
 
        node.add_property ("type", "send");
        snprintf (buf, sizeof (buf), "%" PRIu32, _bitslot);
-       node.add_property ("bitslot", buf);
+
+       if (_role != Listen) {
+               node.add_property ("bitslot", buf);
+       }
 
        node.add_child_nocopy (_amp->state (full));
 
@@ -170,7 +189,7 @@ Send::set_state (const XMLNode& node, int version)
 
        Delivery::set_state (node, version);
 
-        /* don't try to reset bitslot if its already set: this can cause
+        /* don't try to reset bitslot if there is a node for it already: this can cause
            issues with the session's accounting of send ID's
         */
 
@@ -180,7 +199,8 @@ Send::set_state (const XMLNode& node, int version)
                } else if (_role == Delivery::Send) {
                        _bitslot = _session.next_send_id ();
                } else {
-                       // bitslot doesn't matter
+                       // bitslot doesn't matter but make it zero anyway
+                       _bitslot = 0;
                }
         } else {
                if (_role == Delivery::Aux) {
@@ -192,7 +212,8 @@ Send::set_state (const XMLNode& node, int version)
                        sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
                        _session.mark_send_id (_bitslot);
                } else {
-                       // bitslot doesn't matter
+                       // bitslot doesn't matter but make it zero anyway
+                       _bitslot = 0;
                }
         }