In the flipEnablement method flipBit is called, which takes the current number of channels as the maxNumber (of channels) argument. If input channels were enabled, the first active input channels are getting disabled to retain the number of channels (that’s what the animation of my first post shows).
To not break any behavior of this class, I think “real adding” of channels (increasing the number of channels) should be done by something like Shift+Click (or any other modifier). So I guess the function call needs something like a bool addChannelsIfPossible flag.
Here’s my proposed approach
Whenever this flag is true, I simply would increase the maxNumber argument by 1 (or 2 if setup.useStereoPairs, respectively).
Prior to the following call I would save the current configuration as a fallback, and check if an error has occurred.
The current error handling in the JUCE code is quite low level (line 915)
If no error, everything went well, the number of channels has been increased.
If not: I simply would use the fallback-config, basically doing nothing at all. Not sure if “doing nothing” happens anyway when an error occurs.
Would this be the way to go?
Edit: I am asking as there may be a more elegant way. If not I am happy to create a pull request, once I have implemented and tested this. Or the JUCE team does it