[Scummvm-cvs-logs] SF.net SVN: scummvm:[35106] scummvm/trunk/sound/adpcm.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon Nov 17 12:10:34 CET 2008
Revision: 35106
http://scummvm.svn.sourceforge.net/scummvm/?rev=35106&view=rev
Author: fingolfin
Date: 2008-11-17 11:10:34 +0000 (Mon, 17 Nov 2008)
Log Message:
-----------
Fixed a warning on the DS build, added some clarifying comments, reformatted the okiStepSize and imaStepTable tables (the former really is a subtable of the latter)
Modified Paths:
--------------
scummvm/trunk/sound/adpcm.cpp
Modified: scummvm/trunk/sound/adpcm.cpp
===================================================================
--- scummvm/trunk/sound/adpcm.cpp 2008-11-17 11:09:57 UTC (rev 35105)
+++ scummvm/trunk/sound/adpcm.cpp 2008-11-17 11:10:34 UTC (rev 35106)
@@ -320,7 +320,7 @@
}
for (; samples < numSamples && _blockPos < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 2, _blockPos++) {
-
+ // Read 1 byte = 8 bits = two 4 bit blocks
data = _stream->readByte();
buffer[samples] = TO_LE_16(decodeTinsel((data << 8) & 0xF000, eVal));
buffer[samples+1] = TO_LE_16(decodeTinsel((data << 12) & 0xF000, eVal));
@@ -346,7 +346,7 @@
}
for (; samples < numSamples && _blockPos < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples += 4, _blockPos += 3) {
-
+ // Read 3 bytes = 24 bits = four 6 bit blocks
data = _stream->readByte();
buffer[samples] = TO_LE_16(decodeTinsel((data << 8) & 0xFC00, eVal));
data = (data << 8) | (_stream->readByte());
@@ -375,6 +375,7 @@
}
for (; samples < numSamples && _blockPos < _blockAlign && !_stream->eos() && _stream->pos() < _endpos; samples++, _blockPos++) {
+ // Read 1 byte = 8 bits = one 8 bit block
data = _stream->readByte();
buffer[samples] = TO_LE_16(decodeTinsel(data << 8, eVal));
}
@@ -415,13 +416,13 @@
}
static const int16 okiStepSize[49] = {
- 16, 17, 19, 21, 23, 25, 28, 31,
- 34, 37, 41, 45, 50, 55, 60, 66,
- 73, 80, 88, 97, 107, 118, 130, 143,
- 157, 173, 190, 209, 230, 253, 279, 307,
- 337, 371, 408, 449, 494, 544, 598, 658,
- 724, 796, 876, 963, 1060, 1166, 1282, 1411,
- 1552
+ 16, 17, 19, 21, 23, 25, 28, 31,
+ 34, 37, 41, 45, 50, 55, 60, 66,
+ 73, 80, 88, 97, 107, 118, 130, 143,
+ 157, 173, 190, 209, 230, 253, 279, 307,
+ 337, 371, 408, 449, 494, 544, 598, 658,
+ 724, 796, 876, 963, 1060, 1166, 1282, 1411,
+ 1552
};
// Decode Linear to ADPCM
@@ -444,13 +445,13 @@
static const uint16 imaStepTable[89] = {
- 7, 8, 9, 10, 11, 12, 13, 14,
- 16, 17, 19, 21, 23, 25, 28, 31,
- 34, 37, 41, 45, 50, 55, 60, 66,
- 73, 80, 88, 97, 107, 118, 130, 143,
- 157, 173, 190, 209, 230, 253, 279, 307,
- 337, 371, 408, 449, 494, 544, 598, 658,
- 724, 796, 876, 963, 1060, 1166, 1282, 1411,
+ 7, 8, 9, 10, 11, 12, 13, 14,
+ 16, 17, 19, 21, 23, 25, 28, 31,
+ 34, 37, 41, 45, 50, 55, 60, 66,
+ 73, 80, 88, 97, 107, 118, 130, 143,
+ 157, 173, 190, 209, 230, 253, 279, 307,
+ 337, 371, 408, 449, 494, 544, 598, 658,
+ 724, 796, 876, 963, 1060, 1166, 1282, 1411,
1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
7132, 7845, 8630, 9493,10442,11487,12635,13899,
@@ -480,7 +481,7 @@
_status.d1 = _status.d0;
_status.d0 = sample;
- return (int16) CLIP(sample, -32768.0, 32767.0);
+ return (int16) CLIP<double>(sample, -32768.0, 32767.0);
}
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, bool disposeAfterUse, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) {
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