Work around problems with some JACK<->ALSA midi bridges which don't

transfer multiple MIDI messages when they are written in one
jack_midi_event_write.  Support pitch bend messages in the
generic midi control surface code.


git-svn-id: svn://localhost/ardour2/branches/3.0@11601 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2012-03-06 15:08:17 +00:00
parent c6396ca7ce
commit fe86f97563
3 changed files with 64 additions and 68 deletions

View file

@ -259,17 +259,18 @@ GenericMidiControlProtocol::_send_feedback ()
const int32_t bufsize = 16 * 1024; /* XXX too big */
MIDI::byte buf[bufsize];
int32_t bsize = bufsize;
MIDI::byte* end = buf;
for (MIDIControllables::iterator r = controllables.begin(); r != controllables.end(); ++r) {
end = (*r)->write_feedback (end, bsize);
}
if (end == buf) {
return;
}
_output_port->write (buf, (int32_t) (end - buf), 0);
/* XXX: due to bugs in some ALSA / JACK MIDI bridges, we have to do separate
writes for each controllable here; if we send more than one MIDI message
in a single jack_midi_event_write then some bridges will only pass the
first on to ALSA.
*/
for (MIDIControllables::iterator r = controllables.begin(); r != controllables.end(); ++r) {
MIDI::byte* end = (*r)->write_feedback (buf, bsize);
if (end != buf) {
_output_port->write (buf, (int32_t) (end - buf), 0);
}
}
}
bool
@ -574,9 +575,6 @@ GenericMidiControlProtocol::get_feedback () const
return do_feedback;
}
int
GenericMidiControlProtocol::load_bindings (const string& xmlpath)
{
@ -682,6 +680,8 @@ GenericMidiControlProtocol::create_binding (const XMLNode& node)
ev = MIDI::on;
} else if ((prop = node.property (X_("pgm"))) != 0) {
ev = MIDI::program;
} else if ((prop = node.property (X_("pb"))) != 0) {
ev = MIDI::pitchbend;
} else {
return 0;
}