[SOLVED] AAX sidechain doesn't work!

Hi everyone,

I’m working on a plugin with a side chain. It works fine in the AU or VST3 version, but when I compile the aax version, it makes Pro Tools crash. I noticed that aax works fine when sidechain in Pro Tools is activated, but when the plugin is on “no key input” it crashes.
I also noticed that the issue comes when I try to make any access to the sidechain buffer…

Any tip to solve this problem?

Have you tried debugging? If you attach to Pro Tools after loading your session, but before loading the plugin, you should be able to see where it crashes. Offhand, sounds like your code is assuming some pointer is valid when in fact it is not.

Thank you for the reply!
Yes, I debugged it. I also created a new project from scratch to isolate the problem.
Here the code of PluginProcessor.cpp, where is the issues:

NewProjectAudioProcessor::NewProjectAudioProcessor()

 : AudioProcessor (BusesProperties()
                 
                 
                   .withInput  ("Input",  juce::AudioChannelSet::stereo(), true)
                   .withInput  ("SideC",  juce::AudioChannelSet::mono(), true)
                   .withOutput ("Output", juce::AudioChannelSet::stereo(), true)
                 
                   )

void NewProjectAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages)
{

juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels  = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
auto numSamples = buffer.getNumSamples();


for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
    buffer.clear (i, 0, buffer.getNumSamples());

for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
    for (int sample = 0; sample < numSamples; ++sample)
    {
    
  // HERE PRO TOOLS CRASHES IF SIDECHAIN IS NOT ACTIVE; WORKS WELL IF ACTIVE!!     

  auto sc = buffer.getSample(2, sample);

    buffer.setSample(channel, sample, (buffer.getSample(channel, sample)+sc));
        }
 
}

}

What’s wrong?

Looks like an out of bounds access to me:

you’re reading from channel of index 2, which happens to be your sidechain channel when it is connected, but it may not even be there if sidechain bus is disabled… when you get the crash, what is the value of totalNumInputChannels? If it is 2, only channels with indices 0 and 1 (the two stereo channels of the main input bus) are present in your buffer

Hey yfede,

You’re totally right!

Pro Tools unlike Cubase or Audio Plugin Host, changes the number of input channel on the basis of the activation of the sidechain button on the DAW track!
So checking the number of total channel I could set the behavior of the plugin …

Thank you so much! :slight_smile:

1 Like

Cubase does that too, and VST3 in general. If the sidechain is disabled in the DAW, getChannelCountOfBus(true, 1) == 0.

1 Like

Where is the sidechain button in Pro Tools? Could someone please post a screenshot… :slight_smile:

I have inserted my aax plugin on an instrument track but I can’t figure out where the sidechain button is.