From 9f2a619c06851429e261264c7f4b18a75cd4d7fd Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 27 Jan 2010 05:10:38 +0000 Subject: SCI2.1 and onwards uses the 'new' DPCM8 which differs only by order. This fixes sound in the GK2 demo slideshow. Also, fix a logic bug with endianness in the DPCM decoders. svn-id: r47590 --- engines/sci/sound/audio.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp index d80d4cd348..9c8ddacd90 100644 --- a/engines/sci/sound/audio.cpp +++ b/engines/sci/sound/audio.cpp @@ -124,17 +124,23 @@ static void deDPCM16(byte *soundBuf, Common::SeekableReadStream &audioStream, ui s += tableDPCM16[b]; s = CLIP(s, -32768, 32767); - *out++ = s; + *out++ = TO_LE_16(s); } } static void deDPCM8Nibble(byte *soundBuf, int32 &s, byte b) { - if (b & 8) - s -= tableDPCM8[7 - (b & 7)]; - else + if (b & 8) { +#ifdef ENABLE_SCI32 + // SCI2.1 reverses the order of the table values here + if (getSciVersion() >= SCI_VERSION_2_1) + s -= tableDPCM8[b & 7]; + else +#endif + s -= tableDPCM8[7 - (b & 7)]; + } else s += tableDPCM8[b & 7]; s = CLIP(s, 0, 255); - *soundBuf = TO_LE_16(s); + *soundBuf = s; } static void deDPCM8(byte *soundBuf, Common::SeekableReadStream &audioStream, uint32 n) { -- cgit v1.2.3