+ DEBUG_TRACE (DEBUG::Destruction, string_compose ("destroying transport master \"%1\" along with port %2\n", name(), (_port ? _port->name() : std::string ("no port"))));
+
+ unregister_port ();
+}
+
+bool
+TransportMaster::speed_and_position (double& speed, samplepos_t& pos, samplepos_t& lp, samplepos_t& when, samplepos_t now)
+{
+ if (!_collect) {
+ return false;
+ }
+
+ if (!locked()) {
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("%1: not locked, no speed and position!\n", name()));
+ return false;
+ }
+
+ SafeTime last;
+ current.safe_read (last);
+
+ if (last.timestamp == 0) {
+ return false;
+ }
+
+ if (last.timestamp && now > last.timestamp && now - last.timestamp > (2.0 * update_interval())) {
+ /* no timecode for two cycles - conclude that it's stopped */
+
+ if (!Config->get_transport_masters_just_roll_when_sync_lost()) {
+ speed = 0;
+ pos = last.position;
+ lp = last.position;
+ when = last.timestamp;
+ _current_delta = 0;
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("%1 not seen since %2 vs %3 (%4) with seekahead = %5 reset pending, pos = %6\n", name(), last.timestamp, now, (now - last.timestamp), update_interval(), pos));
+ return false;
+ }
+ }
+
+ lp = last.position;
+ when = last.timestamp;
+ speed = last.speed;
+
+ /* provide a .1% deadzone to lock the speed */
+ if (fabs (speed - 1.0) <= 0.001) {
+ speed = 1.0;
+ }
+
+ pos = last.position + (now - last.timestamp) * speed;
+
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("%1 sync spd: %2 pos: %3 | last-pos: %4 @ %7| elapsed: %5 | speed: %6\n",
+ name(), speed, pos, last.position, (now - last.timestamp), speed, when));
+
+ return true;