+/** Return true iff the given buffer is a valid MIDI event.
+ * \a len must be exactly correct for the contents of \a buffer
+ */
+static inline bool
+midi_event_is_valid(const uint8_t* buffer, size_t len)
+{
+ uint8_t status = buffer[0];
+ if (status < 0x80) {
+ return false;
+ }
+ const int size = midi_event_size(buffer);
+ if (size < 0 || (size_t)size != len) {
+ return false;
+ }
+ return true;
+}
+
+std::string midi_note_name (uint8_t noteval);
+