comparison decoders/timidity/resample.c @ 522:205a9b400da2

Minor correction in Timidity resampling code (Thanks, Sam!).
author Ryan C. Gordon <icculus@icculus.org>
date Sun, 15 Jul 2007 16:00:06 +0000
parents a73c51c12452
children
comparison
equal deleted inserted replaced
520:64ae7ac242b9 522:205a9b400da2
582 /* 582 /*
583 * Electric Fence to the rescue: Accessing *(vptr - 1) is not a 583 * Electric Fence to the rescue: Accessing *(vptr - 1) is not a
584 * good thing to do when vptr <= src. (TiMidity++ has a similar 584 * good thing to do when vptr <= src. (TiMidity++ has a similar
585 * safe-guard here.) 585 * safe-guard here.)
586 */ 586 */
587 v1 = (vptr > src) ? *(vptr - 1) : 0; 587 v1 = (vptr == src) ? *vptr : *(vptr - 1);
588 v2 = *vptr; 588 v2 = *vptr;
589 v3 = *(vptr + 1); 589 v3 = *(vptr + 1);
590 v4 = *(vptr + 2); 590 v4 = *(vptr + 2);
591 xdiff = FSCALENEG(ofs & FRACTION_MASK, FRACTION_BITS); 591 xdiff = FSCALENEG(ofs & FRACTION_MASK, FRACTION_BITS);
592 *dest++ = (Sint16)(v2 + (xdiff / 6.0) * (-2 * v1 - 3 * v2 + 6 * v3 - v4 + 592 *dest++ = (Sint16)(v2 + (xdiff / 6.0) * (-2 * v1 - 3 * v2 + 6 * v3 - v4 +