From b4c7cd0484be154b2e47ece3bd5b0e0e6911d041 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 20 Aug 2009 20:41:12 +0000 Subject: Fix 16-bit SOL audio on little endian systems. Fixes the white noise in the Gabriel Knight demo. svn-id: r43569 --- engines/sci/sfx/core.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'engines/sci/sfx/core.cpp') diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index 95d79b3666..a1e2a0b0f8 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -1060,7 +1060,7 @@ static void deDPCM16(byte *soundBuf, Common::SeekableReadStream &audioStream, ui s += tableDPCM16[b]; s = CLIP(s, -32768, 32767); - *out++ = TO_BE_16(s); + *out++ = s; } } @@ -1105,8 +1105,13 @@ static byte* readSOLAudio(Common::SeekableReadStream *audioStream, uint32 &size, // Convert the SOL stream flags to our own format flags = 0; - if (audioFlags & kSolFlag16Bit) + if (audioFlags & kSolFlag16Bit) { flags |= Audio::Mixer::FLAG_16BITS; +#ifdef SCUMM_LITTLE_ENDIAN + flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; +#endif + } + if (!(audioFlags & kSolFlagIsSigned)) flags |= Audio::Mixer::FLAG_UNSIGNED; -- cgit v1.2.3 From cba2897cc8f7b70d27fc75ca8b8d55cde4738e4a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 21 Aug 2009 03:31:34 +0000 Subject: Truly fix endianness in the SOL decoder. Raw sounds are always in little endian order and now compressed are outputted to little endian too (and therefore the little endian mixer flag is always set). svn-id: r43576 --- engines/sci/sfx/core.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'engines/sci/sfx/core.cpp') diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index a1e2a0b0f8..c8cf773eae 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -1070,7 +1070,7 @@ static void deDPCM8Nibble(byte *soundBuf, int32 &s, byte b) { else s += tableDPCM8[b & 7]; s = CLIP(s, 0, 255); - *soundBuf = s; + *soundBuf = TO_LE_16(s); } static void deDPCM8(byte *soundBuf, Common::SeekableReadStream &audioStream, uint32 n) { @@ -1105,13 +1105,9 @@ static byte* readSOLAudio(Common::SeekableReadStream *audioStream, uint32 &size, // Convert the SOL stream flags to our own format flags = 0; - if (audioFlags & kSolFlag16Bit) { - flags |= Audio::Mixer::FLAG_16BITS; -#ifdef SCUMM_LITTLE_ENDIAN - flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; -#endif - } - + if (audioFlags & kSolFlag16Bit) + flags |= Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN; + if (!(audioFlags & kSolFlagIsSigned)) flags |= Audio::Mixer::FLAG_UNSIGNED; -- cgit v1.2.3