Normalize notes on all channels.
[ardour.git] / libs / ardour / midi_port.cc
index b12999cc9f090305811e4655170b98c192c9ef4d..615abede1c58e904bb2de4b991de779c4ba8191d 100644 (file)
@@ -117,6 +117,10 @@ MidiPort::get_midi_buffer (pframes_t nframes)
                                if (buf[0] == 0xfe) {
                                        /* throw away active sensing */
                                        continue;
+                               } else if ((buf[0] & 0xF0) == 0x90 && buf[2] == 0) {
+                                       /* normalize note on with velocity 0 to proper note off */
+                                       buf[0] = 0x80 | (buf[0] & 0x0F);  /* note off */
+                                       buf[2] = 0x40;  /* default velocity */
                                }
                                
                                /* check that the event is in the acceptable time range */