mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
fix incorrect test for valid MIDI events.
Only channel messages have the form <statusbyte>{<nonstatusbyte>..}
This commit is contained in:
parent
03833e4376
commit
07c08e4673
1 changed files with 8 additions and 3 deletions
|
|
@ -120,11 +120,16 @@ midi_event_is_valid(const uint8_t* buffer, size_t len)
|
||||||
if (size < 0 || (size_t)size != len) {
|
if (size < 0 || (size_t)size != len) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (status < 0xf0) {
|
||||||
|
/* Channel messages: all start with status byte followed by
|
||||||
|
* non status bytes.
|
||||||
|
*/
|
||||||
for (size_t i = 1; i < len; ++i) {
|
for (size_t i = 1; i < len; ++i) {
|
||||||
if ((buffer[i] & 0x80) != 0) {
|
if ((buffer[i] & 0x80) != 0) {
|
||||||
return false; // Non-status byte has MSb set
|
return false; // Non-status byte has MSb set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue