From 37c97d09e6c7f326ed0adc6df903d2aca92fbf41 Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Mon, 18 Mar 2019 15:53:35 -0300 Subject: [PATCH] Fix MIDI Note Off missing on some devices (cherry picked from commit ea0c398a196358a34e40dc7b93426913f11c160a) --- core/os/midi_driver.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/os/midi_driver.cpp b/core/os/midi_driver.cpp index 0d7ad23d687..7cb7ae130f0 100644 --- a/core/os/midi_driver.cpp +++ b/core/os/midi_driver.cpp @@ -75,6 +75,11 @@ void MIDIDriver::receive_input_packet(uint64_t timestamp, uint8_t *data, uint32_ if (length >= 3) { event->set_pitch(data[1]); event->set_velocity(data[2]); + + if (event->get_message() == MIDI_MESSAGE_NOTE_ON && event->get_velocity() == 0) { + // https://www.midi.org/forum/228-writing-midi-software-send-note-off,-or-zero-velocity-note-on + event->set_message(MIDI_MESSAGE_NOTE_OFF); + } } break;