Mercurial > hg > forks > pwpunix
diff pwplib/snd-sdl.c @ 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 | b9d679965320 |
children | 85671798fdb3 |
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()