From d155f32039570e9e0cde11b42e395ca2bcc89ffd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 11 Mar 2011 02:55:52 +0000 Subject: sorta-kinda working latency compensation, latency reporting and capture alignment ... working except that we report the wrong information to JACK and i've noticed a couple of odd circumstances where turning on a latent plugin caused punch recording to fail git-svn-id: svn://localhost/ardour2/branches/3.0@9121 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/io.cc | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) (limited to 'libs/ardour/io.cc') diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index fce6a669f9..4cb1cca5b6 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -96,6 +96,18 @@ IO::~IO () } } +void +IO::increment_port_buffer_offset (pframes_t offset) +{ + /* io_lock, not taken: function must be called from Session::process() calltree */ + + if (_direction == Output) { + for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { + i->increment_port_buffer_offset (offset); + } + } +} + void IO::silence (framecnt_t nframes) { @@ -1133,16 +1145,6 @@ IO::set_name (const string& requested_name) return r; } -void -IO::set_port_latency (framecnt_t nframes) -{ - Glib::Mutex::Lock lm (io_lock); - - for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { - i->set_latency (nframes); - } -} - framecnt_t IO::latency () const { @@ -1154,26 +1156,17 @@ IO::latency () const /* io lock not taken - must be protected by other means */ for (PortSet::const_iterator i = _ports.begin(); i != _ports.end(); ++i) { - if ((latency = i->total_latency ()) > max_latency) { + if ((latency = i->public_latency_range (_direction == Output).max) > max_latency) { max_latency = latency; } } - DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: max latency from %2 ports = %3\n", - name(), _ports.num_ports(), max_latency)); + DEBUG_TRACE (DEBUG::Latency, string_compose ("%1: max %4 latency from %2 ports = %3\n", + name(), _ports.num_ports(), max_latency, + ((_direction == Output) ? "PLAYBACK" : "CAPTURE"))); return max_latency; } -void -IO::update_port_total_latencies () -{ - /* io_lock, not taken: function must be called from Session::process() calltree */ - - for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { - _session.engine().update_total_latency (*i); - } -} - int IO::connect_ports_to_bundle (boost::shared_ptr c, void* src) { -- cgit v1.2.3