summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_clock_slave.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-08-13 12:53:28 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-08-13 12:53:28 -0400
commita5a75d5e0d4fb9f2c7db7cf3747da2314c2f9586 (patch)
tree7a00e05e90a8ada96eaba94aaa655e7391e90fe9 /libs/ardour/midi_clock_slave.cc
parenta5a3f713d596fd3d0157017263d6207b5427d133 (diff)
fixes to get MTC (and probably MIDI clock) slaving working again
incoming MIDI data has to be parsed EVERY process cycle, not just when Slave::speed_and_position() is called. The private MIDI::Parser owned by the MTC and MClck slaves was irrelevant, since the port has its own. See comments in midi_port.h on the strangled inheritance heirarchy.
Diffstat (limited to 'libs/ardour/midi_clock_slave.cc')
-rw-r--r--libs/ardour/midi_clock_slave.cc39
1 files changed, 9 insertions, 30 deletions
diff --git a/libs/ardour/midi_clock_slave.cc b/libs/ardour/midi_clock_slave.cc
index 752644e9f4..7eaeeb9e07 100644
--- a/libs/ardour/midi_clock_slave.cc
+++ b/libs/ardour/midi_clock_slave.cc
@@ -50,13 +50,6 @@ MIDIClock_Slave::MIDIClock_Slave (Session& s, MidiPort& p, int ppqn)
session = (ISlaveSessionProxy *) new SlaveSessionProxy(s);
rebind (p);
reset ();
-
- parser.timing.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2));
- parser.start.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::start, this, _1, _2));
- parser.contineu.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::contineu, this, _1, _2));
- parser.stop.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::stop, this, _1, _2));
- parser.position.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3));
-
}
MIDIClock_Slave::MIDIClock_Slave (ISlaveSessionProxy* session_proxy, int ppqn)
@@ -72,33 +65,19 @@ MIDIClock_Slave::~MIDIClock_Slave()
delete session;
}
-int
-MIDIClock_Slave::process (pframes_t nframes)
+void
+MIDIClock_Slave::rebind (MidiPort& port)
{
- MidiBuffer& mb (port->get_midi_buffer (nframes));
+ DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MIDIClock_Slave: connecting to port %1\n", port.name()));
- /* dump incoming MIDI to parser */
+ port_connections.drop_connections ();
- for (MidiBuffer::iterator b = mb.begin(); b != mb.end(); ++b) {
- uint8_t* buf = (*b).buffer();
+ port.self_parser().timing.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::update_midi_clock, this, _1, _2));
+ port.self_parser().start.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::start, this, _1, _2));
+ port.self_parser().contineu.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::contineu, this, _1, _2));
+ port.self_parser().stop.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::stop, this, _1, _2));
+ port.self_parser().position.connect_same_thread (port_connections, boost::bind (&MIDIClock_Slave::position, this, _1, _2, 3));
- parser.set_timestamp ((*b).time());
-
- uint32_t limit = (*b).size();
-
- for (size_t n = 0; n < limit; ++n) {
- parser.scanner (buf[n]);
- }
- }
-
- return 0;
-}
-
-void
-MIDIClock_Slave::rebind (MidiPort& p)
-{
- port = &p;
- DEBUG_TRACE (DEBUG::MidiClock, string_compose ("MIDIClock_Slave: connecting to port %1\n", port->name()));
}
void