Sidechain in AudioSuite

We have a plugin that requires a sidechain input. We support both mono and stereo versions (and mono-to-stereo). We are having problems getting the sidechain to work when in AudioSuite. (We are using JUCE 5.3.2, by the way.)

When using a mono track, if we select mono mode and select a sidechain input, then when the user hits Preview, initially we get that extra sidechain channel, and everything looks fine. But an instant later, some kind of asynchronous message is sent/received in the JUCE code for the processor that causes the function updateSidechainState() to be called, which then checks the value of sidechainDesired.get(), which returns 0, which then disables the sidechain, causing our software to not work.

Since the message is asynchronous, I don’t know from where it originates (you can’t see it in the call stack because it is asynchronous). So I don’t know who is causing sidechainDesired to get the value 0.

(The stereo version has a similar issue, initially, but it can be fixed by toggling between mono mode and multi-input mode. A clumsy workaround, but it’s something, at least.)

How can I prevent the sidechain from becoming disabled like this? What could be telling it to turn off after Preview starts?

Looks like this code triggers it:

        static void algorithmCallback (JUCEAlgorithmContext* const instancesBegin[], const void* const instancesEnd)
        for (auto iter = instancesBegin; iter < instancesEnd; ++iter)
            auto& i = **iter;

            int sideChainBufferIdx = i.pluginInstance->parameters.hasSidechain && i.sideChainBuffers != nullptr
                                         ? static_cast<int> (*i.sideChainBuffers) : -1;

            // sidechain index of zero is an invalid index
            if (sideChainBufferIdx <= 0)
                sideChainBufferIdx = -1;

            auto numMeters = i.pluginInstance->parameters.aaxMeters.size();
            float* const meterTapBuffers = (i.meterTapBuffers != nullptr && numMeters > 0 ? *i.meterTapBuffers : nullptr);

            i.pluginInstance->parameters.process (i.inputChannels, i.outputChannels, sideChainBufferIdx,
                                                  *(i.bufferSize), *(i.bypass) != 0,
                                                  getMidiNodeIn(i), getMidiNodeOut(i),

In that code, *i.sidechainBuffers == 0, which leads to sideChainBufferIdx to be set to -1. That leads to processWantsSideChain to be false, and this code then makes that asynchronous update that disables the sidechain:

                if (hasSidechain && canDisableSidechain && (sidechainDesired.get() != 0) != processWantsSidechain)
                isSuspended = true;
                sidechainDesired.set (processWantsSidechain ? 1 : 0);
                processingSidechainChange.set (1);

So now I know where that message comes from, but why does *i.sidechainBuffers==0? How can I fix that?

Since you’re on 5.3.2 that’s your aax wrapper state:

And here is master’s state:

There are many bugfixes:

And I think your issues is not only in audiosuite.

So, is this fixed in the newer versions, then? (If so, it’s ammunition to update sooner than later.)

I’m pretty sure it is as it sounds like an issue we had. But best would be to try it yourself.