Documentation issue in WavAudioFormat

The docs for WavAudioFormat::createWriterFor say:

numberOfChannels: the number of channels - this must be either 1 or 2, and the choice will depend on the results of canDoMono() and canDoStereo()

However, it seems to work just fine when passing in a number greater than 2. Is the documentation old, or am I just lucky that it works?

https://docs.juce.com/master/classWavAudioFormat.html#a989d29b8ca1c28389700f0e5ee17b3ee

WavAudioFormat supports more than mono and stereo since https://github.com/WeAreROLI/JUCE/commit/7ca5ad001e0c603020f90425dfadec467b7b4649 (JUCE 5.1.0), so you’re not just lucky :slightly_smiling_face:

You should prefer using the overload of createWriterFor which takes the channelLayout as an AudioChannelSet to be more explicit.

WavAudioFormat::createWriterFor actually doesn’t have its own documentation, but “inherits” the documentation from AudioFormat::createWriterFor, which it implements. I guess that documentation should be updated a bit.

It goes even further back, 2011 it was extended to four formats: mono / stereo / 5.0 / 5.1

And was touched in the meantime another time to add more formats…
If the OP wants to find out such things: Clicking on “Blame” is a great function in git :slight_smile:

1 Like

Thanks for the help! I created a pull request to fix this:

Is that the proper way to go about this? I see the README mentions

We don’t accept third party GitHub pull requests directly due to copyright restrictions

It is indeed the right way to go about this. What is mentioned on the README means that the JUCE team won’t merge your pull request directly, but they do welcome patches!

1 Like

Thanks for reporting:

2 Likes