SDL_mixer problems

dm488 at bard.edu wrote:

Hi all. First time posting here. Got a problem and wondered if you could help.
I’m writing a Mac OS X game using SDL_mixer for sound, and it seems that I must be using the
library wrong.

Here’s the download site (it’s a work in progress): http://student.bard.edu/~dm488/Asteron.dmg

You may notice in the game if you fire steadily at a certain rate, the laser sound sometimes gets
played twice for a single shot. Why does this happen? I call the function only one time per
keydown event.

The tutorials I’ve found on SDL_mixer have only demonstrated how to play a sound repeatedly
when a key is pressed (which is of course not what the laser gun requires; it fires one shot at a
time).

However, the engine thrust sound DOES need a looping sample. That works fine except for when
the thrust key is released, whereupon you hear a noisy click from the sound stopping. In no
tutorials or documentation for SDL_mixer (the SDL_mixer docs and Roger Ostrander’s SDL_Mixer
Tutorial specifically) have I found a way to stop a looping sound without causing a click.

There is a FadeOut function, but it seems mainly geared toward slow fades (3 seconds or so), and
even using that you still hear clicks. Is there any way to gracefully silence a looping sound? Am I
just doing it wrong?

Many thanks for any help.

-Duncan Malashock

P.S. If you can’t answer these questions without some source code, I’ll be happy to provide it.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

i also have problems with sdl_mixer.
whenever a sound stops you here a noise.
maybe we both got a wrong buffer size.