AudioAppComponent && AudioProcessorGraph


So I have a standalone app and my MainContentComponent is derived from AudioAppComponent.

I have an AudioProcessorGraph and it works fine… I have an audio file loaded in my SynthProcessor and a bunch of connections all working great… until I change the buffer size in the audio settings (or the sample rate… but to make things easier for this discussion let’s focus on the buffer size)… if I change the buffer size I handle the change in:


which basically has:

m_pMainGraph->setPlayConfigDetails (2, 2, sampleRate, samplesPerBlockExpected);
m_pMainGraph->prepareToPlay (sampleRate, samplesPerBlockExpected);


m_pSynthProc->setPlayConfigDetails (2, iNumChannels, sampleRate, samplesPerBlockExpected);

and the playback becomes noise.

If I rebuild the connections as well in prepareToPlay() then playback is fine… but I shouldn’t have to remove all the connections and rebuild them if the buffer size changes…

I’m guessing this has nothing to do with AudioAppComponent… but rather the AudioProcessorGraph

EDIT: BTW I did try triggering an AsyncUpdate on the graph instead of removing all the connections and rebuilding the graph… and that didn’t make a difference.




Hmmm… well the AudioGraph does keep audio buffers for it’s connections between the processors. I think they only get re-allocated when rebuilding the audio graph, right? Have you tried if only a buffer increase triggers the bug? It could be that the AudioGraph is fine if the buffer size is decreased.


Changing the buffer size either way (up or down) causes a problem… but I just noticed the cause of the problem…

void MainContentComponent::prepareToPlay (int samplesPerBlockExpected, double sampleRate)

    m_dSampleRate = sampleRate;
    m_iBufferSize = samplesPerBlockExpected;


    m_pMainGraph->setPlayConfigDetails (2, 2, m_dSampleRate, m_iBufferSize);

    m_pMainGraph->prepareToPlay (m_dSampleRate, m_iBufferSize);

    int iNumChannels = getNumChannelsForCurrentFile();

    if (iNumChannels != -1)
        m_pSynthProc->setPlayConfigDetails (2, iNumChannels, m_dSampleRate, m_iBufferSize);

m_pSynthProc has connections to the graph… so it’s prepareToPlay() is getting called via the graph’s


and then I’m setting it again with

m_pSynthProc->setPlayConfigDetails (2, iNumChannels, m_dSampleRate, m_iBufferSize);

which doesn’t call m_pSynthProc’s prepareToPlay() (it calls the base class AudioProcessor::setPlayConfigDetails()) but causes the problem.

If I simply remove my call to m_pSynthProc->setPlayConfigDetails() everything’s fine.




I ran into similar problems quite some time ago. If i remember right the solution was to call setRateAndBufferSizeDetails on the graph


It needs either:

m_pMainGraph->setPlayConfigDetails (2, 2, m_dSampleRate, m_iBufferSize);

m_pMainGraph->prepareToPlay (m_dSampleRate, m_iBufferSize);


m_pMainGraph->setRateAndBufferSizeDetails (m_dSampleRate, m_iBufferSize);

m_pMainGraph->prepareToPlay (m_dSampleRate, m_iBufferSize);




Thanks Rail!