diff libao2/ao_sdl.c @ 12151:75fdb659f5bf

round len to outburst and increment full_buffers at the correct time, patch by Nehal <nehalmistry at gmx.net>
author faust3
date Wed, 07 Apr 2004 17:53:42 +0000
parents 99798c3cdb93
children 56bdb9b7a4bc
line wrap: on
line diff
--- a/libao2/ao_sdl.c	Wed Apr 07 13:00:33 2004 +0000
+++ b/libao2/ao_sdl.c	Wed Apr 07 17:53:42 2004 +0000
@@ -66,12 +66,13 @@
     x=BUFFSIZE-buf_write_pos;
     if(x>len) x=len;
     memcpy(buffer[buf_write]+buf_write_pos,data+len2,x);
+    if (buf_write_pos==0)
+	++full_buffers;
     len2+=x; len-=x;
     buffered_bytes+=x; buf_write_pos+=x;
     if(buf_write_pos>=BUFFSIZE){
        // block is full, find next!
        buf_write=(buf_write+1)%NUM_BUFS;
-       ++full_buffers;
        buf_write_pos=0;
     }
   }
@@ -316,6 +317,7 @@
 // return: number of bytes played
 static int play(void* data,int len,int flags){
 
+	len = (len/ao_data.outburst)*ao_data.outburst;
 #if 0	
 	int ret;