Normalize notes on all channels.
authorDavid Robillard <d@drobilla.net>
Fri, 20 Feb 2015 01:23:11 +0000 (20:23 -0500)
committerDavid Robillard <d@drobilla.net>
Fri, 20 Feb 2015 01:23:11 +0000 (20:23 -0500)
Probably.

libs/ardour/midi_port.cc
libs/evoral/src/SMF.cpp

index ccd6e9848b6b7edb88e9f3d4b64d84acff6d8cc2..615abede1c58e904bb2de4b991de779c4ba8191d 100644 (file)
@@ -117,9 +117,9 @@ MidiPort::get_midi_buffer (pframes_t nframes)
                                if (buf[0] == 0xfe) {
                                        /* throw away active sensing */
                                        continue;
-                               } if (buf[0] == 0x90 && buf[2] == 0) {
+                               } else if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) {
                                        /* normalize note on with velocity 0 to proper note off */
-                                       buf[0] = 0x80;  /* note off */
+                                       buf[0] = 0x80 | (buf[0] & 0x0F);  /* note off */
                                        buf[2] = 0x40;  /* default velocity */
                                }
                                
index edf33c23f20bce3a598fd63b31ec602a34065417..0a5bf589f500811eab279081a274794fc9c6f255 100644 (file)
@@ -287,9 +287,9 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf, event_id_t* no
                }
                memcpy(*buf, event->midi_buffer, size_t(event_size));
                *size = event_size;
-               if ((*buf)[0] == 0x90 && (*buf)[2] == 0) {
+               if (((*buf)[0] & 0xF0) == 0x90 && (*buf)[2] == 0) {
                        /* normalize note on with velocity 0 to proper note off */
-                       (*buf)[0] = 0x80;  /* note off */
+                       (*buf)[0] = 0x80 | ((*buf)[0] & 0x0F);  /* note off */
                        (*buf)[2] = 0x40;  /* default velocity */
                }