[SDL] Using SDL/SDL_mixer for simple stereo-placement of sounds

David Olofson david at olofson.net
Sun Oct 20 15:40:50 PDT 2013

On Mon, Oct 21, 2013 at 12:03 AM, mattbentley <mattreecebentley at gmail.com>wrote:

> Thanks David, could you describe this approach more? I mean, how would
> this approach apply in the framework of sdl_mixer?
> I would assume that channels that aren't being played back on are
> inherently not mixed anyway?

What you do is separate the API from the physical voices, so that the
application can deal with virtual voices without worrying about when and
how actual audio mixing is performed. When CPU or physical voice count
limits are hit, the engine decides which virtual voices are most important
and wires only those to physical voices.

What you could do on the application side is to simply not start sounds
that are too quiet. More sophisticated approaches (tracking playback
position of silent voices, reevaluating, bringing silent voices back in
etc) really belong on the engine side. I'm not sure if any non-commercial
engine does this. It's pretty hairy stuff to get right - and unnecessary,
unless you're going to throw every sound source of an AAA 3D level in there
and have the engine sort it out automatically. A modern PC will happily mix
hundreds voices on a single CPU core, so you may want to investigate if
there actually is any problem whatsoever before diving into tricky

//David Olofson - Consultant, Developer, Artist, Open Source Advocate

.--- Games, examples, libraries, scripting, sound, music, graphics ---.
|   http://consulting.olofson.net          http://olofsonarcade.com   |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20131021/6648b959/attachment-0009.htm>

More information about the SDL mailing list