mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +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,9 +120,14 @@ midi_event_is_valid(const uint8_t* buffer, size_t len)
|
|||
if (size < 0 || (size_t)size != len) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 1; i < len; ++i) {
|
||||
if ((buffer[i] & 0x80) != 0) {
|
||||
return false; // Non-status byte has MSb set
|
||||
if (status < 0xf0) {
|
||||
/* Channel messages: all start with status byte followed by
|
||||
* non status bytes.
|
||||
*/
|
||||
for (size_t i = 1; i < len; ++i) {
|
||||
if ((buffer[i] & 0x80) != 0) {
|
||||
return false; // Non-status byte has MSb set
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue