Make Session::backend_sync_callback() emit Session::Located
authorJohannes Mueller <github@johannes-mueller.org>
Fri, 9 Jun 2017 19:24:57 +0000 (21:24 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 10 Jun 2017 16:30:42 +0000 (18:30 +0200)
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

index 3b3be8f3b224e60a2dabc3d052b537e5ef5c896d..64641e302beb4d9c78a9d18811c5ba03ef5c3ace 100644 (file)
@@ -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 {