double frames_per_smpte_frame() const { return _frames_per_smpte_frame; }
nframes_t smpte_frames_per_hour() const { return _smpte_frames_per_hour; }
+ MIDI::byte get_mtc_smpte_bits() const {
+ return mtc_smpte_bits; /* encoding of SMTPE type for MTC */
+ }
+
float smpte_frames_per_second() const;
bool smpte_drop_frames() const;
SafeTime current;
nframes_t mtc_frame; /* current time */
nframes_t last_inbound_frame; /* when we got it; audio clocked */
+ MIDI::byte last_mtc_fps_byte;
float mtc_speed;
nframes_t first_mtc_frame;
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+#include <iostream>
#include <errno.h>
#include <poll.h>
#include <sys/types.h>
{
can_notify_on_unknown_rate = true;
+ last_mtc_fps_byte = session.get_mtc_smpte_bits ();
+
rebind (p);
reset ();
}
smpte.seconds = msg[1];
smpte.frames = msg[0];
+ last_mtc_fps_byte = msg[4];
+
switch (msg[4]) {
case MTC_24_FPS:
smpte.rate = 24;
default:
/* throttle error messages about unknown MTC rates */
if (can_notify_on_unknown_rate) {
- error << _("Unknown rate/drop value in incoming MTC stream, session values used instead") << endmsg;
+ error << string_compose (_("Unknown rate/drop value %1 in incoming MTC stream, session values used instead"),
+ (int) msg[4])
+ << endmsg;
can_notify_on_unknown_rate = false;
}
smpte.rate = session.smpte_frames_per_second();
void
MTC_Slave::handle_locate (const MIDI::byte* mmc_tc)
{
- MIDI::byte mtc[4];
+ MIDI::byte mtc[5];
+ mtc[4] = last_mtc_fps_byte;
mtc[3] = mmc_tc[0] & 0xf; /* hrs only */
mtc[2] = mmc_tc[1];
mtc[1] = mmc_tc[2];
_slave->speed_and_position (slave_speed, slave_transport_frame);
if (!_slave->locked()) {
- cerr << "Slave not locked, not rolling\n";
+ // cerr << "Slave not locked, not rolling\n";
goto noroll;
}
float adjusted_speed = slave_speed +
(delta / (adjust_seconds * _current_frame_rate));
- // cerr << "adjust using " << delta
- // << " towards " << adjusted_speed
- // << " ratio = " << adjusted_speed / slave_speed
- // << " current = " << _transport_speed
- // << " slave @ " << slave_speed
- // << endl;
+#if 0
+ cerr << "adjust using " << delta
+ << " towards " << adjusted_speed
+ << " ratio = " << adjusted_speed / slave_speed
+ << " current = " << _transport_speed
+ << " slave @ " << slave_speed
+ << endl;
+#endif
request_transport_speed (adjusted_speed);
fake_mtc_time[3] = (sysex_buf[5] & 0x1f); // hours
_mtc_fps = MTC_FPS ((sysex_buf[5] & 0x60) >> 5); // fps
-
fake_mtc_time[4] = (byte) _mtc_fps;
/* wait for first quarter frame, which could indicate forwards
if (!_mtc_locked) {
_mtc_locked = true;
}
+
mtc_time (_mtc_time, false);
}
expected_mtc_quarter_frame_code = 0;