Play a Midi file? MidiMessageSequence -> MidiBuffer

I see MidiFile allows access to MidiMessageSequence, however to play midi it appears that a MidiBuffer is needed instead. I don't see a conversion from one to the other.

After that it appears I get the the default midi output from the AudioDeviceManager, and send it the midi buffer, but that part is particularly clear either. It seems like I would have found an example, but did not.

The two classes have different purposes - MidiMessageSequence is a higher-level object, which knows about matching note on/off pairs and lets you edit the sequence. MidiBuffer is a low-level packed array, which can be iterated but not really modified.

MidFile loads MidiMessageSequence, I presume there is a convenience method to convert to MidiBuffer so it can be played?

You'd rarely ever need to convert a whole MidiMessageSequence into a single MidiBuffer, because you'd never want to play the entire file as one block. Generally you'll be given a MidiBuffer to fill by something like AudioProcessor::processBlock, and you'd only want to fill it with whatever small section of the MidiMessageSequence is being played. I don't have any helper methods to do that, I'm afraid, but it's easy enough to iterate it and add the messages.

I assumed if I call this...


It would play the song, and prior to that an AudioProcessor could be registered to display the notes being played... 

If I'm filling the processBlock(midibuffer), then I'm lost on how I would fill it with appropriate notes. Example anywhere?