JUCE 7 getTotalNumOutputChannels() returns 0

Hi! After updating to JUCE 7 from JUCE 6.0.9, I get an assertion failure in StateVariableTPTFilter::prepare, because the numChannels variable shows 0 for some reason. The plugin was working fine before updating the JUCE version and the number of output channels should be 2, but getTotalNumOutputChannels() returns 0:

.withInput("Input", AudioChannelSet::stereo(), true)
.withOutput("Output", AudioChannelSet::stereo(), true))

Does anyone have any idea what could be the problem? Thank you!

Can you also show the isBususLayoutSupported() method?
Also is the PreferredChannelLayout Macro in projucer empty? (recommended)

And is this in a certain host or the standalone build? (Nvm, I just see it’s reaper)
Have you tested in a different host?

I used CMake and did not mentioned the PreferredChannelLayout Macro.
I just opened it in Ableton Live and there it works and getTotalNumOutputChannels() returns the correct value, 2.

And what wrapperType are you using?

You could explicitly return false for in == 0 or out == 0, see if that helps.
But I have no idea why reaper would choose to fall to zero channels.

I am using VST3 which is not mentioned in isBusesLayoutSupported(). If I return false for in==0 or out == 0, the plugin crashes with uncaught exception.
I have also tested with the latest version of Reaper.

Fixed by forcing the in&out to be maximum 2.

if (wrapperType == wrapperType_VST3) {

auto in = layouts.getMainInputChannels();

auto out = layouts.getMainOutputChannels();

return in == out && in <= 2;