aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorFilippos Karapetis2009-02-01 22:06:43 +0000
committerFilippos Karapetis2009-02-01 22:06:43 +0000
commit71b4f84c4688abc6588eea0676fc53f25a36a144 (patch)
treeba1e0b38de0473f7dcfbb6ea40c493086291ddeb /sound
parent222165087940bffa22d7856c662228bbf09a0433 (diff)
downloadscummvm-rg350-71b4f84c4688abc6588eea0676fc53f25a36a144.tar.gz
scummvm-rg350-71b4f84c4688abc6588eea0676fc53f25a36a144.tar.bz2
scummvm-rg350-71b4f84c4688abc6588eea0676fc53f25a36a144.zip
Fixed incorrect usage of a boolean (boolean variables are not supposed to be used as indexes to arrays...)
svn-id: r36194
Diffstat (limited to 'sound')
-rw-r--r--sound/adpcm.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/sound/adpcm.cpp b/sound/adpcm.cpp
index fc3ac14907..60345c4fe2 100644
--- a/sound/adpcm.cpp
+++ b/sound/adpcm.cpp
@@ -76,7 +76,7 @@ private:
void reset();
int16 stepAdjust(byte);
int16 decodeOKI(byte);
- int16 decodeIMA(byte code, bool right = false); // Default to using the left channel/using one channel
+ int16 decodeIMA(byte code, int channel = 0); // Default to using the left channel/using one channel
int16 decodeMS(ADPCMChannelStatus *c, byte);
int16 decodeTinsel(int16, double);
@@ -219,7 +219,7 @@ int ADPCMInputStream::readBufferIMA(int16 *buffer, const int numSamples) {
for (samples = 0; samples < numSamples && !_stream->eos() && _stream->pos() < _endpos; samples += 2) {
data = _stream->readByte();
buffer[samples] = TO_LE_16(decodeIMA((data >> 4) & 0x0f));
- buffer[samples + 1] = TO_LE_16(decodeIMA(data & 0x0f, _channels == 2));
+ buffer[samples + 1] = TO_LE_16(decodeIMA(data & 0x0f, _channels == 2 ? 1 : 0));
}
return samples;
}
@@ -520,14 +520,14 @@ static const uint16 imaStepTable[89] = {
32767
};
-int16 ADPCMInputStream::decodeIMA(byte code, bool right) {
- int32 E = (2 * (code & 0x7) + 1) * imaStepTable[_status.ima_ch[right].stepIndex] / 8;
+int16 ADPCMInputStream::decodeIMA(byte code, int channel) {
+ int32 E = (2 * (code & 0x7) + 1) * imaStepTable[_status.ima_ch[channel].stepIndex] / 8;
int32 diff = (code & 0x08) ? -E : E;
- int32 samp = CLIP<int32>(_status.ima_ch[right].last + diff, -32768, 32767);
+ int32 samp = CLIP<int32>(_status.ima_ch[channel].last + diff, -32768, 32767);
- _status.ima_ch[right].last = samp;
- _status.ima_ch[right].stepIndex += stepAdjust(code);
- _status.ima_ch[right].stepIndex = CLIP<int32>(_status.ima_ch[right].stepIndex, 0, ARRAYSIZE(imaStepTable) - 1);
+ _status.ima_ch[channel].last = samp;
+ _status.ima_ch[channel].stepIndex += stepAdjust(code);
+ _status.ima_ch[channel].stepIndex = CLIP<int32>(_status.ima_ch[channel].stepIndex, 0, ARRAYSIZE(imaStepTable) - 1);
return samp;
}