aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-05-31 22:37:28 +0000
committerTorbjörn Andersson2006-05-31 22:37:28 +0000
commita5fc242946c8e15f26a7aa5cc2be9ea0d09b87bf (patch)
treef128a309ab06dea6b949d5084c9eb854b4e8e347
parent72904c33545ec534e43108d5ecea7905b8137c42 (diff)
downloadscummvm-rg350-a5fc242946c8e15f26a7aa5cc2be9ea0d09b87bf.tar.gz
scummvm-rg350-a5fc242946c8e15f26a7aa5cc2be9ea0d09b87bf.tar.bz2
scummvm-rg350-a5fc242946c8e15f26a7aa5cc2be9ea0d09b87bf.zip
Clip samp to 2047, not 2048, so that it stays positive when multiplied by 16.
This seems to fix sound distortion in the Inherit the Earth demo. svn-id: r22812
-rw-r--r--sound/adpcm.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/adpcm.cpp b/sound/adpcm.cpp
index 9522e588d0..519d0d738c 100644
--- a/sound/adpcm.cpp
+++ b/sound/adpcm.cpp
@@ -266,9 +266,9 @@ int16 ADPCMInputStream::decodeOKI(byte code) {
diff = (code & 0x08) ? -E : E;
samp = _status.last + diff;
- // Clip the values to +/- 2^11 (supposed to be 12 bits)
- if (samp > 2048)
- samp = 2048;
+ // Clip the values to +/- 2^11 (supposed to be 12 bits)
+ if (samp > 2047)
+ samp = 2047;
if (samp < -2048)
samp = -2048;