JUCE 4.3 numChannelsChanged() not called anymore


As the Title says after updating to JUCE 4.3 numChannelsChanged() is not called anymore (seen in macOS Cubase/Wavelab/Logic/Reaper and then I got bored.)



Would it be possible to clarify on this issue, please!


Not sure when you expect this to be called. Typically DAWs will change the format right after initialization and then never change it again.


Well, I at least I expect to be informed - when you change the behaviour. numChannelsChanged() was called between AudioProcessor construction and prepareToPlay() which seemed to be natural to me since the number of announced in and out channels changed when requested from the AudioProcessor constructor and prepareToPlay().

So which behaviour can be expected now?



Your AudioProcessor will probably be inited with the default channel count. If that changes you should receive a numChannelsChanged callback.


My audio processor gets “inited” with 0 in and out channels. (It announces {2,2},{1,2},{1,1} though. But maybe I am not sure what “initiated” means: Are you referring to construction time?

Or is there any other time the processor gets “initiated”: when i.e. sample rate, I/O size and channel configuration are known.



You report a default layout to the AudioProcessor base class. Any change to that default layout should be announced with a numChannelsChanged.


That would be nice, but no (JUCE 4.3.1: AudioProcessor initialized with default stereo in/out busses):

macOS VST3 @ Cubase 8.5 mono insert following awkward sequence is received:
prepareToPlay(double, int) with stereo/stereo
prepareToPlay(double, int) with stereo/stereo
prepareToPlay(double, int) with mono/mono

no numChannelsChanged(), no releaseResources(). If its optional to call numChannelsChanged() or releaseResources() it doesn’t make sense that those methods are there at all.

Component @ Logic Pro X mono insert:
prepareToPlay(double, int) with mono/mono

no numChannelsChanged().

macOS VST @ Cubase 8.5 mono insert following variant is demonstrated:
prepareToPlay(double, int) with stereo/stereo
prepareToPlay(double, int) with mono/mono

numChannelsChanged()? eh, nope, for what?

There are probably more illustrious variations out there, but to me it already defeats the idea of having a plugin framework: The AudioProcessor should behave equally, predictable and transparently.


Any plans on notifying the plugin about a channel configuration change?


Yes I can add it again. To be honest though, I regret that it was ever added in the first place. It shouldn’t really be necessary as the host can only change the number of channels when the plug-in is in it’s released state (i.e. after releaseResources or immediately after construction). The host will change the number of channels multiple times before it finally decides to call prepareToPlay. That’s when your plug-in should check if the number of channels has changed from the last prepareToPlay and allocate resources as necessary.


What do you regret? I don’t seem to get your point here.

JUCE arbitrary calls a sequences of prepareToPlay(), maybe with an arbitrary interlude of releaseResources() and numChannelsChanged(). If all this is optional then please remove it. If its there it should work as expected.

But there is another aspect to numChannelsChanged() and thats a graphical: A host might not start streaming at all but already display the plugin GUI. It would be good if at that time the UI can be constructed with a reasonable number of channels.


Thanks @raketa. Your use case makes sense. numChannelsChanged is now called correctly on the develop branch of JUCE.