refactor MIDISceneChange color property addition by moving it into SceneChange to...
[ardour.git] / libs / ardour / internal_send.cc
index 1d4e18d06efbefd676114175ff56fc1c5628b7ab..33b299dfeea9b88058b90590a8471e128b9e44ed 100644 (file)
@@ -40,17 +40,25 @@ using namespace std;
 
 PBD::Signal1<void, pframes_t> InternalSend::CycleStart;
 
-InternalSend::InternalSend (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMaster> mm, boost::shared_ptr<Route> sendto, Delivery::Role role, bool ignore_bitslot)
+InternalSend::InternalSend (Session& s,
+               boost::shared_ptr<Pannable> p,
+               boost::shared_ptr<MuteMaster> mm,
+               boost::shared_ptr<Route> sendfrom,
+               boost::shared_ptr<Route> sendto,
+               Delivery::Role role,
+               bool ignore_bitslot)
        : Send (s, p, mm, role, ignore_bitslot)
+       , _send_from (sendfrom)
 {
-        if (sendto) {
-                if (use_target (sendto)) {
-                        throw failed_constructor();
-                }
-        }
+       if (sendto) {
+               if (use_target (sendto)) {
+                       throw failed_constructor();
+               }
+       }
 
        init_gain ();
 
+       _send_from->DropReferences.connect_same_thread (source_connection, boost::bind (&InternalSend::send_from_going_away, this));
        CycleStart.connect_same_thread (*this, boost::bind (&InternalSend::cycle_start, this, _1));
 }
 
@@ -110,6 +118,12 @@ InternalSend::target_io_changed ()
        reset_panner();
 }
 
+void
+InternalSend::send_from_going_away ()
+{
+       _send_from.reset();
+}
+
 void
 InternalSend::send_to_going_away ()
 {
@@ -129,7 +143,7 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
        // we have to copy the input, because we may alter the buffers with the amp
        // in-place, which a send must never do.
 
-       if (_panshell && !_panshell->bypassed()) {
+       if (_panshell && !_panshell->bypassed() && role() != Listen) {
                _panshell->run (bufs, mixbufs, start_frame, end_frame, nframes);
        } else {
                if (role() == Listen) {
@@ -202,6 +216,8 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
        _amp->setup_gain_automation (start_frame, end_frame, nframes);
        _amp->run (mixbufs, start_frame, end_frame, nframes, true);
 
+       _delayline->run (mixbufs, start_frame, end_frame, nframes, true);
+
        /* consider metering */
 
        if (_metering) {