Why is the default constructor of AudioProcessor using a BusesProperties object with isActivatedByDefault=false?


#1

@fabian: Why is the default constructor of AudioProcessor using a BusesProperties object with isActivatedByDefault=false?

I tried to get the standalone plugin working, but the processBlock was not called. It looked like the plugin reported a channel count of zero for input and output. Even though JucePlugin_PreferredChannelConfigurations is {1, 1}, {2, 2}.

Changing the constructor call to:
    :AudioProcessor(
        BusesProperties()
            .withInput ("Input" , AudioChannelSet::stereo(), true)
            .withOutput("Output", AudioChannelSet::stereo(), true)
    )

it’s working. You’re also using “true” in JuceDemoPluginAudioProcessor::getBusesProperties().
It looks to me, like this member is only used to pass it to audioIOChanged as the channelNumChanged argument.

This one bit me before, so I thought I write it down.

Best,
Ben


#2

This is needed to be backward compatible with older versions of JUCE (JUCE 3 & 4). In old JUCE versions the default constructor always creates an AudioProcessor with zero in and zero out channels. By disabling the bus by default this behaviour is emulated.

It’s important that we don’t break this behaviour as there are a lot of hosts - both inside JUCE (AudioProcessorGraph for example) and created by JUCE developers - which rely on the numbers of channels being zero when an AudioProcessor is created.

The code which hosts the AudioProcessor can then set the channel to something else - for example the default layout.


#3

Thanks for the explaination.