I have implemented a metronome using a Synthesizer. During getNextAudioBlock() I stuff a MidiMessage with noteOn at appropriate locations and then call Synthesizer::renderNextBlock().
It seems that MidiBuffer allocates memory, which takes a critical section during the audio i/o callback. Is there some what we can improve MidiMessage so it can have a pre-allocated storage or something? Or allow construction of a MidiBuffer from an existing piece of memory (similar to how AudioSampleBuffer works)? This way one can pre-allocate a sufficiently large buffer and then just keep using it.