From 6ab663342df34cd5b9ceb27efda49ee65f5b6967 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 15 Oct 2012 02:46:56 +0000 Subject: [PATCH] MTC slave: timcode and delta formatting git-svn-id: svn://localhost/ardour2/branches/3.0@13279 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/mtc_slave.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index e29fa3d3da..4b2f8e99cb 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -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); }