aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorEugene Sandulenko2005-09-22 20:45:46 +0000
committerEugene Sandulenko2005-09-22 20:45:46 +0000
commit2b1d4ef990c0a822da7838aa3261bbb7f48b2fba (patch)
tree36a49c669954befe3ee7b3cd054eea5d7111564a /sound
parent2ff735ff094b25423ae0ad175e63063440150cf3 (diff)
downloadscummvm-rg350-2b1d4ef990c0a822da7838aa3261bbb7f48b2fba.tar.gz
scummvm-rg350-2b1d4ef990c0a822da7838aa3261bbb7f48b2fba.tar.bz2
scummvm-rg350-2b1d4ef990c0a822da7838aa3261bbb7f48b2fba.zip
Fix regression caused by recent code cleanup. Each input byte should be
processed twice, so even if stream end is reached, there should be another iteration. Otherwise it always returned one byte less than expected. svn-id: r18859
Diffstat (limited to 'sound')
-rw-r--r--sound/adpcm.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/adpcm.cpp b/sound/adpcm.cpp
index 80bbbe4fdc..b38cca36e3 100644
--- a/sound/adpcm.cpp
+++ b/sound/adpcm.cpp
@@ -72,7 +72,9 @@ template <typesADPCM TYPE>
int ADPCMInputStream<TYPE>::readBuffer(int16 *buffer, const int numSamples) {
int samples;
- for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples++) {
+ // Since we process high and low nibbles separately never check buffer end
+ // on low nibble
+ for (samples = 0; !_evenPos || samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples++) {
if (_evenPos) {
_lastByte = _stream->readByte();
buffer[samples] = decode((_lastByte >> 4) & 0x0f);