From a4d4e9e5b076bd1346edb9afb516feda1b723d42 Mon Sep 17 00:00:00 2001 From: hogliux Date: Mon, 31 Jul 2017 12:58:03 +0100 Subject: [PATCH] WaveAudioFormatWriter: Don't add an extended format chunk if the wav file only has one or two channels --- modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp index 304772fd8a..073f3c5035 100644 --- a/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp +++ b/modules/juce_audio_formats/codecs/juce_WavAudioFormat.cpp @@ -1476,7 +1476,12 @@ private: static int getChannelMaskFromChannelLayout (const AudioChannelSet& channelLayout) { - if (channelLayout.isDiscreteLayout() || channelLayout == AudioChannelSet::mono()) + if (channelLayout.isDiscreteLayout()) + return 0; + + // Don't add an extended format chunk for mono and stereo. Basically, all wav players + // interpret a wav file with only one or two channels to be mono or stereo anyway. + if (channelLayout == AudioChannelSet::mono() || channelLayout == AudioChannelSet::stereo()) return 0; auto channels = channelLayout.getChannelTypes();