Improve alist_resample

New algorithm is faster and more accurate
This commit is contained in:
LegendOfDragoon 2016-05-25 17:10:21 -07:00
parent a00011b0f3
commit b187ad9b81
1 changed files with 5 additions and 5 deletions

View File

@ -633,11 +633,11 @@ void alist_resample( CHle * hle, bool init, bool flag2, uint16_t dmemo, uint16_t
{
const int16_t* lut = RESAMPLE_LUT + ((pitch_accu & 0xfc00) >> 8);
*sample(hle, opos++) = clamp_s16(
((*sample(hle, ipos) * lut[0]) >> 15) +
((*sample(hle, ipos + 1) * lut[1]) >> 15) +
((*sample(hle, ipos + 2) * lut[2]) >> 15) +
((*sample(hle, ipos + 3) * lut[3]) >> 15));
*sample(hle, opos++) = clamp_s16( (
(*sample(hle, ipos ) * lut[0]) +
(*sample(hle, ipos + 1) * lut[1]) +
(*sample(hle, ipos + 2) * lut[2]) +
(*sample(hle, ipos + 3) * lut[3]) ) >> 15);
pitch_accu += pitch;
ipos += (pitch_accu >> 16);