src/audio/SDL_audiocvt.c
changeset 10814 938218064f67
parent 10805 30a00d960dc9
child 10817 efc103e60c5b
equal deleted inserted replaced
10813:b93b700393d5 10814:938218064f67
   194 static int
   194 static int
   195 SDL_ResampleAudioSimple(const int chans, const double rate_incr,
   195 SDL_ResampleAudioSimple(const int chans, const double rate_incr,
   196                         float *last_sample, const float *inbuf,
   196                         float *last_sample, const float *inbuf,
   197                         const int inbuflen, float *outbuf, const int outbuflen)
   197                         const int inbuflen, float *outbuf, const int outbuflen)
   198 {
   198 {
   199     const int framelen = chans * sizeof(float);
   199     const int framelen = chans * sizeof (float);
   200     const int total = (inbuflen / framelen);
   200     const int total = (inbuflen / framelen);
   201     const int finalpos = total - chans;
   201     const int finalpos = total - chans;
   202     const double src_incr = 1.0 / rate_incr;
   202     const double src_incr = 1.0 / rate_incr;
   203     double idx = 0.0;
   203     double idx = 0.0;
   204     float *dst = outbuf;
   204     float *dst = outbuf;
   218         }
   218         }
   219         consumed = pos + chans;
   219         consumed = pos + chans;
   220         idx += src_incr;
   220         idx += src_incr;
   221     }
   221     }
   222 
   222 
   223     return (int)((dst - outbuf) * sizeof(float));
   223     return (int) ((dst - outbuf) * sizeof (float));
   224 }
   224 }
   225 
   225 
   226 
   226 
   227 int
   227 int
   228 SDL_ConvertAudio(SDL_AudioCVT * cvt)
   228 SDL_ConvertAudio(SDL_AudioCVT * cvt)