src/audio/SDL_audiocvt.c
changeset 10830 92013fad89d1
parent 10817 efc103e60c5b
child 10831 fcbb4d7f2344
equal deleted inserted replaced
10829:79e882826ed4 10830:92013fad89d1
   207     int i;
   207     int i;
   208 
   208 
   209     SDL_assert((dest_samples * framelen) <= outbuflen);
   209     SDL_assert((dest_samples * framelen) <= outbuflen);
   210     SDL_assert((inbuflen % framelen) == 0);
   210     SDL_assert((inbuflen % framelen) == 0);
   211 
   211 
   212     while(dst < target) {
   212     while (dst < target) {
   213         const int pos = ((int)idx) * chans;
   213         const int pos = ((int)idx) * chans;
   214         const float *src = &inbuf[(pos >= finalpos) ? finalpos : pos];
   214         const float *src = &inbuf[pos];
       
   215         SDL_assert(pos <= finalpos);
   215         for (i = 0; i < chans; i++) {
   216         for (i = 0; i < chans; i++) {
   216             const float val = *(src++);
   217             const float val = *(src++);
   217             *(dst++) = (val + last_sample[i]) * 0.5f;
   218             *(dst++) = (val + last_sample[i]) * 0.5f;
   218             last_sample[i] = val;
   219             last_sample[i] = val;
   219         }
   220         }