Handy class to help keep audio buffer in sync with incoming MIDI events. To use it, create a local variable (on the stack) and call nextEvent() until it returns false.
{
float* const outL = amsh.outputs[0];
float* const outR = amsh.outputs[1];
for (uint32_t i=0; i<amsh.midiEventCount; ++i)
{
}
renderSynth(outL, outR, amsh.frames);
}
Some important notes when using this class:
- MidiEvent::frame retains its original value, but it is useless, do not use it.
- The class variables names are be the same as the default ones in the run function. Keep that in mind and try to avoid typos. :)