Sending MIDI Messages with Stream Buffers

When your application works with stream buffers, it uses the midiStreamOut function to send all (short and long) MIDI messages to the device. To specify stream data blocks, use the MIDIHDR and MIDIEVENT structures. The MIDIHDR structure contains an address of a locked data block, the data-block length, and some assorted flags. The data is stored in the form of MIDIEVENT structures. The system imposes a size limit of 64K on stream buffers.

After you use midiStreamOut to send a stream buffer of data, you must wait until the device driver is finished with the data block before freeing it. If you are sending multiple data blocks, you must monitor the completion of each data block so you know when to send additional blocks. For information about different techniques for monitoring data-block completion, see Managing MIDI Data Blocks.