SDL Timer functions? and more sound questions

Hi there…
Maybe I missed something, but is there any support for doing stuff like
getting the time of day in milliseconds, having a callback called every
x milliseconds, and so on? This is something which differs markedly from
platform to platform (gettimeofday; timeGetTime; and so on), so surely
it’s worthy of inclusion in a cross-platform multimedia library…?

re: sound…

Ok, so I’m trying to mix two sounds to play via a callback. When the
callback comes, I mix my sounds, then I
a) write them to the ‘sound’ buffer or the ‘lookahead’ buffer?
b) what format are stereo samples stored in? A B A B A B (channels A and
B) or A A A A B B B B (all the A samples, then all the B samples)?

:slight_smile:
Peter

Hi there…
Maybe I missed something, but is there any support for doing stuff like
getting the time of day in milliseconds, having a callback called every
x milliseconds, and so on? This is something which differs markedly from
platform to platform (gettimeofday; timeGetTime; and so on), so surely
it’s worthy of inclusion in a cross-platform multimedia library…?

Yup. Check out the functions in SDL_timer.h

Ok, so I’m trying to mix two sounds to play via a callback. When the
callback comes, I mix my sounds, then I
a) write them to the ‘sound’ buffer or the ‘lookahead’ buffer?

Write them to the sound buffer. If you’re being really fancy and can account
for variations in CPU load, you can use the lookahead buffer. I currently
don’t use it, and may drop it in future versions.

b) what format are stereo samples stored in? A B A B A B (channels A and
B) or A A A A B B B B (all the A samples, then all the B samples)?

A B A B A B

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/