If you switch the “key Input” in Pro Tools, it is possible that an incorrect block size is reported to the AudioProcessor. In the worst case, this can lead to crashes.
I guess that in the juce_AAX_Wrapper method JuceAAX_Processor::updateSidechainState() the line
audioProcessor.prepareToPlay (audioProcessor.getSampleRate(), audioProcessor.getBlockSize());
should be replaced by
audioProcessor.prepareToPlay (audioProcessor.getSampleRate(), maxBufferSize);
To verify I did the following modifications to the NoiseGatePluginDemo.h from the JUCE examples:
- Add private member
mMaximumSamplesPerBlock:
...
private:
//==============================================================================
AudioParameterFloat* threshold;
AudioParameterFloat* alpha;
int sampleCountDown;
int mMaximumSamplesPerBlock { 0 };
float lowPassCoeff;
...
- Set
mMaximumSamplesPerBlockinprepareToPlay():
void prepareToPlay (double, int maximumSamplesPerBlock) override
{
lowPassCoeff = 0.0f;
sampleCountDown = 0;
mMaximumSamplesPerBlock = maximumSamplesPerBlock;
}
- Compare number of samples of the current buffer with
mMaximumSamplesPerBlockinprocessBlock():
void processBlock (AudioBuffer<float>& buffer, MidiBuffer&) override
{
const auto numSamples = buffer.getNumSamples();
if (numSamples > mMaximumSamplesPerBlock)
{
jassertfalse;
}
...
Now you can reproduce the problem with the steps below:
-
Set a breakpoint in
prepareToPlay(). -
Open Pro Tools and set the “H/W Buffer Size” to 256 samples via Menu → Settings → Playback Engine → H/W Buffer Size.

-
Debug via “attach to process”.
-
Pro Tools: Load the NoiseGatePlugin to a track.
Explanation:- As expected
JuceAAX_Processor::preparePlugin()callsprepareToPlay()with the defaultlastBufferSizeof 1024 samples.
- As expected
-
Pro Tools: Set “key input” to “interface → … 1 (Mono)”

Explanation:
-
JuceAAX_Processor::updateSidechainState()callsprepareToPlay()withbufferSizeof 1024 samples - J
uceAAX_Processor::process()callssetRateAndBufferSizeDetails()with newbufferSizeof 256 samples.
-
-
Pro Tools: Set “key input” back to “no key input”.

Explanation:
-
JuceAAX_Processor::updateSidechainState()callsprepareToPlay()withbufferSizeof 256 samples. -
JuceAAX_Processor::process()callssetRateAndBufferSizeDetails()with newbufferSizeof 1024 samples. - You end up in the assertion in
processBlock(), because the number of samples of the delivered buffer is greater (1024) than the reported maximum number of samples (256). This can cause trouble if you use internal buffers and set their size inprepareToPlay().
-
I checked this with both JUCE 7.0.2 and the current develop branch (commit 128e980be4e7d499ba26e823ed20c02803bd0799) on Windows 10 with “ASIO4All v2” as playback engine. But you can use an audio interface of your choise.
With the line I listed at the beginning, the problem seems to be fixed and you don’t end up in the assertion.
Can you confirm the problem and the fix?
