Creating Custom AudioChannelSet

Is there a way to create custom AudioChannelSets?

I would have thought AudioChannelSet was a base class that formats such as stereo derived from but it seems that is not the case.

You can create your own channel layouts by creating a default AudioChannelSet and then calling addChannel for each of the channel types you wish to add:

AudioChannelSet channels;
channels.addChannel (AudioChannelSet::ChannelType::left);
channels.addChannel (AudioChannelSet::ChannelType::right);

Hmmm that helps to some extent. Is there a way to create a custom Named channel set. So that description was filled out too?

No, if you look at the implementation of getDescription you’ll see that it’s just checking which channels are set, and returning a different string based on these channels. The name isn’t stored inside the AudioChannelSet anywhere.

If you need to add custom description strings, I’d recommend writing a custom function:

String getCustomDescription (const AudioChannelSet& channelSet)
    if (channelSet == getMyCustomChannelSet()) return "Custom channel set";

    return channelSet.getDescription();

Then, you can just use this function anywhere that you would previously have used AudioChannelSet::getDescription().

Ok, cool. I might give that a go.

Thanks for your help!