summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/slave.h8
-rw-r--r--libs/ardour/mtc_slave.cc11
2 files changed, 19 insertions, 0 deletions
diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h
index 8f4ac1384b..85730e78b6 100644
--- a/libs/ardour/ardour/slave.h
+++ b/libs/ardour/ardour/slave.h
@@ -171,6 +171,12 @@ class Slave {
* @return - whether ARDOUR should use the slave speed without any adjustments
*/
virtual bool give_slave_full_control_over_transport_speed() const { return false; }
+
+ /**
+ * @return - current time-delta between engine and sync-source
+ */
+ virtual std::string approximate_current_delta() const { return ""; }
+
};
/// We need this wrapper for testability, it's just too hard to mock up a session class
@@ -255,6 +261,7 @@ class MTC_Slave : public TimecodeSlave {
bool requires_seekahead () const { return true; }
framecnt_t seekahead_distance() const;
bool give_slave_full_control_over_transport_speed() const;
+ std::string approximate_current_delta() const;
Timecode::TimecodeFormat apparent_timecode_format() const;
std::string approximate_current_position() const;
@@ -289,6 +296,7 @@ class MTC_Slave : public TimecodeSlave {
Timecode::TimecodeFormat a3e_timecode;
Timecode::Time timecode;
bool printed_timecode_warning;
+ frameoffset_t current_delta;
/* DLL - chase MTC */
double t0; ///< time at the beginning of the MTC quater frame
diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc
index 4696f1e936..5eee8381bb 100644
--- a/libs/ardour/mtc_slave.cc
+++ b/libs/ardour/mtc_slave.cc
@@ -183,6 +183,7 @@ MTC_Slave::reset (bool with_position)
window_begin = 0;
window_end = 0;
transport_direction = 1;
+ current_delta = 0;
}
void
@@ -629,6 +630,8 @@ MTC_Slave::speed_and_position (double& speed, framepos_t& pos)
DEBUG_TRACE (DEBUG::MTC, string_compose ("MTCsync spd: %1 pos: %2 | last-pos: %3 elapsed: %4 delta: %5\n",
speed, pos, last.position, elapsed, pos - sess_pos));
+ current_delta = (pos - sess_pos);
+
return true;
}
@@ -652,3 +655,11 @@ MTC_Slave::approximate_current_position() const
Timecode::timecode_to_frames_per_second(mtc_timecode),
Timecode::timecode_has_drop_frames(mtc_timecode));
}
+
+std::string
+MTC_Slave::approximate_current_delta() const
+{
+ char delta[24];
+ snprintf(delta, sizeof(delta), "%+" PRIi64, current_delta); // XXX TODO unit, refine
+ return std::string(delta);
+}