i always avoided making big sidechain-projects until now because there is a strange issue there that i hope to be able to describe in this post. i hope someone can help me figuring this out.
my ultimate goal is to have a programming environment in which i can debug a sidechainable plugin in standalone, because when debugging a plugin you don’t always care about wether or not it makes sense that there is no 2nd input right now.
ok so let’s say you have some processor base class with a constructor that says “hey, there can be sidechain”:
ProcessorBackEnd::ProcessorBackEnd() :
juce::AudioProcessor(BusesProperties()
.withInput("Input", ChannelSet::stereo(), true)
.withOutput("Output", ChannelSet::stereo(), true)
#if PPDHasSidechain
.withInput("Sidechain", ChannelSet::stereo(), false)
#endif
) ...
when building it as a VST3 the DAW correctly shows you have a sidechain bus:
when building standalone however you get this:
I assume this is not a bug, but just JUCE telling you like “hey, standalone apps can’t have sidechain” which kinda makes sense ofc, but it’s annoying for debugging. so I was told to try this:
- get rid of the sidechain input in the constructor of the processor.
- instead implement the canAddBus method of audioProcessor to return isInput so show the DAW that it can dynamically add a bus if it wants to.
- implement the isBusesLayoutSupported() method in a way that checks if the sc bus exists.
I did that:
ProcessorBackEnd::ProcessorBackEnd() :
juce::AudioProcessor(BusesProperties()
.withInput("Input", ChannelSet::stereo(), true)
.withOutput("Output", ChannelSet::stereo(), true)
//#if PPDHasSidechain
// .withInput("Sidechain", ChannelSet::stereo(), false)
//#endif
)
and
bool ProcessorBackEnd::isBusesLayoutSupported(const BusesLayout& layouts) const
{
const auto mono = ChannelSet::mono();
const auto stereo = ChannelSet::stereo();
const auto mainSetIn = layouts.getMainInputChannelSet();
const auto mainSetOut = layouts.getMainOutputChannelSet();
#if PPDHasSidechain
const auto scSetIn = layouts.getChannelSet(true, 1);
if(!scSetIn.isDisabled())
if (scSetIn != mono && scSetIn != stereo)
return false;
#endif
if (mainSetOut != mono && mainSetOut != stereo)
return false;
return mainSetIn == mainSetOut;
}
and
bool ProcessorBackEnd::canAddBus(bool isInput) const
{
return PPDHasSidechain ? isInput : false;
}
so with these changes I can run the plugin in standalone successfully and even as a plugin, no problems, except that…
now the plugin has no sidechain input anymore according to the DAW.
now i tried these changes to the constructor:
#if PPDHasSidechain && !JucePlugin_Build_Standalone
.withInput("Sidechain", ChannelSet::stereo(), true)
#endif
but JucePlugin_Build_Standalone is also true if you select the VST3 build. would be cool if juce had a preprocessordefine for the fact wether or not i’m actually building a vst3 file and not wether or not standalone builds might exist at all. is that a thing? it would not be the best solution ever because it would mean i have to work with that PPD all the way through my whole codebase and I already have lots of them, but it would be a possible solution at all.
I was told to check the state of the arguments of that jassert, when trying to set the sidechain input in the constructor. 0 inputs, 2 outputs. So I added this to the busesLayout verification code:
if (mainSetIn.isDisabled())
return true;
which actually made it work in standalone and in the DAW, but now when I add a sidechain input I get an assert in the JUCE VST3 Wrapper:
I find it rather unlikely to believe that bitwig doesn’t know how to set sidechain inputs correctly, so there needs to be another reason for this to appear.
(I was just told I should make a custom standalone wrapper for this. I have not had the time to try that yet and it also seems a little overkill for a solution to a problem that should be simple, but if I get to do that I’ll update this post accordingly. Until then maybe some alternative ideas would be nice.)
so this is the current state of things. I’d be happy if someone could just tell me what exactly I’m missing here to make this work. I tried this multiple times through-out the last year and always gave up at some point because i ran out of ideas and stuff. this really shouldn’t be so complicated. but considering it apparently is still complicated i’d like to know what i have to do here or what i could try to do.