diff --git a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp index 5140cf4123..55edb2d08d 100644 --- a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp @@ -429,7 +429,7 @@ struct AAXClasses public AudioProcessorListener { public: - JuceAAX_Processor() : sampleRate (0), lastBufferSize (1024) + JuceAAX_Processor() : sampleRate (0), lastBufferSize (1024), maxBufferSize (1024) { pluginInstance = createPluginFilterOfType (AudioProcessor::wrapperType_AAX); pluginInstance->setPlayHead (this); @@ -858,7 +858,17 @@ struct AAXClasses pluginInstance->setPlayConfigDetails (pluginInstance->getNumInputChannels(), pluginInstance->getNumOutputChannels(), sampleRate, bufferSize); - pluginInstance->prepareToPlay (sampleRate, bufferSize); + + if (bufferSize > maxBufferSize) + { + // we only call prepareToPlay here if the new buffer size is larger than + // the one used last time prepareToPlay was called. + // currently, this should never actually happen, because as of Pro Tools 12, + // the maximum possible value is 1024, and we call prepareToPlay with that + // value during initialisation. + pluginInstance->prepareToPlay (sampleRate, bufferSize); + maxBufferSize = bufferSize; + } } const ScopedLock sl (pluginInstance->getCallbackLock()); @@ -962,6 +972,7 @@ struct AAXClasses audioProcessor.setPlayConfigDetails (numberOfInputChannels, numberOfOutputChannels, sampleRate, lastBufferSize); audioProcessor.prepareToPlay (sampleRate, lastBufferSize); + maxBufferSize = lastBufferSize; check (Controller()->SetSignalLatency (audioProcessor.getLatencySamples())); } @@ -973,7 +984,7 @@ struct AAXClasses Array channelList; int32_t juceChunkIndex; AAX_CSampleRate sampleRate; - int lastBufferSize; + int lastBufferSize, maxBufferSize; struct ChunkMemoryBlock : public ReferenceCountedObject {