[SDL] Problem with mp3 playback using SDL_mixer and SMPeg.dll

Rhythmic Fistman rfistman at gmail.com
Sat Dec 30 14:47:51 PST 2006


> Message: 6
> From: David Olofson <david at olofson.net>

> On Mac OS Classic and maybe some other platform, the callback runs in
> some kind of interrupt context. The sync functions *might* still
> work, though; not sure about that...

Only if they're nops. It's kinda hard to deschedule an interrupt.

> However, if you just want the simplest possible locking/unlocking, to
> safely mess around with the sound engine data from the main thread,
> you can use the SDL_LockAudio() and SDL_UnlockAudio() calls.

Thank you, that's exactly what I'm looking for.

> Another approach is to use a lock-free FIFO or similar construct to
> pass commands from the main thread to the audio callback. This may be
> a better idea if you send lots of "sound commands" from all over the
> place. (Not sure if abusing the SDL_(Un)LockAudio() calls that way is
> a good idea, though it's *probably* not a problem for "normal use".)

Normal use here, main thread enqueues and sound callback dequeues.




More information about the SDL mailing list