impl MClk slave, update format for LTC, MTC
negative delta: Ardour is behind,
positive delta: Ardour is ahead of ext clock.
git-svn-id: svn://localhost/ardour2/branches/3.0@13299
d708f5d6-7413-0410-9779-
e7cbd77b26cf
#include <ltc.h>
#endif
+// used for approximate_current_delta():
+#define PLUSMINUS(A) ( ((A)<0) ? "\u2012" : (((A)>0) ? "+" : "\u00B1") )
+
namespace MIDI {
class Port;
}
bool give_slave_full_control_over_transport_speed() const { return true; }
void set_bandwidth (double a_bandwith) { bandwidth = a_bandwith; }
+ std::string approximate_current_delta() const;
protected:
ISlaveSessionProxy* session;
/// DLL filter coefficients
double b, c, omega;
+ frameoffset_t current_delta;
+
void reset ();
void start (MIDI::Parser& parser, framepos_t timestamp);
void contineu (MIDI::Parser& parser, framepos_t timestamp);
{
char delta[24];
if (last_timestamp == 0 || frames_in_sequence < 2) {
- snprintf(delta, sizeof(delta), "---");
+ snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
} else if ((monotonic_cnt - last_timestamp) > 2 * frames_per_ltc_frame) {
snprintf(delta, sizeof(delta), "flywheel");
} else {
// TODO if current_delta > 1 frame -> display timecode.
// delta >0 if A3's transport is _behind_ LTC
- snprintf(delta, sizeof(delta), "%+4" PRIi64 " sm", current_delta);
+ snprintf(delta, sizeof(delta), "%s%4" PRIi64 " sm",
+ PLUSMINUS(-current_delta), abs(current_delta));
}
return std::string(delta);
}
_started = true;
// session->request_locate(0, false);
+ current_delta = 0;
}
void
}
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("speed_and_position: %1 & %2 <-> %3 (transport)\n", speed, pos, session->transport_frame()));
+ current_delta = pos - session->transport_frame();
return true;
}
return (framecnt_t) one_ppqn_in_frames * ppqn;
}
+std::string
+MIDIClock_Slave::approximate_current_delta() const
+{
+ char delta[24];
+ if (last_timestamp == 0 || _starting) {
+ snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
+ } else {
+ snprintf(delta, sizeof(delta), "%s%4" PRIi64 " sm",
+ PLUSMINUS(-current_delta), abs(current_delta));
+ }
+ return std::string(delta);
+}
+
SafeTime last;
read_current (&last);
if (last.timestamp == 0 || reset_pending) {
- snprintf(delta, sizeof(delta), "---");
+ snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
} else {
// TODO if current_delta > 1 frame -> display timecode.
- snprintf(delta, sizeof(delta), "%+4" PRIi64 " sm", current_delta);
+ snprintf(delta, sizeof(delta), "%s%4" PRIi64 " sm",
+ PLUSMINUS(-current_delta), abs(current_delta));
}
return std::string(delta);
}