This is probably a noob question. I’ve been using JUCE for a little while and made a few small plugins. I’ve done the Sine Wave Synth and MIDI Synth tutorials - What I really am trying to build is a plugin synth (not an App, no keyboard).
Most of the classes are the same. The sticky bit is in processBlock where the MIDI input needs to get to the AudioSource (actually the Synthesiser inside it), then the audio comes back.
I did a crude hack which seems to work, but there is probably a better way.
I added a method to [My]AudioSource which temporarily saves a pointer to a MidiBuffer. So,
- processBlock creates AudioSourceChannelInfo from its parameters
- processBlock calls the [My]AudioSource save method with MidiBuffer
- processBlock calls [My]AudioSource.getNextAudioBlock(), which uses its saved MidiBuffer and updates the AudioSourceChannelInfo.
Any thoughts welcome.