[SDL] SDL_mixer question

Ryan C. Gordon icculus at icculus.org
Thu Jan 4 17:38:51 PST 2007


> Q1)
> Does that mean I can only have 1 "music" playing at any one time?

Yes.

If I had a time machine, I'd go back and beg someone to call this 
'channel' something other than "music" ... maybe "streamed".

> Assuming I have my background music playing...say I need to play some 
> SFX at the same time...
> Is this done using the Mix_LoadWAV and then the Channel family of 
> functions (i.e. Mix_AllocateChannels, Mix_PlayChannel, etc.)?

Yes. The other channels are things that can be trivially decoded into an 
uncompressed PCM waveform all at once, like a small .wav file for a 
gunshot sound.

> I'm guessing to start off with I don't need to worry about effects, right?
> I can just use the build-in processors for now (if needed).

Effects can be totally avoided unless you want to do something hardcore 
and complex...they require you not only to operate on the waveform 
directly, but handle every strange case of data format and channel count 
and frequency. Avoid this API unless you have a desperate need and 
really know what you're doing at a lowlevel.

There are a few built-in effects that might be useful to you, and almost 
everything else you need is just mixing some explosions with a 
soundtrack as you go (which can be done with the basic SDL_mixer APIs, 
completely ignoring the effects stuff).

--ryan.





More information about the SDL mailing list