#include <cmath>
#include <errno.h>
-#include <poll.h>
#include <sys/types.h>
#include <unistd.h>
#include "pbd/error.h"
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)
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
}
void
-MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size)
+MIDIClock_Slave::position (Parser& /*parser*/, MIDI::byte* message, size_t size)
{
// we are note supposed to get position messages while we are running
// so lets be robust and ignore those
}
assert(size == 3);
- byte lsb = message[1];
- byte msb = message[2];
+ MIDI::byte lsb = message[1];
+ MIDI::byte msb = message[2];
assert((lsb <= 0x7f) && (msb <= 0x7f));
uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb);