Best to just do this as early as possible to avoid having to deal with this
situation all over the code.
Also fixes violation of LV2 MIDI specification, which requires no such events
are delivered to plugins.
if (buf[0] == 0xfe) {
/* throw away active sensing */
continue;
+ } if (buf[0] == 0x90 && buf[2] == 0) {
+ /* normalize note on with velocity 0 to proper note off */
+ buf[0] = 0x80; /* note off */
+ buf[2] = 0x40; /* default velocity */
}
/* check that the event is in the acceptable time range */
}
memcpy(*buf, event->midi_buffer, size_t(event_size));
*size = event_size;
+ if ((*buf)[0] == 0x90 && (*buf)[2] == 0) {
+ /* normalize note on with velocity 0 to proper note off */
+ (*buf)[0] = 0x80; /* note off */
+ (*buf)[2] = 0x40; /* default velocity */
+ }
if (!midi_event_is_valid(*buf, *size)) {
cerr << "WARNING: SMF ignoring illegal MIDI event" << endl;