diff options
author | Benjamin Haisch | 2008-04-25 11:02:37 +0000 |
---|---|---|
committer | Benjamin Haisch | 2008-04-25 11:02:37 +0000 |
commit | 4bcf3ab8233d44ee12d95a9328bec67fc74e1902 (patch) | |
tree | c4bb74ebcbd6f964b550e9a66b7b55535a20275a /engines | |
parent | 2172eee072d0819bea8cf4d1f35926948756a57e (diff) | |
download | scummvm-rg350-4bcf3ab8233d44ee12d95a9328bec67fc74e1902.tar.gz scummvm-rg350-4bcf3ab8233d44ee12d95a9328bec67fc74e1902.tar.bz2 scummvm-rg350-4bcf3ab8233d44ee12d95a9328bec67fc74e1902.zip |
(Poissbly) fixed sound glitches due to a non-implemented decoding variant.
svn-id: r31716
Diffstat (limited to 'engines')
-rw-r--r-- | engines/made/sound.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp index 3cb2ea69fd..27cf516b11 100644 --- a/engines/made/sound.cpp +++ b/engines/made/sound.cpp @@ -34,7 +34,7 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou int16 prevSample = 0, workSample = 0; byte soundBuffer[1025]; - byte soundBuffer3[1024]; + byte deltaSoundBuffer[1024]; int16 soundBuffer2[16]; byte deltaType, type; uint16 workChunkSize, byteCount, bitCount; @@ -106,17 +106,24 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou } - if (deltaType == 1) { - for (i = 0; i < chunkSize - 1; i += 2) { - l = i / 2; - soundBuffer3[i] = soundBuffer[l]; - soundBuffer3[i + 1] = (soundBuffer[l + 1] + soundBuffer[l]) / 2; - } - for (i = 0; i < chunkSize; i++) { - soundBuffer[i] = soundBuffer3[i]; + if (deltaType > 0) { + if (deltaType == 1) { + for (i = 0; i < chunkSize - 1; i += 2) { + l = i / 2; + deltaSoundBuffer[i] = soundBuffer[l]; + deltaSoundBuffer[i + 1] = (soundBuffer[l] + soundBuffer[l + 1]) / 2; + } + } else if (deltaType == 2) { + for (i = 0; i < chunkSize - 1; i += 4) { + l = i / 4; + deltaSoundBuffer[i] = soundBuffer[l]; + deltaSoundBuffer[i + 2] = (soundBuffer[l] + soundBuffer[l + 1]) / 2; + deltaSoundBuffer[i + 1] = (deltaSoundBuffer[i + 2] + soundBuffer[l]) / 2; + deltaSoundBuffer[i + 3] = (deltaSoundBuffer[i + 2] + soundBuffer[l + 1]) / 2; + } } - } else if (deltaType == 2) { - debug(2, "****************************************"); + for (i = 0; i < chunkSize; i++) + soundBuffer[i] = deltaSoundBuffer[i]; } prevSample = workSample; |