Download Media Create Donate Forums

2010/05/19

Footsteps

I added footstep sound effects to OSARE (look at the Google Code link for the bleeding edge stuff). The game's animations are frame-based not millisecond-based so everything slows down when framerate drops; thus I need to play a new footstep noise every time (I can't just put it on a timed loop).

Oddly, SDL_mixer was having trouble playing sounds this rapidly (2.5 steps per second when running, it would simply skip playing some steps). I toyed with settings until something worked. On the initialization call Mix_OpenAudio(), I changed the last argument from 4096 to 1024 and it made a difference. It seems to work now in OSX and XP. But I don't know why changing the audio buffer there makes a difference.

I started having the same problem when adding new sound effects, even with the buffer at 1024. I found that reducing their quality (stereo to mono, 44k to 22k) helps. I'm not an audiophile so maybe I'm doing this the wrong way.