diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-12-04 20:26:35 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-12-04 20:26:35 +0000 |
commit | 0494a68daaa7cb40acf00b52c2821b14d70fbe48 (patch) | |
tree | 063d02388b709938aad85c2e3d7bba8cbce8d7c7 | |
parent | f4e03bd3894078002cb0a96a10887e55dea3c8d8 (diff) |
fix up MTC message delivered internally when locate is noticed (removes stupid message when MTC slaving)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4287 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/ardour/session.h | 4 | ||||
-rw-r--r-- | libs/ardour/ardour/slave.h | 1 | ||||
-rw-r--r-- | libs/ardour/mtc_slave.cc | 13 | ||||
-rw-r--r-- | libs/ardour/session_process.cc | 16 | ||||
-rw-r--r-- | libs/midi++2/mtc.cc | 2 |
5 files changed, 25 insertions, 11 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index ac0c052fa1..a2089b4358 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -398,6 +398,10 @@ class Session : public PBD::StatefulDestructible 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; diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 509f8fa9d2..b07c4d27bb 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -91,6 +91,7 @@ class MTC_Slave : public Slave, public sigc::trackable { 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; diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index 3b4aaae887..db7e1d5c84 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -16,7 +16,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - +#include <iostream> #include <errno.h> #include <poll.h> #include <sys/types.h> @@ -43,6 +43,8 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) { can_notify_on_unknown_rate = true; + last_mtc_fps_byte = session.get_mtc_smpte_bits (); + rebind (p); reset (); } @@ -96,6 +98,8 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) smpte.seconds = msg[1]; smpte.frames = msg[0]; + last_mtc_fps_byte = msg[4]; + switch (msg[4]) { case MTC_24_FPS: smpte.rate = 24; @@ -120,7 +124,9 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) 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(); @@ -170,8 +176,9 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full) 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]; diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 3e3a4ee3d7..5891be2083 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -446,7 +446,7 @@ Session::follow_slave (nframes_t nframes, nframes_t offset) _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; } @@ -643,12 +643,14 @@ Session::follow_slave (nframes_t nframes, nframes_t offset) 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); diff --git a/libs/midi++2/mtc.cc b/libs/midi++2/mtc.cc index 46f71dc23d..9d62c7354c 100644 --- a/libs/midi++2/mtc.cc +++ b/libs/midi++2/mtc.cc @@ -50,7 +50,6 @@ Parser::possible_mtc (byte *sysex_buf, size_t msglen) 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 @@ -292,6 +291,7 @@ Parser::process_mtc_quarter_frame (byte *msg) if (!_mtc_locked) { _mtc_locked = true; } + mtc_time (_mtc_time, false); } expected_mtc_quarter_frame_code = 0; |