continue with MTC debugging
[ardour.git] / libs / ardour / internal_send.cc
index 2f7e0728f53096c116e090113edc947005649dbe..0fc498be7fc7668815fe8e811d2cd5e3c79b36a9 100644 (file)
@@ -44,12 +44,15 @@ InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, boost:
        set_name (sendto->name());
 
        _send_to->GoingAway.connect (mem_fun (*this, &InternalSend::send_to_going_away));
+       _send_to->NameChanged.connect (mem_fun (*this, &InternalSend::send_to_name_changed));
 }
 
 InternalSend::InternalSend (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node)
-       : Send (s, mm, node, Stateful::loading_state_version, Delivery::Aux /* will be reset in set_state() */)
+       : Send (s, mm, node, Stateful::loading_state_version, Delivery::Aux /* will be reset in set_state() */),
+         target (0)
 {
-       set_state (node, Stateful::loading_state_version);
+       /* Send constructor will set its state, so here we just need to set up our own */
+       set_our_state (node, Stateful::loading_state_version);
 }
 
 InternalSend::~InternalSend ()
@@ -70,7 +73,7 @@ InternalSend::send_to_going_away ()
 }
 
 void
-InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes, bool)
 {
        if ((!_active && !_pending_active) || !target || !_send_to) {
                _meter->reset ();
@@ -113,7 +116,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
        // so that we don't overwrite the main automation data for the route amp
        // _amp->setup_gain_automation (start_frame, end_frame, nframes);
 
-       _amp->run (mixbufs, start_frame, end_frame, nframes);
+       _amp->run (mixbufs, start_frame, end_frame, nframes, true);
 
        /* XXX NEED TO PAN */
 
@@ -123,7 +126,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
                if (_amp->gain_control()->get_value() == 0) {
                        _meter->reset();
                } else {
-                       _meter->run (mixbufs, start_frame, end_frame, nframes);
+                       _meter->run (mixbufs, start_frame, end_frame, nframes, true);
                }
        }
 
@@ -170,12 +173,10 @@ InternalSend::get_state()
 }
 
 int
-InternalSend::set_state (const XMLNode& node, int version)
+InternalSend::set_our_state (const XMLNode& node, int version)
 {
        const XMLProperty* prop;
 
-       Send::set_state (node, version);
-
        if ((prop = node.property ("target")) != 0) {
 
                _send_to_id = prop->value();
@@ -195,6 +196,13 @@ InternalSend::set_state (const XMLNode& node, int version)
        return 0;
 }
 
+int
+InternalSend::set_state (const XMLNode& node, int version)
+{
+       Send::set_state (node, version);
+       return set_our_state (node, version);
+}
+
 int
 InternalSend::connect_when_legal ()
 {
@@ -259,3 +267,9 @@ InternalSend::visible () const
 
        return false;
 }
+
+void
+InternalSend::send_to_name_changed ()
+{
+       set_name (_send_to->name ());
+}