Quick AudioProcessorGraph::prepareToPlay() question

Should AudioProcessorGraph::prepareToPlay() check if either of the parameters have changed before rebuilding the graph?

void AudioProcessorGraph::prepareToPlay (double sampleRate, int estimatedSamplesPerBlock)
{
    // Should it have this check?

    if (sampleRate == getSampleRate() && estimatedSamplesPerBlock == getBlockSize())
        return;

    audioBuffers->prepareInOutBuffers (jmax (1, getNumOutputChannels()), estimatedSamplesPerBlock);

    currentMidiInputBuffer = nullptr;
    currentMidiOutputBuffer.clear();

    clearRenderingSequence();
    buildRenderingSequence();
}

Cheers,

Rail

Hmmm not sure. I can imagine a lot of people relying on their custom AudioProcessor’s prepareToPlay method being called when calling prepareToPlay on the graph.

My thought was that they were initialized with the correct sample rate and block size when added to the graph… so they should be in synch… but perhaps I’m wrong?

No worries… It was just a thought…

EDIT: Yup, in buildRenderingSequence() each processor is prepared with the graph’s sample rate and buffer size… so they should all be in synch when a prepareToPlay() comes along.

Cheers,

Rail