mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
prepare reporting slave delta & MTC slave implementation
git-svn-id: svn://localhost/ardour2/branches/3.0@13276 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3769c060f2
commit
a6bc97add9
3 changed files with 22 additions and 3 deletions
|
|
@ -1121,7 +1121,7 @@ AudioClock::set_timecode (framepos_t when, bool /*force*/)
|
||||||
_left_layout->set_text (string_compose ("%1 %2",
|
_left_layout->set_text (string_compose ("%1 %2",
|
||||||
sync_source_to_string(sync_src, true),
|
sync_source_to_string(sync_src, true),
|
||||||
dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position()));
|
dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position()));
|
||||||
_right_layout->set_text ("+- 0"); // XXX
|
_right_layout->set_text (slave->approximate_current_delta());
|
||||||
} else {
|
} else {
|
||||||
_left_layout->set_text (string_compose ("%1 --pending--",
|
_left_layout->set_text (string_compose ("%1 --pending--",
|
||||||
sync_source_to_string(sync_src, true)));
|
sync_source_to_string(sync_src, true)));
|
||||||
|
|
@ -1131,14 +1131,14 @@ AudioClock::set_timecode (framepos_t when, bool /*force*/)
|
||||||
case MIDIClock:
|
case MIDIClock:
|
||||||
_left_layout->set_text (string_compose ("%1",
|
_left_layout->set_text (string_compose ("%1",
|
||||||
sync_source_to_string(sync_src, true)));
|
sync_source_to_string(sync_src, true)));
|
||||||
_right_layout->set_text ("");
|
_right_layout->set_text (slave->approximate_current_delta());
|
||||||
break;
|
break;
|
||||||
case LTC:
|
case LTC:
|
||||||
if (slave) {
|
if (slave) {
|
||||||
_left_layout->set_text (string_compose ("%1 %2",
|
_left_layout->set_text (string_compose ("%1 %2",
|
||||||
sync_source_to_string(sync_src, true),
|
sync_source_to_string(sync_src, true),
|
||||||
dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position()));
|
dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position()));
|
||||||
_right_layout->set_text ("+- 0"); // XXX
|
_right_layout->set_text (slave->approximate_current_delta());
|
||||||
} else {
|
} else {
|
||||||
_left_layout->set_text (string_compose ("%1 --pending--",
|
_left_layout->set_text (string_compose ("%1 --pending--",
|
||||||
sync_source_to_string(sync_src, true)));
|
sync_source_to_string(sync_src, true)));
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,12 @@ class Slave {
|
||||||
* @return - whether ARDOUR should use the slave speed without any adjustments
|
* @return - whether ARDOUR should use the slave speed without any adjustments
|
||||||
*/
|
*/
|
||||||
virtual bool give_slave_full_control_over_transport_speed() const { return false; }
|
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
|
/// 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; }
|
bool requires_seekahead () const { return true; }
|
||||||
framecnt_t seekahead_distance() const;
|
framecnt_t seekahead_distance() const;
|
||||||
bool give_slave_full_control_over_transport_speed() const;
|
bool give_slave_full_control_over_transport_speed() const;
|
||||||
|
std::string approximate_current_delta() const;
|
||||||
|
|
||||||
Timecode::TimecodeFormat apparent_timecode_format() const;
|
Timecode::TimecodeFormat apparent_timecode_format() const;
|
||||||
std::string approximate_current_position() const;
|
std::string approximate_current_position() const;
|
||||||
|
|
@ -289,6 +296,7 @@ class MTC_Slave : public TimecodeSlave {
|
||||||
Timecode::TimecodeFormat a3e_timecode;
|
Timecode::TimecodeFormat a3e_timecode;
|
||||||
Timecode::Time timecode;
|
Timecode::Time timecode;
|
||||||
bool printed_timecode_warning;
|
bool printed_timecode_warning;
|
||||||
|
frameoffset_t current_delta;
|
||||||
|
|
||||||
/* DLL - chase MTC */
|
/* DLL - chase MTC */
|
||||||
double t0; ///< time at the beginning of the MTC quater frame
|
double t0; ///< time at the beginning of the MTC quater frame
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,7 @@ MTC_Slave::reset (bool with_position)
|
||||||
window_begin = 0;
|
window_begin = 0;
|
||||||
window_end = 0;
|
window_end = 0;
|
||||||
transport_direction = 1;
|
transport_direction = 1;
|
||||||
|
current_delta = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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",
|
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));
|
speed, pos, last.position, elapsed, pos - sess_pos));
|
||||||
|
|
||||||
|
current_delta = (pos - sess_pos);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -652,3 +655,11 @@ MTC_Slave::approximate_current_position() const
|
||||||
Timecode::timecode_to_frames_per_second(mtc_timecode),
|
Timecode::timecode_to_frames_per_second(mtc_timecode),
|
||||||
Timecode::timecode_has_drop_frames(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);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue