Possible bug in AudioSampleBuffer::readFromAudioReader


#1

I’m just reporting someone else’s fix, so I can’t get into details,
but it looks like the function doesn’t handle the case where the buffer passed to getNextAudioBlock() is mono and the reader is stereo :

in juce_AudioSampleBuffer.cpp, line 483 :

if (useLeftChan == useRightChan) { chans[0] = (int*) getSampleData (0, startSample); chans[1] = (reader->numChannels > 1) ? (int*)getSampleData (1, startSample) : 0; }

should be

if (useLeftChan == useRightChan) { chans[0] = (int*) getSampleData (0, startSample); chans[1] = (reader->numChannels > 1 && getNumChannels() > 1) ? (int*)getSampleData (1, startSample) : 0; }


#2

…yes, I think you’re right about that. Thanks!


#3