Very new to juce so bare with me. I may be approaching this the totally wrong way. I have gotten a simple synth voice working with an AudioProcessorGraph (the graph currently just contains a sine wave oscillator between the input and output nodes). The voice itself owns its own graph.
However I cannot for the life of me figure out how to get polyphony working. I was basically following the intro to DSP tutorial that uses a processor chain, and in that case they are able to process a tempoary block in the processor chain and then add that processed block to the buffer:
void SineWaveVoice::renderNextBlock(AudioBuffer< float > &outputBuffer, int startSample, int numSamples) {
// ...
auto block = tempBlock.getSubBlock (0, (size_t) numSamples);
block.clear();
juce::dsp::ProcessContextReplacing<float> context (block);
processorChain.process (context);
juce::dsp::AudioBlock<float> (outputBuffer)
.getSubBlock ((size_t) startSample, (size_t) numSamples)
.add (tempBlock);
}
But with the processorGraph, it accepts a buffer, not a context block like the processor chain did. How can I add my processed data to the buffer with multiple synth voices?
currently I clear the buffer then call mainProcessor->processBlock(outputBuffer, incomingMidi), but I am only getting a single note despite having multiple voices added to my synth, because I dont know how to add to the output buffer like was done in the DSP tutorial