MTC slave: timcode and delta formatting

git-svn-id: svn://localhost/ardour2/branches/3.0@13279 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Robin Gareus 2012-10-15 02:46:56 +00:00
parent 4ff1cd78fb
commit 6ab663342d

View File

@ -646,8 +646,8 @@ MTC_Slave::approximate_current_position() const
{
SafeTime last;
read_current (&last);
if (last.timestamp == 0) {
return "--:--:--:--";
if (last.timestamp == 0 || reset_pending) {
return " --:--:--:--";
}
return Timecode::timecode_format_sampletime(
last.position,
@ -660,6 +660,13 @@ std::string
MTC_Slave::approximate_current_delta() const
{
char delta[24];
snprintf(delta, sizeof(delta), "%+" PRIi64, current_delta); // XXX TODO unit, refine
SafeTime last;
read_current (&last);
if (last.timestamp == 0 || reset_pending) {
snprintf(delta, sizeof(delta), "---");
} else {
// TODO if current_delta > 1 frame -> display timecode.
snprintf(delta, sizeof(delta), "%+" PRIi64 " sm", current_delta);
}
return std::string(delta);
}