diff options
-rw-r--r-- | OpenAL32/sample_cvt.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/OpenAL32/sample_cvt.c b/OpenAL32/sample_cvt.c index a4dfabca..0c0ba6dd 100644 --- a/OpenAL32/sample_cvt.c +++ b/OpenAL32/sample_cvt.c @@ -396,22 +396,21 @@ static void DecodeMSADPCMBlock(ALshort *dst, const ALmsadpcm *src, ALint numchan const ALint num = (j*numchans) + i; ALint nibble, pred; - /* Read the nibble and sign-expand it. */ + /* Read the nibble (first is in the upper bits). */ if(!(num&1)) nibble = (*src>>4)&0x0f; else nibble = (*(src++))&0x0f; - nibble = (nibble^0x08) - 0x08; pred = (samples[i][0]*MSADPCMAdaptionCoeff[blockpred[i]][0] + samples[i][1]*MSADPCMAdaptionCoeff[blockpred[i]][1]) / 256; - pred += nibble * delta[i]; + pred += ((nibble^0x08) - 0x08) * delta[i]; pred = clampi(pred, -32768, 32767); samples[i][1] = samples[i][0]; samples[i][0] = pred; - delta[i] = (MSADPCMAdaption[nibble&0x0f] * delta[i]) / 256; + delta[i] = (MSADPCMAdaption[nibble] * delta[i]) / 256; delta[i] = maxi(16, delta[i]); *(dst++) = pred; |