comparison 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
comparison
equal deleted inserted replaced
42:423ff2a11018 43:093315d84a22
48 pwp_sdlaudio_curr = pwp_sdlaudio_frag; 48 pwp_sdlaudio_curr = pwp_sdlaudio_frag;
49 pwp_sdlaudio_run = 0; 49 pwp_sdlaudio_run = 0;
50 pwplib.player(); 50 pwplib.player();
51 SDL_PauseAudio(0); 51 SDL_PauseAudio(0);
52 } 52 }
53
54 /* NOTICE! A small delay is used here, because the prods using pwplib
55 * run in a tight loop (they expect that audio rendering blocks,
56 * which it doesn't in case of SDL.) This way we avoid consuming
57 * excessive amounts of CPU.
58 *
59 * -- ccr
60 */
61 SDL_Delay(10);
53 } 62 }
54 63
55 int pwp_sdlaudio_init() 64 int pwp_sdlaudio_init()
56 { 65 {
57 SDL_AudioSpec fmt; 66 SDL_AudioSpec fmt;