Mercurial > SDL_sound_CoreAudio
diff playsound/playsound.c @ 144:195c96fa355a
Fix for properly streaming from the overflow buffer.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Wed, 17 Oct 2001 06:51:29 +0000 |
parents | e3f4767d6037 |
children | 023c3e7f028b |
line wrap: on
line diff
--- a/playsound/playsound.c Mon Oct 15 21:21:11 2001 +0000 +++ b/playsound/playsound.c Wed Oct 17 06:51:29 2001 +0000 @@ -90,6 +90,7 @@ static void audio_callback(void *userdata, Uint8 *stream, int len) { static Uint8 overflow[16384]; /* this is a hack. */ + static Uint8 *overflow_ptr; static int overflowBytes = 0; Sound_Sample *sample = (Sound_Sample *) userdata; int bw = 0; /* bytes written to stream*/ @@ -98,7 +99,8 @@ if (overflowBytes > 0) { bw = (overflowBytes < len) ? overflowBytes : len; - memcpy(stream, overflow, bw); + memcpy(stream, overflow_ptr, bw); + overflow_ptr += bw; overflowBytes -= bw; } /* if */ @@ -113,6 +115,7 @@ memcpy(overflow, ((Uint8 *) sample->buffer) + (rc - overflowBytes), overflowBytes); + overflow_ptr = overflow; rc -= overflowBytes; } /* if */