# HG changeset patch # User Ryan C. Gordon # Date 1003301489 0 # Node ID 195c96fa355a1f0c83f6d3899f0bd607635a69c1 # Parent 3e60862fbd7655b82819d69a52f7bf186c7a4971 Fix for properly streaming from the overflow buffer. diff -r 3e60862fbd76 -r 195c96fa355a playsound/playsound.c --- 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 */