[SDL] Problem with SDL_AddTimer()

Martin Evald radiant at gnarf.org
Mon Feb 17 08:44:00 PST 2003


Hi!

While playing around with the audio functions in SDL, I came to a 
point where I wanted a periodically updated oscillator. Scanned the 
docs, and SDL_AddTimer() seemed to be what I was looking for. However, 
I am experiencing a slight problem: my callback function is never run.

It has the following prototype: Uint32 osc_callback (Uint32, void *);

SDL_AddTimer invocation: timer = SDL_AddTimer (100, osc_callback, osc);

(osc is a pointer to a local struct.)

After calling SDL_AddTimer() I do SDL_Delay (2000), and yet the 
callback function is not entered once. I initialize SDL with SDL_Init 
(SDL_INIT_AUDIO | SDL_INIT_TIMER), and audio callback works, as does 
SDL_Delay(). I am using SDL-1.2.5a-win32 with Dev-C++. 

Any help would be appreciated.





More information about the SDL mailing list