-
- if (last_mtc_timestamp == 0) {
-
- last_mtc_timestamp = now;
- last_mtc_frame = mtc_frame;
-
- } 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;
- }
- }
+ if (first_mtc_timestamp == 0 || current.timestamp == 0) {
+ first_mtc_timestamp = now;
+ init_mtc_dll(mtc_frame, qtr);
+ mtc_frame_dll = mtc_frame;
+ ActiveChanged (true); // emit signal