[Scummvm-cvs-logs] SF.net SVN: scummvm: [29682] scummvm/trunk/sound
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sat Dec 1 17:31:10 CET 2007
Revision: 29682
http://scummvm.svn.sourceforge.net/scummvm/?rev=29682&view=rev
Author: thebluegr
Date: 2007-12-01 08:31:10 -0800 (Sat, 01 Dec 2007)
Log Message:
-----------
Slight cleanup and commenting of the ADPCM decoder
Modified Paths:
--------------
scummvm/trunk/sound/adpcm.cpp
scummvm/trunk/sound/adpcm.h
Modified: scummvm/trunk/sound/adpcm.cpp
===================================================================
--- scummvm/trunk/sound/adpcm.cpp 2007-12-01 16:18:26 UTC (rev 29681)
+++ scummvm/trunk/sound/adpcm.cpp 2007-12-01 16:31:10 UTC (rev 29682)
@@ -265,10 +265,10 @@
predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 256;
predictor += (signed)((code & 0x08) ? (code - 0x10) : (code)) * c->delta;
- if (predictor < -0x8000)
- predictor = -0x8000;
- else if (predictor > 0x7fff)
- predictor = 0x7fff;
+ if (predictor < -32768)
+ predictor = -32768;
+ else if (predictor > 32767)
+ predictor = 32767;
c->sample2 = c->sample1;
c->sample1 = predictor;
@@ -345,13 +345,12 @@
diff = (code & 0x08) ? -E : E;
samp = _status.last + diff;
- if (samp < -0x8000)
- samp = -0x8000;
- else if (samp > 0x7fff)
- samp = 0x7fff;
+ if (samp < -32768)
+ samp = -32768;
+ else if (samp > 32767)
+ samp = 32767;
_status.last = samp;
-
_status.stepIndex += stepAdjust(code);
if (_status.stepIndex < 0)
_status.stepIndex = 0;
Modified: scummvm/trunk/sound/adpcm.h
===================================================================
--- scummvm/trunk/sound/adpcm.h 2007-12-01 16:18:26 UTC (rev 29681)
+++ scummvm/trunk/sound/adpcm.h 2007-12-01 16:31:10 UTC (rev 29682)
@@ -34,10 +34,15 @@
class AudioStream;
+// There are several types of ADPCM encoding, only some are supported here
+// For all the different encodings, refer to:
+// http://wiki.multimedia.cx/index.php?title=Category:ADPCM_Audio_Codecs
+// 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,
- kADPCMMSIma,
- kADPCMMS
+ kADPCMOki, // Dialogic/Oki ADPCM (aka VOX)
+ kADPCMMSIma, // Microsoft IMA ADPCM
+ kADPCMMS // Microsoft ADPCM
};
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list