slave delta display
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
This commit is contained in:
parent
501d870b3c
commit
c4cb4fa141
|
@ -38,6 +38,9 @@
|
|||
#include <ltc.h>
|
||||
#endif
|
||||
|
||||
// used for approximate_current_delta():
|
||||
#define PLUSMINUS(A) ( ((A)<0) ? "\u2012" : (((A)>0) ? "+" : "\u00B1") )
|
||||
|
||||
namespace MIDI {
|
||||
class Port;
|
||||
}
|
||||
|
@ -419,6 +422,7 @@ class MIDIClock_Slave : public Slave {
|
|||
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;
|
||||
|
@ -462,6 +466,8 @@ class MIDIClock_Slave : public Slave {
|
|||
/// 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);
|
||||
|
|
|
@ -549,13 +549,14 @@ LTC_Slave::approximate_current_delta() const
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -205,6 +205,7 @@ MIDIClock_Slave::reset ()
|
|||
_started = true;
|
||||
|
||||
// session->request_locate(0, false);
|
||||
current_delta = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -343,6 +344,7 @@ MIDIClock_Slave::speed_and_position (double& speed, framepos_t& pos)
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -354,3 +356,16 @@ MIDIClock_Slave::resolution() const
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -664,10 +664,11 @@ MTC_Slave::approximate_current_delta() const
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user