Sdl_mixer Delays


Dr_Ian

Still Fresh
Joined
Sep 18, 2006
Messages
91
Hi,

I have compiled my game for the gp2x using SDL and SDL_mixer. I have Mk2/firmware 2.0. I use paeryn's hw sdl libs and have tried various different versions of SDL_mixer, all of which have the same issue. The sound effects I am using are uncompressed wavs and are loaded in to memory before being used.

All the sound effects I play are extremely lagged, and lag is directly proportional to the size of the buffer used when starting SDL_mixer. For 4096, the lag is about 5-10 seconds. 1024 buffer gives reasonable results, less than a second between the call to the sound effect and the sound happening. Only really small values like 32 cause the sound to seem in syncronisation with the game.

Ogg decoding also acts very unusually. It eats up the CPU power a bit and plays quite wrong (as if the cpu can't handle it), but if you also play a sound effect, during and for a few second afters it plays perfectly but hogs the CPU totally. It's as if calling the sound effect brings the mixer thread in to priority for a while.

Any suggestions would be appreciated.
Thanks,

Dr_Ian
 
This is what I generally use:
Code:
Mix_OpenAudio(22050, AUDIO_S16SYS, 1, 512)

OGG Decoding is fine for me, I go from 55fps to around 40fps during realtime decoding from memory.
 
Code:
Mix_OpenAudio(22050, AUDIO_S16SYS, 1, 512)

This works just fine for me for sound effects, but for ogg/mp3 decoding I'm seeing a drop from 50fps to less than 10.
 
MP3 WILL be slow since the standard lib that is used is smpeg and is all floating point. It shouldn't be the case with ogg playback though.
 
I use 128, 256, or 512. Also, try reducing the bit rate of the OGG file, that helps as far as I have seen. Also use wav files of the same type. eg. 16 bit mono unsigned. I believe this helps with the mixing process. There must be an associated overhead of converting from 16 bit to 8 bit or vice versa depending on what's already playing.
 
Back
Top