SynthLab SDK
|
Your plugin framework will deliver a set of MIDI events with each incoming audio buffer during its audio buffer processing cycle. Typically these events are timestamped (from the host) with a buffer sample time value that aligns the MIDI events with samples in the audio buffer. Regardless of coding, your plugin framework will need to enqueue the MIDI messages for a particular block of audio data into the SynthProcessInfo struct prior to calling the SynthEngine's render() function.
The SynthProcessInfo struct stores a vector of midiEvents. This is one of two MIDI event structures, and is more generalized and more closely corresponds to raw MIDI data. The other MIDI Note Events structure is only for note-on and note-off messages and is used inside of the SynthEngine and SynthVoice objects. The code for this structure is below.
Things to note:
For each MIDI message your framework delivers during a particular audio block, you enqueue the MIDI data with a helper function. So, your framework code will need to have a loop that pushes these events into the queue. In this example, the MIDI data is hardcoded, but it would normally come from your plugin framework's received MIDI messages.
When the SynthEngine's render function returns, these MIDI events will still be intact, and unaltered. You may need to use them for some other MIDI processing so they are avaiable. Be sure to clear them out before enqueueing the next batch for the next audio block.