Set up region BBT time when frame position changes, if the region is glued to BBT...
[ardour.git] / libs / ardour / send.cc
index 48083d594ab37db39523e3c5a55e98e8891d0afd..f299995ffaef2af29f0d40ad966e7c5dbfc5a0a8 100644 (file)
@@ -21,6 +21,7 @@
 #include <algorithm>
 
 #include "pbd/xml++.h"
+#include "pbd/boost_debug.h"
 
 #include "ardour/amp.h"
 #include "ardour/send.h"
@@ -38,10 +39,12 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
 
-Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, Role r)
-       : Delivery (s, mm, string_compose (_("send %1"), (_bitslot = s.next_send_id()) + 1), r)
+Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMaster> mm, Role r)
+       : Delivery (s, p, mm, string_compose (_("send %1"), (_bitslot = s.next_send_id()) + 1), r)
        , _metering (false)
 {
+       boost_debug_shared_ptr_mark_interesting (this, "send");
+
        _amp.reset (new Amp (_session));
        _meter.reset (new PeakMeter (_session));
 }
@@ -66,12 +69,12 @@ Send::deactivate ()
        _amp->deactivate ();
        _meter->deactivate ();
        _meter->reset ();
-       
+
        Processor::deactivate ();
 }
 
 void
-Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool)
+Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
 {
        if (_output->n_ports() == ChanCount::ZERO) {
                _meter->reset ();
@@ -133,6 +136,8 @@ Send::state (bool full)
        snprintf (buf, sizeof (buf), "%" PRIu32, _bitslot);
        node.add_property ("bitslot", buf);
 
+       node.add_child_nocopy (_amp->state (full));
+
        return node;
 }
 
@@ -142,9 +147,7 @@ Send::set_state (const XMLNode& node, int version)
        if (version < 3000) {
                return set_state_2X (node, version);
        }
-       
-       XMLNodeList nlist = node.children();
-       XMLNodeIterator niter;
+
        const XMLProperty* prop;
 
        Delivery::set_state (node, version);
@@ -161,13 +164,18 @@ Send::set_state (const XMLNode& node, int version)
                 _session.mark_send_id (_bitslot);
         }
 
-       /* XXX need to load automation state & data for amp */
+       XMLNodeList nlist = node.children();
+       for (XMLNodeIterator i = nlist.begin(); i != nlist.end(); ++i) {
+               if ((*i)->name() == X_("Processor")) {
+                       _amp->set_state (**i, version);
+               }
+       }
 
        return 0;
 }
 
 int
-Send::set_state_2X (const XMLNode& node, int version)
+Send::set_state_2X (const XMLNode& node, int /* version */)
 {
        /* use the IO's name for the name of the send */
        XMLNodeList const & children = node.children ();
@@ -191,7 +199,7 @@ Send::set_state_2X (const XMLNode& node, int version)
                return -1;
        }
 
-       XMLProperty const * prop = (*j)->property X_("name");
+       XMLProperty const * prop = (*j)->property (X_("name"));
        if (!prop) {
                return -1;
        }
@@ -212,6 +220,7 @@ Send::can_support_io_configuration (const ChanCount& in, ChanCount& out) const
        return true;
 }
 
+/** Caller must hold process lock */
 bool
 Send::configure_io (ChanCount in, ChanCount out)
 {
@@ -219,10 +228,6 @@ Send::configure_io (ChanCount in, ChanCount out)
                return false;
        }
 
-       if (_output) {
-               _output->ensure_io (out, false, 0);
-       }
-
        if (!Processor::configure_io (in, out)) {
                return false;
        }