diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-03-18 20:21:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-03-18 20:21:51 +0000 |
commit | ca84e02b48e0c36755963a35713d272c409d9317 (patch) | |
tree | 90f637b7a67431a75fe587fc8ddfee6d04b24de4 /libs/ardour/port.cc | |
parent | 065b5ce8e7c0328153d087aa0209dbe6cb744d54 (diff) |
fix (?) capture alignment by making sure we use non-public latency information for playback latency, thus avoiding counting plugin latency twice
git-svn-id: svn://localhost/ardour2/branches/3.0@9168 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/port.cc')
-rw-r--r-- | libs/ardour/port.cc | 59 |
1 files changed, 44 insertions, 15 deletions
diff --git a/libs/ardour/port.cc b/libs/ardour/port.cc index df1690da37..bc802aa81e 100644 --- a/libs/ardour/port.cc +++ b/libs/ardour/port.cc @@ -346,21 +346,50 @@ Port::get_connected_latency_range (jack_latency_range_t& range, bool playback) c for (vector<string>::const_iterator c = connections.begin(); c != connections.end(); ++c) { - jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str()); - jack_latency_range_t lr; - - if (remote_port) { - jack_port_get_latency_range ( - remote_port, - (playback ? JackPlaybackLatency : JackCaptureLatency), - &lr); - - DEBUG_TRACE (DEBUG::Latency, string_compose ( - "\t%1 <-> %2 : latter has latency range %3 .. %4\n", - name(), *c, lr.min, lr.max)); - range.min = min (range.min, lr.min); - range.max = max (range.max, lr.max); - } + jack_latency_range_t lr; + + if (!AudioEngine::instance()->port_is_mine (*c)) { + + /* port belongs to some other JACK client, use + * JACK to lookup its latency information. + */ + + jack_port_t* remote_port = jack_port_by_name (_engine->jack(), (*c).c_str()); + + if (remote_port) { + jack_port_get_latency_range ( + remote_port, + (playback ? JackPlaybackLatency : JackCaptureLatency), + &lr); + + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "\t%1 <-> %2 : latter has latency range %3 .. %4\n", + name(), *c, lr.min, lr.max)); + + range.min = min (range.min, lr.min); + range.max = max (range.max, lr.max); + } + + } else { + + /* port belongs to this instance of ardour, + so look up its latency information + internally, because our published/public + values already contain our plugin + latency compensation. + */ + + Port* remote_port = AudioEngine::instance()->get_port_by_name (*c); + if (remote_port) { + lr = remote_port->private_latency_range ((playback ? JackPlaybackLatency : JackCaptureLatency)); + DEBUG_TRACE (DEBUG::Latency, string_compose ( + "\t%1 <-LOCAL-> %2 : latter has latency range %3 .. %4\n", + name(), *c, lr.min, lr.max)); + + range.min = min (range.min, lr.min); + range.max = max (range.max, lr.max); + } + } } } else { |