diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 9fd2f046fec..6a04da5f435 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -158,7 +158,7 @@ template int LinearMemoryStream::readBuffer(int16 *buffer, const int numSamples) { int samples = numSamples; while (samples > 0 && _ptr < _end) { - int len = MIN(numSamples, (int)(_end - _ptr) / (is16Bit ? 2 : 1)); + int len = MIN(samples, (int)(_end - _ptr) / (is16Bit ? 2 : 1)); samples -= len; do { *buffer++ = READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, _ptr, isLE);