src/audio/SDL_audiocvt.c
changeset 11595 091789122901
parent 11594 61c151bcd76a
child 11596 9d8ea0382c52
     1.1 --- a/src/audio/SDL_audiocvt.c	Wed Oct 11 11:43:35 2017 -0400
     1.2 +++ b/src/audio/SDL_audiocvt.c	Wed Oct 11 11:51:14 2017 -0400
     1.3 @@ -485,8 +485,8 @@
     1.4                          float *outbuf, const int outbuflen)
     1.5  {
     1.6      const double finrate = (double) inrate;
     1.7 -    const float outtimeincr = 1.0f / ((float) outrate);
     1.8 -    const float ratio = ((float) outrate) / ((float) inrate);
     1.9 +    const double outtimeincr = 1.0 / ((float) outrate);
    1.10 +    const double  ratio = ((float) outrate) / ((float) inrate);
    1.11      const int paddinglen = ResamplerPadding(inrate, outrate);
    1.12      const int framelen = chans * (int)sizeof (float);
    1.13      const int inframes = inbuflen / framelen;
    1.14 @@ -494,16 +494,16 @@
    1.15      const int maxoutframes = outbuflen / framelen;
    1.16      const int outframes = SDL_min(wantedoutframes, maxoutframes);
    1.17      float *dst = outbuf;
    1.18 -    float outtime = 0.0f;
    1.19 +    double outtime = 0.0;
    1.20      int i, j, chan;
    1.21  
    1.22      for (i = 0; i < outframes; i++) {
    1.23          const int srcindex = (int) (outtime * inrate);
    1.24 -        const float intime = ((float) srcindex) / finrate;
    1.25 -        const float innexttime = ((float) (srcindex + 1)) / finrate;
    1.26 -        const float interpolation1 = SDL_max(0.0f, 1.0f - (innexttime - outtime) / (innexttime - intime));
    1.27 +        const double intime = ((double) srcindex) / finrate;
    1.28 +        const double innexttime = ((double) (srcindex + 1)) / finrate;
    1.29 +        const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime));
    1.30          const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING);
    1.31 -        const float interpolation2 = SDL_max(0.0f, 1.0f - interpolation1);
    1.32 +        const double interpolation2 = 1.0 - interpolation1;
    1.33          const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING);
    1.34  
    1.35          for (chan = 0; chan < chans; chan++) {