diff options
author | Thanasis Antoniou | 2019-03-25 10:34:19 +0200 |
---|---|---|
committer | Thanasis Antoniou | 2019-03-25 10:34:58 +0200 |
commit | b2c79fdf4bce6e6a0b459c8aa553f139b072e9a2 (patch) | |
tree | ca1417a84ddfea51eb4d95f83b12c6ea93c94859 /engines | |
parent | 1b333ea19a43bc1bcd8218cfea91d0059707bfd8 (diff) | |
download | scummvm-rg350-b2c79fdf4bce6e6a0b459c8aa553f139b072e9a2.tar.gz scummvm-rg350-b2c79fdf4bce6e6a0b459c8aa553f139b072e9a2.tar.bz2 scummvm-rg350-b2c79fdf4bce6e6a0b459c8aa553f139b072e9a2.zip |
BLADERUNNER: Fix static noise instead of proper audio in VQAs
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/adpcm_decoder.cpp | 15 | ||||
-rw-r--r-- | engines/bladerunner/adpcm_decoder.h | 2 | ||||
-rw-r--r-- | engines/bladerunner/aud_stream.cpp | 3 | ||||
-rw-r--r-- | engines/bladerunner/vqa_decoder.cpp | 2 |
4 files changed, 15 insertions, 7 deletions
diff --git a/engines/bladerunner/adpcm_decoder.cpp b/engines/bladerunner/adpcm_decoder.cpp index c93d4eb2c1..33c4282e1c 100644 --- a/engines/bladerunner/adpcm_decoder.cpp +++ b/engines/bladerunner/adpcm_decoder.cpp @@ -22,6 +22,7 @@ #include "bladerunner/adpcm_decoder.h" +#include "common/endian.h" #include "common/util.h" namespace BladeRunner { @@ -122,7 +123,7 @@ uint16 imaStepTable[712] = { 0x0fff,0x2ffe,0x4ffe,0x6ffd,0x8ffe,0xaffd,0xcffd,0xeffc }; -void ADPCMWestwoodDecoder::decode(uint8 *in, size_t size, int16 *out) { +void ADPCMWestwoodDecoder::decode(uint8 *in, size_t size, int16 *out, bool forceLittleEndianOut) { uint8 *end = in + size; int16 stepIndex = _stepIndex; @@ -149,8 +150,16 @@ void ADPCMWestwoodDecoder::decode(uint8 *in, size_t size, int16 *out) { predictor = CLIP<int32>(predictor, -32768, 32767); - *out++ = (int16)predictor; - + if (forceLittleEndianOut) { + // Bugfix: + // enforce "little-endian" type of output for VQA audio stream + // This is needed for Big Endian platforms to behave correctly in raw audio streams in VQA videos + // because in VQADecoder::VQAAudioTrack::decodeAudioFrame() a raw stream is created for the audio + // with the explicit flag: FLAG_LITTLE_ENDIAN + WRITE_LE_INT16(out++, (int16)predictor); + } else { + *out++ = (int16)predictor; + } stepIndex = imaIndexTable[code] + stepIndex; stepIndex = CLIP<int16>(stepIndex, 0, 88); } diff --git a/engines/bladerunner/adpcm_decoder.h b/engines/bladerunner/adpcm_decoder.h index 8f7a2285a2..6f37430981 100644 --- a/engines/bladerunner/adpcm_decoder.h +++ b/engines/bladerunner/adpcm_decoder.h @@ -41,7 +41,7 @@ public: _predictor = predictor; } - void decode(uint8 *in, size_t size, int16 *out); + void decode(uint8 *in, size_t size, int16 *out, bool forceLittleEndianOut); }; } // End of namespace BladeRunner diff --git a/engines/bladerunner/aud_stream.cpp b/engines/bladerunner/aud_stream.cpp index bb35702d10..7396cbffc4 100644 --- a/engines/bladerunner/aud_stream.cpp +++ b/engines/bladerunner/aud_stream.cpp @@ -104,8 +104,7 @@ int AudStream::readBuffer(int16 *buffer, const int numSamples) { assert(_end - _p >= _deafBlockRemain); int bytesConsumed = MIN<int>(_deafBlockRemain, (numSamples - samplesRead) / 2); - - _decoder.decode(_p, bytesConsumed, buffer + samplesRead); + _decoder.decode(_p, bytesConsumed, buffer + samplesRead, false); _p += bytesConsumed; _deafBlockRemain -= bytesConsumed; diff --git a/engines/bladerunner/vqa_decoder.cpp b/engines/bladerunner/vqa_decoder.cpp index ddd6c98abd..05ad7a8449 100644 --- a/engines/bladerunner/vqa_decoder.cpp +++ b/engines/bladerunner/vqa_decoder.cpp @@ -950,7 +950,7 @@ Audio::SeekableAudioStream *VQADecoder::VQAAudioTrack::decodeAudioFrame() { int16 *audioFrame = (int16 *)malloc(4 * 735); memset(audioFrame, 0, 4 * 735); - _adpcmDecoder.decode(_compressedAudioFrame, 735, audioFrame); + _adpcmDecoder.decode(_compressedAudioFrame, 735, audioFrame, true); uint flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN; |