Squall
Squall

Reputation: 4472

How to output multiple sounds with SDL?

I have a library to decode some audio data into PCM and it works fine with Alsa.

I chose SDL to abstract the audio output because SDL is platform-independent. I rewrote it to use SDL to output the audio and it works. However, I want to output multiple sounds simultaneously and SDL only supports one sound per time.

What should I do?

I can use other audio library if it is free, lightweight and supports Linux, Windows XP and Android 2.3.

EDIT: Instead of decoding the entire audio data and filling the audio buffer, I have to fill the buffer partially on each iteration. Loops or callback functions are the solution to fill the next audio frame to play.

Upvotes: 0

Views: 2343

Answers (1)

Topological Sort
Topological Sort

Reputation: 2866

SDL_Mixer is the way to go if you're using SDL. It can play multiple sounds at a time, although only one music.

You can download SDL_Mixer, and get documentation, at http://www.libsdl.org/projects/SDL_mixer/ (or google SDL_Mixer).

Upvotes: 3

Related Questions