From 2770444b0c6893c78d340b3d6c1a4e306be8b960 Mon Sep 17 00:00:00 2001 From: Johannes Mueller Date: Fri, 9 Jun 2017 21:24:57 +0200 Subject: Make Session::backend_sync_callback() emit Session::Located If we sync to jackd AudioEngine::transport_frame() is not yet updated when Session emits Located. Then the playhead ends up in an obsolete position. Therefore we emit Session::Located() also from within Session::backend_sync_callback() as that is called when AudioEngine is done with the relocation. --- libs/ardour/session_time.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libs/ardour/session_time.cc') diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc index 3b3be8f3b2..64641e302b 100644 --- a/libs/ardour/session_time.cc +++ b/libs/ardour/session_time.cc @@ -183,19 +183,26 @@ int Session::backend_sync_callback (TransportState state, framepos_t pos) { bool slave = synced_to_engine(); + // cerr << "Session::backend_sync_callback() _transport_frame: " << _transport_frame << " pos: " << pos << " audible_frame: " << audible_frame() << endl; + + if (slave) { + // cerr << "Session::backend_sync_callback() emitting Located()" << endl; + Located (); /* EMIT SIGNAL */ + } switch (state) { case TransportStopped: if (slave && _transport_frame != pos && post_transport_work() == 0) { request_locate (pos, false); - // cerr << "SYNC: stopped, locate to " << pos->frame << " from " << _transport_frame << endl; + // cerr << "SYNC: stopped, locate to " << pos << " from " << _transport_frame << endl; return false; } else { + // cerr << "SYNC: stopped, nothing to do" << endl; return true; } case TransportStarting: - // cerr << "SYNC: starting @ " << pos->frame << " a@ " << _transport_frame << " our work = " << post_transport_work() << " pos matches ? " << (_transport_frame == pos->frame) << endl; + // cerr << "SYNC: starting @ " << pos << " a@ " << _transport_frame << " our work = " << post_transport_work() << " pos matches ? " << (_transport_frame == pos) << endl; if (slave) { return _transport_frame == pos && post_transport_work() == 0; } else { -- cgit v1.2.3