changeset 25909:f6a0f861f7e6

Fix get_space calculation to always leave some space, esp. for the currently playing buffer.
author reimar
date Wed, 30 Jan 2008 23:48:48 +0000
parents 7cf1b1c1c44c
children 74db93fee74f
files libao2/ao_openal.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_openal.c	Wed Jan 30 23:39:01 2008 +0000
+++ b/libao2/ao_openal.c	Wed Jan 30 23:48:48 2008 +0000
@@ -201,7 +201,9 @@
   ALint queued;
   unqueue_buffers();
   alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued);
-  return (NUM_BUF - queued) * CHUNK_SIZE * ao_data.channels;
+  queued = NUM_BUF - queued - 3;
+  if (queued < 0) return 0;
+  return queued * CHUNK_SIZE * ao_data.channels;
 }
 
 /**