[Scummvm-cvs-logs] scummvm master -> deb46ab38b8a904543ede68ff2d2315f40168096

clone2727 clone2727 at gmail.com
Wed Apr 13 15:46:56 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
deb46ab38b AUDIO: Split the Intel DVI ADPCM into its own class


Commit: deb46ab38b8a904543ede68ff2d2315f40168096
    https://github.com/scummvm/scummvm/commit/deb46ab38b8a904543ede68ff2d2315f40168096
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-04-13T06:45:13-07:00

Commit Message:
AUDIO: Split the Intel DVI ADPCM into its own class

IMA is really just the definition on how to decode a sample from a nibble, DVI is just a way for those nibbles to be stored in the stream.

Changed paths:
    audio/decoders/adpcm.cpp
    audio/decoders/adpcm.h
    audio/decoders/adpcm_intern.h
    engines/mohawk/sound.cpp



diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp
index 43b5a0b..ac18b24 100644
--- a/audio/decoders/adpcm.cpp
+++ b/audio/decoders/adpcm.cpp
@@ -121,7 +121,7 @@ int16 Oki_ADPCMStream::decodeOKI(byte code) {
 #pragma mark -
 
 
-int Ima_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
+int DVI_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) {
 	int samples;
 	byte data;
 
@@ -453,8 +453,8 @@ RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, Dispo
 		return new MSIma_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign, true);
 	case kADPCMMS:
 		return new MS_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
-	case kADPCMIma:
-		return new Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
+	case kADPCMDVI:
+		return new DVI_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
 	case kADPCMApple:
 		return new Apple_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign);
 	case kADPCMDK3:
diff --git a/audio/decoders/adpcm.h b/audio/decoders/adpcm.h
index 06cda69..7202d6b 100644
--- a/audio/decoders/adpcm.h
+++ b/audio/decoders/adpcm.h
@@ -58,7 +58,7 @@ enum typesADPCM {
 	kADPCMMSIma,               // Microsoft IMA ADPCM
 	kADPCMMSImaLastExpress,    // Microsoft IMA ADPCM (with inverted samples)
 	kADPCMMS,                  // Microsoft ADPCM
-	kADPCMIma,                 // Standard IMA ADPCM
+	kADPCMDVI,                 // Intel DVI IMA ADPCM
 	kADPCMApple,               // Apple QuickTime IMA ADPCM
 	kADPCMDK3                  // Duck DK3 IMA ADPCM
 };
diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h
index b566f2c..2d56c9d 100644
--- a/audio/decoders/adpcm_intern.h
+++ b/audio/decoders/adpcm_intern.h
@@ -104,15 +104,20 @@ public:
 		memset(&_status, 0, sizeof(_status));
 	}
 
-	virtual int readBuffer(int16 *buffer, const int numSamples);
-
-
 	/**
 	 * This table is used by decodeIMA.
 	 */
 	static const int16 _imaTable[89];
 };
 
+class DVI_ADPCMStream : public Ima_ADPCMStream {
+public:
+	DVI_ADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
+		: Ima_ADPCMStream(stream, disposeAfterUse, size, rate, channels, blockAlign) {}
+
+	virtual int readBuffer(int16 *buffer, const int numSamples);
+};
+
 class Apple_ADPCMStream : public Ima_ADPCMStream {
 protected:
 	// Apple QuickTime IMA ADPCM
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index b4ae50b..9759f14 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -479,7 +479,7 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
 		return Audio::makeRawStream(dataChunk.audioData, dataChunk.sampleRate, flags);
 	} else if (dataChunk.encoding == kCodecADPCM) {
 		uint32 blockAlign = dataChunk.channels * dataChunk.bitsPerSample / 8;
-		return Audio::makeADPCMStream(dataChunk.audioData, DisposeAfterUse::YES, dataSize, Audio::kADPCMIma, dataChunk.sampleRate, dataChunk.channels, blockAlign);
+		return Audio::makeADPCMStream(dataChunk.audioData, DisposeAfterUse::YES, dataSize, Audio::kADPCMDVI, dataChunk.sampleRate, dataChunk.channels, blockAlign);
 	} else if (dataChunk.encoding == kCodecMPEG2) {
 #ifdef USE_MAD
 		return Audio::makeMP3Stream(dataChunk.audioData, DisposeAfterUse::YES);






More information about the Scummvm-git-logs mailing list