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
No related branches found
No related tags found
No related merge requests found
...@@ -196,12 +196,12 @@ void sdl_fillbuf(void *userdata, Uint8 *stream, int len) ...@@ -196,12 +196,12 @@ void sdl_fillbuf(void *userdata, Uint8 *stream, int len)
int copylen=len; int copylen=len;
int maxlen=sdl_audio_buf_len-sdl_audio_buf_pos; int maxlen=sdl_audio_buf_len-sdl_audio_buf_pos;
/* Fill with silence */
memset(stream, spec.silence, len);
/* Copy in the current buffer */ /* Copy in the current buffer */
if(copylen>maxlen) if(copylen>maxlen)
copylen=maxlen; copylen=maxlen;
/* Fill with silence */
if(len>copylen)
memset(stream+copylen, spec.silence, len-copylen);
if(copylen) { if(copylen) {
memcpy(stream, swave+sdl_audio_buf_pos, copylen); memcpy(stream, swave+sdl_audio_buf_pos, copylen);
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