System-exclusive messages carry manufacturer data of any length, framed in a file with a variable-length byte count. Today you read that frame and step over the payload, so a SysEx never derails the event loop.
Parse a system-exclusive event, reading its variable-length payload.
A system-exclusive (SysEx) message is a manufacturer’s private data - a synth
patch, a device query - and it can be any length. Inside a Standard MIDI File it is
framed like a meta event: the byte 0xF0, a variable-length byte count, then
that many payload bytes (the payload normally ends in the terminator 0xF7). Read
the VLQ length and step the reader exactly past the payload.
You do not need to interpret the bytes to handle them correctly - the length tells you precisely how far to jump, so an unknown SysEx never confuses the event loop. This is the last event kind. With channel messages, meta events, and SysEx all readable, the event loop can now walk any real track from its first delta-time to its end-of-track, which is exactly what the next chapter builds on.
// 0xF0 begins SysEx; a VLQ length follows, then that many payload bytesr.NextByte() // consume 0xF0n := r.ReadVLQ() // payload length (3)data := r.buf[r.pos : r.pos+int(n)]r.pos += int(n) // the payload usually ends in 0xF7