diff options
-rw-r--r-- | sound/audiostream.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 684673d6c1..7a1a537ebb 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -146,8 +146,8 @@ template<bool stereo, bool is16Bit, bool isUnsigned> int WrappedMemoryStream<stereo, is16Bit, isUnsigned>::readBuffer(int16 *buffer, int numSamples) { int samples = 0; #if 1 - for (int i = (_pos > _end) ? 0 : 1; i < 2 && samples < numSamples && !eosIntern(); i++) { - const byte *endMarker = (i == 0) ? _bufferEnd : _end; + while (samples < numSamples && !eosIntern()) { + const byte *endMarker = (_pos > _end) ? _bufferEnd : _end; const int len = MIN(numSamples, (endMarker - _pos) / (is16Bit ? 2 : 1)); while (samples < len) { |