Multichannel default parameters


We are creating a plugin that will have different parameter defaults depending on the bus type that our plugin is inserted on. For example, if it is inserted on a stereo bus the parameters will have different default values than when the plugin is inserted on a 5.1 bus.

Through investigation we have seen that the number of channels on a given bus is not correctly reported by the host until after the parameters are declared. (Using the JUCE demo plugin the parameters are added during construction of the audio processor). The channel count is reported correctly when there is a callback to processorLayoutsChanged()

I have noticed that it is possible to ‘get’ the parameter default, but it is not possible to ‘set’ it with native JUCE code.
I propose that adding a function to set the default values for parameters, and then calling that function in processorLayoutsChanged() based on the number of channels may provide a solution. Another option might be to move the parameter registration to the processorLayoutsChanged() function, but we have noticed that some DAWs call this multiple times during initialisation. Can you think of any issues with this, or do you have a better approach?

Any thoughts are welcome