I’m saving a step sequencer state and am using a isNoteOn call to see if my saved state event (serialized as hex data) is a noteOn event (after passing that data to MidiMessage ctor). Sometimes the sequencer has noteOn messages with velocity 0 and this code
bool MidiMessage::isNoteOn() const throw()
{
return ((data[0] & 0xf0) == 0x90)
&& (data[2] != 0);
}
tells me it’s not a noteOn message, and that’'s wrong, it is a noteOn with velocity 0 (in practice a noteOff) however a normal noteOff (0x80) can be interpreted differently then noteOn (0x90) with velocity 0. I’m basing this on my favorite midi spec: http://atom.maczo.pl/~atom/stuff/tech/midispec.htm (Note-On Note-Off). Correct me if my wrong, but i think that only the first byte and the length should be check to tell if it’s a noteOn event. I guess noteOn with velocity 0 can still trigger envelopes/LFOs and modulate parameters using the velocity value.