+ } else {
+
+ if (give_slave_full_control_over_transport_speed()) {
+ /* PIC
+ *
+ * its not the average, but we will assign it to current.speed below
+ */
+
+ static framepos_t last_seen_timestamp = 0;
+ static framepos_t last_seen_position = 0;
+
+ if ((now - last_seen_timestamp) < 300) {
+ mtc_frame = (mtc_frame + last_seen_position)/2;
+ }
+
+ last_seen_timestamp = now;
+ last_seen_position = mtc_frame;
+
+
+
+ } else {
+
+ /* Non-PiC
+ */
+
+ framepos_t time_delta = (now - last_mtc_timestamp);
+
+ if (time_delta != 0) {
+ double apparent_speed = (mtc_frame - last_mtc_frame) / (double) (time_delta);
+
+ process_apparent_speed (apparent_speed);
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("apparent speed was %1 average is now %2\n", apparent_speed, average_speed));
+ } else {
+ DEBUG_TRACE (DEBUG::Slave, string_compose ("no apparent calc, average is %1\n", average_speed));
+ }
+
+ /* every second, recalibrate the starting point for the speed measurement */
+ if (mtc_frame - last_mtc_frame > session.frame_rate()) {
+ last_mtc_timestamp = now;
+ last_mtc_frame = mtc_frame;
+ }
+ }
+ }
+
+ current.guard1++;
+ current.position = mtc_frame;
+ current.timestamp = now;
+ current.speed = average_speed;
+ current.guard2++;
+ window_root = mtc_frame;
+ }