mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-07 15:10:49 +00:00
resampler: correctly save off left padding.
I don't know if we ever actually hit this in practice, but if this isn't replacing the whole buffer, it needs to slide the end of the existing padding over to the start before adding in the new data.
This commit is contained in:
parent
1a15d506a6
commit
357bc8ca5c
1 changed files with 3 additions and 0 deletions
|
|
@ -1063,6 +1063,9 @@ static int SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf,
|
|||
retval = SDL_ResampleAudio(chans, inrate, outrate, lpadding, rpadding, inbuf, inbuflen, outbuf, outbuflen);
|
||||
|
||||
/* update our left padding with end of current input, for next run. */
|
||||
if (cpy < paddingbytes) { /* slide end of the padding buffer to the start if we aren't replacing the whole thing. */
|
||||
SDL_memmove(lpadding, lpadding + (cpy / sizeof (float)), paddingbytes - cpy);
|
||||
}
|
||||
SDL_memcpy((lpadding + paddingsamples) - (cpy / sizeof(float)), inbufend - cpy, cpy);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue