aboutsummaryrefslogtreecommitdiff
path: root/sound/decoders
diff options
context:
space:
mode:
Diffstat (limited to 'sound/decoders')
-rw-r--r--sound/decoders/adpcm.cpp13
-rw-r--r--sound/decoders/adpcm.h17
-rw-r--r--sound/decoders/flac.cpp5
-rw-r--r--sound/decoders/vorbis.cpp5
-rw-r--r--sound/decoders/wave.cpp20
5 files changed, 37 insertions, 23 deletions
diff --git a/sound/decoders/adpcm.cpp b/sound/decoders/adpcm.cpp
index c8a907d13e..8a27658e4b 100644
--- a/sound/decoders/adpcm.cpp
+++ b/sound/decoders/adpcm.cpp
@@ -290,8 +290,8 @@ int Apple_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
class MSIma_ADPCMStream : public Ima_ADPCMStream {
public:
- MSIma_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
- : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {
+ MSIma_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign, bool invertSamples = false)
+ : Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign), _invertSamples(invertSamples) {
if (blockAlign == 0)
error("ADPCMStream(): blockAlign isn't specified for MS IMA ADPCM");
}
@@ -305,6 +305,9 @@ public:
int readBufferMSIMA1(int16 *buffer, const int numSamples);
int readBufferMSIMA2(int16 *buffer, const int numSamples);
+
+private:
+ bool _invertSamples; // Some implementations invert the way samples are decoded
};
int MSIma_ADPCMStream::readBufferMSIMA1(int16 *buffer, const int numSamples) {
@@ -324,8 +327,8 @@ int MSIma_ADPCMStream::readBufferMSIMA1(int16 *buffer, const int numSamples) {
for (; samples < numSamples && _blockPos[0] < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
data = _stream->readByte();
_blockPos[0]++;
- buffer[samples] = decodeIMA(data & 0x0f);
- buffer[samples + 1] = decodeIMA((data >> 4) & 0x0f);
+ buffer[samples] = decodeIMA(_invertSamples ? (data >> 4) & 0x0f : data & 0x0f);
+ buffer[samples + 1] = decodeIMA(_invertSamples ? data & 0x0f : (data >> 4) & 0x0f);
}
}
return samples;
@@ -733,6 +736,8 @@ RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, Dispo
return new Oki_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
case kADPCMMSIma:
return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
+ case kADPCMMSImaLastExpress:
+ return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign, true);
case kADPCMMS:
return new MS_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
case kADPCMTinsel4:
diff --git a/sound/decoders/adpcm.h b/sound/decoders/adpcm.h
index 04dbb1a521..edcdc01ce9 100644
--- a/sound/decoders/adpcm.h
+++ b/sound/decoders/adpcm.h
@@ -50,14 +50,15 @@ class RewindableAudioStream;
// Usually, if the audio stream we're trying to play has the FourCC header
// string intact, it's easy to discern which encoding is used
enum typesADPCM {
- kADPCMOki, // Dialogic/Oki ADPCM (aka VOX)
- kADPCMMSIma, // Microsoft IMA ADPCM
- kADPCMMS, // Microsoft ADPCM
- kADPCMTinsel4, // 4-bit ADPCM used by the Tinsel engine
- kADPCMTinsel6, // 6-bit ADPCM used by the Tinsel engine
- kADPCMTinsel8, // 8-bit ADPCM used by the Tinsel engine
- kADPCMIma, // Standard IMA ADPCM
- kADPCMApple // Apple QuickTime IMA ADPCM
+ kADPCMOki, // Dialogic/Oki ADPCM (aka VOX)
+ kADPCMMSIma, // Microsoft IMA ADPCM
+ kADPCMMSImaLastExpress, // Microsoft IMA ADPCM (with inverted samples)
+ kADPCMMS, // Microsoft ADPCM
+ kADPCMTinsel4, // 4-bit ADPCM used by the Tinsel engine
+ kADPCMTinsel6, // 6-bit ADPCM used by the Tinsel engine
+ kADPCMTinsel8, // 8-bit ADPCM used by the Tinsel engine
+ kADPCMIma, // Standard IMA ADPCM
+ kADPCMApple // Apple QuickTime IMA ADPCM
};
/**
diff --git a/sound/decoders/flac.cpp b/sound/decoders/flac.cpp
index 560b83e1ee..080141f224 100644
--- a/sound/decoders/flac.cpp
+++ b/sound/decoders/flac.cpp
@@ -23,6 +23,9 @@
*
*/
+// Disable symbol overrides for FILE as that is used in FLAC headers
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+
#include "sound/decoders/flac.h"
#ifdef USE_FLAC
@@ -302,7 +305,7 @@ int FLACStream::readBuffer(int16 *buffer, const int numSamples) {
const uint numChannels = getChannels();
if (numChannels == 0) {
- warning("FLACStream: Stream not sucessfully initialised, cant playback");
+ warning("FLACStream: Stream not successfully initialised, cant playback");
return -1; // streaminfo wasnt read!
}
diff --git a/sound/decoders/vorbis.cpp b/sound/decoders/vorbis.cpp
index 5aeb40c139..425eb6b751 100644
--- a/sound/decoders/vorbis.cpp
+++ b/sound/decoders/vorbis.cpp
@@ -23,6 +23,11 @@
*
*/
+// Disable symbol overrides for FILE and fseek as those are used in the
+// Vorbis headers.
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+#define FORBIDDEN_SYMBOL_EXCEPTION_fseek
+
#include "sound/decoders/vorbis.h"
#ifdef USE_VORBIS
diff --git a/sound/decoders/wave.cpp b/sound/decoders/wave.cpp
index eeab026ae5..fcaace5301 100644
--- a/sound/decoders/wave.cpp
+++ b/sound/decoders/wave.cpp
@@ -90,15 +90,15 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
if (blockAlign_ != 0)
*blockAlign_ = blockAlign;
#if 0
- printf("WAVE information:\n");
- printf(" total size: %d\n", wavLength);
- printf(" fmt size: %d\n", fmtLength);
- printf(" type: %d\n", type);
- printf(" numChannels: %d\n", numChannels);
- printf(" samplesPerSec: %d\n", samplesPerSec);
- printf(" avgBytesPerSec: %d\n", avgBytesPerSec);
- printf(" blockAlign: %d\n", blockAlign);
- printf(" bitsPerSample: %d\n", bitsPerSample);
+ debug("WAVE information:");
+ debug(" total size: %d", wavLength);
+ debug(" fmt size: %d", fmtLength);
+ debug(" type: %d", type);
+ debug(" numChannels: %d", numChannels);
+ debug(" samplesPerSec: %d", samplesPerSec);
+ debug(" avgBytesPerSec: %d", avgBytesPerSec);
+ debug(" blockAlign: %d", blockAlign);
+ debug(" bitsPerSample: %d", bitsPerSample);
#endif
if (type != 1 && type != 2 && type != 17) {
@@ -152,7 +152,7 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
offset = stream.readUint32LE();
#if 0
- printf(" found a '%s' tag of size %d\n", buf, offset);
+ debug(" found a '%s' tag of size %d", buf, offset);
#endif
} while (memcmp(buf, "data", 4) != 0);