src/audio/SDL_audiocvt.c
changeset 11585 9b646e8f4622
parent 11583 c48ab2c208a2
child 11586 f882930f174f
equal deleted inserted replaced
11584:6d17410edb75 11585:9b646e8f4622
   720     float *padding;
   720     float *padding;
   721 
   721 
   722     SDL_assert(format == AUDIO_F32SYS);
   722     SDL_assert(format == AUDIO_F32SYS);
   723 
   723 
   724     /* we keep no streaming state here, so pad with silence on both ends. */
   724     /* we keep no streaming state here, so pad with silence on both ends. */
   725     padding = SDL_stack_alloc(float, paddingsamples);
   725     padding = (float *) SDL_calloc(paddingsamples, sizeof (float));
   726     if (!padding) {
   726     if (!padding) {
   727         SDL_OutOfMemory();
   727         SDL_OutOfMemory();
   728         return;
   728         return;
   729     }
   729     }
   730     SDL_memset(padding, '\0', paddingsamples * sizeof (float));
       
   731 
   730 
   732     cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen);
   731     cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen);
   733 
   732 
   734     SDL_stack_free(padding);
   733     SDL_free(padding);
   735 
   734 
   736     SDL_memcpy(cvt->buf, dst, cvt->len_cvt);  /* !!! FIXME: remove this if we can get the resampler to work in-place again. */
   735     SDL_memcpy(cvt->buf, dst, cvt->len_cvt);  /* !!! FIXME: remove this if we can get the resampler to work in-place again. */
   737 
   736 
   738     if (cvt->filters[++cvt->filter_index]) {
   737     if (cvt->filters[++cvt->filter_index]) {
   739         cvt->filters[cvt->filter_index](cvt, format);
   738         cvt->filters[cvt->filter_index](cvt, format);