CMake + Channel Layout List

We’ve moved to JUCE6 + CMake but we’re having a little bit of trouble with channelLayoutList for constructing our AudioProcessor.

Previously, this layout list was provided by JUCE through a #define which came from the project configuration. When moving to CMake it didn’t seem like this was an option so we hardcoded the layout into our plugin.

However, this caused an issue with VST2 since our list started with {1, 2} and that resulted in VST2 to only be able to handle mono input. In order to combat this, we re-ordered our layout list so that the largest set of channels–{16,16}–was first in the list. This fixed the VST2 problem but has introduced other issues.

Is there a canonical way to handle this?

The canonical solution would be to avoid the channel layout list entirely, and instead to override isBusesLayoutSupported.

If this isn’t an option for some reason, you can just add JucePlugin_PreferredChannelConfigurations to your target_compile_definitions call. Note that due to the {} syntax, some generators have a difficult time escaping these strings correctly, but maybe the generators that you’re using won’t have this issue.