changeset 43:093315d84a22

Add a small delay in SDL audio pseudo-loopflush function to avoid tightlooping in prod main loops (explained better in the added comment.)
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 24 May 2010 05:07:33 +0300
parents 423ff2a11018
children ec1bff613ae0
files pwplib/snd-sdl.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pwplib/snd-sdl.c	Mon May 24 03:49:06 2010 +0300
+++ b/pwplib/snd-sdl.c	Mon May 24 05:07:33 2010 +0300
@@ -50,6 +50,15 @@
         pwplib.player();
         SDL_PauseAudio(0);
     }
+    
+    /* NOTICE! A small delay is used here, because the prods using pwplib
+     * run in a tight loop (they expect that audio rendering blocks,
+     * which it doesn't in case of SDL.) This way we avoid consuming
+     * excessive amounts of CPU.
+     *
+     * -- ccr
+     */
+    SDL_Delay(10);
 }
 
 int pwp_sdlaudio_init()