Skip to content
Snippets Groups Projects
Commit 75caab4c authored by deuce's avatar deuce
Browse files

Optimize the buffer fill routine a bit.

parent 9a72eb8e
Branches
Tags
No related merge requests found
......@@ -196,12 +196,12 @@ void sdl_fillbuf(void *userdata, Uint8 *stream, int len)
int copylen=len;
int maxlen=sdl_audio_buf_len-sdl_audio_buf_pos;
/* Fill with silence */
memset(stream, spec.silence, len);
/* Copy in the current buffer */
if(copylen>maxlen)
copylen=maxlen;
/* Fill with silence */
if(len>copylen)
memset(stream+copylen, spec.silence, len-copylen);
if(copylen) {
memcpy(stream, swave+sdl_audio_buf_pos, copylen);
sdl_audio_buf_pos+=copylen;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment