src/audio/SDL_audiotypecvt.c
changeset 10708 f6cd81aab88e
parent 10608 8661c956c368
child 10711 838b7f845f84
     1.1 --- a/src/audio/SDL_audiotypecvt.c	Fri Dec 16 22:58:32 2016 +0100
     1.2 +++ b/src/audio/SDL_audiotypecvt.c	Sat Dec 17 16:15:24 2016 -0500
     1.3 @@ -222,8 +222,8 @@
     1.4      const int srcsize = cvt->len_cvt - (64 * channels);
     1.5      const int dstsize = (int) (((double)(cvt->len_cvt/(channels*4))) * cvt->rate_incr) * (channels*4);
     1.6      register int eps = 0;
     1.7 -    float *dst = ((float *) (cvt->buf + dstsize)) - 8;
     1.8 -    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8;
     1.9 +    float *dst = ((float *) (cvt->buf + dstsize)) - channels;
    1.10 +    const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - channels;
    1.11      const float *target = ((const float *) cvt->buf);
    1.12      const size_t cpy = sizeof (float) * channels;
    1.13      float last_sample[8];
    1.14 @@ -241,10 +241,10 @@
    1.15  
    1.16      while (dst > target) {
    1.17          SDL_memcpy(dst, sample, cpy);
    1.18 -        dst -= 8;
    1.19 +        dst -= channels;
    1.20          eps += srcsize;
    1.21          if ((eps << 1) >= dstsize) {
    1.22 -            src -= 8;
    1.23 +            src -= channels;
    1.24              for (i = 0; i < channels; i++) {
    1.25                  sample[i] = (float) ((((double) src[i]) + ((double) last_sample[i])) * 0.5);
    1.26              }