AudioFormatReader not merging channels


#1

I have noticed a possible bug/anomaly with the various AudioFormatReaders. The docs say that if you try to read the source into a single buffer it will copy a merged version of the stereo source. This doesn’t appear to be the behaviour implemented though.

Shouldn’t line 326 in juce_WavAudioFormat.cpp read something like:

else if (right == 0)
{
    for (int i = numThisTime; --i >= 0;)
    {
        int mixedSample = 0;

        mixedSample += (int) swapIfBigEndian ((unsigned short) *src++) << 16;
        mixedSample += (int) swapIfBigEndian ((unsigned short) *src++) << 16;

        *left++ = mixedSample * 0.5;
    }
}
And a similar thing in AiffAudioFormat?

#2

Er… yes, looks like you spotted the deliberate mistake there! Easy to fix, I’ll check something in shortly…