Somewhat uncertain fix to playhead misbehaviour in rewind.
[ardour.git] / libs / ardour / port_insert.cc
index 4854c08d8b32e5d9b0fee3b0e65435d159a1a0a0..df758e223088467cec3c832a3b9c576c81a82576 100644 (file)
@@ -41,9 +41,9 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-PortInsert::PortInsert (Session& s, boost::shared_ptr<MuteMaster> mm)
+PortInsert::PortInsert (Session& s, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster> mm)
        : IOProcessor (s, true, true, string_compose (_("insert %1"), (bitslot = s.next_insert_id()) + 1), "")
-       , _out (new Delivery (s, _output, mm, _name, Delivery::Insert))
+       , _out (new Delivery (s, _output, pannable, mm, _name, Delivery::Insert))
 {
         _mtdm = 0;
         _latency_detect = false;
@@ -78,12 +78,12 @@ PortInsert::stop_latency_detection ()
 }
 
 void
-PortInsert::set_measured_latency (nframes_t n)
+PortInsert::set_measured_latency (framecnt_t n)
 {
         _measured_latency = n;
 }
 
-nframes_t 
+framecnt_t 
 PortInsert::latency() const 
 {
        /* because we deliver and collect within the same cycle,
@@ -101,7 +101,7 @@ PortInsert::latency() const
 }
 
 void
-PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool)
+PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
 {
        if (_output->n_ports().n_total() == 0) {
                return;
@@ -166,7 +166,7 @@ PortInsert::state (bool full)
        node.add_property ("type", "port");
        snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
        node.add_property ("bitslot", buf);
-        snprintf (buf, sizeof (buf), "%u", _measured_latency);
+        snprintf (buf, sizeof (buf), "%" PRId64, _measured_latency);
         node.add_property("latency", buf);
         snprintf (buf, sizeof (buf), "%u", _session.get_block_size());
         node.add_property("block_size", buf);
@@ -184,9 +184,9 @@ PortInsert::set_state (const XMLNode& node, int version)
 
        const XMLNode* insert_node = &node;
 
-       // legacy sessions: search for child IOProcessor node
+       // legacy sessions: search for child Redirect node
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
-               if ((*niter)->name() == "IOProcessor") {
+               if ((*niter)->name() == "Redirect") {
                        insert_node = *niter;
                        break;
                }
@@ -227,7 +227,7 @@ PortInsert::set_state (const XMLNode& node, int version)
        return 0;
 }
 
-ARDOUR::nframes_t
+ARDOUR::framecnt_t
 PortInsert::signal_latency() const
 {
        /* because we deliver and collect within the same cycle,
@@ -244,22 +244,20 @@ PortInsert::signal_latency() const
         }
 }
 
-/** Caller must not hold process lock */
+/** Caller must hold process lock */
 bool
 PortInsert::configure_io (ChanCount in, ChanCount out)
 {
+       assert (!AudioEngine::instance()->process_lock().trylock());
+       
        /* for an insert, processor input corresponds to IO output, and vice versa */
 
-       {
-               Glib::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
-               
-               if (_input->ensure_io (in, false, this) != 0) {
-                       return false;
-               }
-               
-               if (_output->ensure_io (out, false, this) != 0) {
-                       return false;
-               }
+       if (_input->ensure_io (in, false, this) != 0) {
+               return false;
+       }
+       
+       if (_output->ensure_io (out, false, this) != 0) {
+               return false;
        }
 
        return Processor::configure_io (in, out);