I also posted on KVR DSP but figured this is probably a better place to ask:
I'm looking into writing a JUCE based midi sequencer that will run as a VST or audio unit and be controlled by a Push controller.
My question is what is the usual approach to handle the midi input and output data from the controller.
It seems to me that the most straightforward approach is to have a MidiMessageCollector collect realtime message into a queue which is then read by a function call in the audio processing callback of the plugin, which writes back some timestamped messages for the controller into an output buffer which is then sent to the controller using sendBlockOfMessages.
I'm slightly concerned about the latency however, for instance if the user is turning a knob on the controller and we're sending back some stuff to print on the screen via sysex, it could be quite laggy unless the audio buffer size is small ?
Is there a better way to do this ? The only alternative I can see would be to have a real time thread for handling the controller updates that needs to be synchronized with the plugin callback thread, but that could easily get quite nasty.