summaryrefslogtreecommitdiff
path: root/libs/evoral/evoral
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-12-31 10:32:50 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-12-31 10:32:50 -0500
commit07c08e46735a50476fc1a25698caae84f99078d4 (patch)
tree5c8c5b9554fa0bd17f92e7bf2d58fadc16a76c72 /libs/evoral/evoral
parent03833e4376a763b0055e80fa75b680547dedb966 (diff)
fix incorrect test for valid MIDI events.
Only channel messages have the form <statusbyte>{<nonstatusbyte>..}
Diffstat (limited to 'libs/evoral/evoral')
-rw-r--r--libs/evoral/evoral/midi_util.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/evoral/evoral/midi_util.h b/libs/evoral/evoral/midi_util.h
index f32e816321..9341e1afb2 100644
--- a/libs/evoral/evoral/midi_util.h
+++ b/libs/evoral/evoral/midi_util.h
@@ -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;