[linux-audio-dev] alsa mixing

James Courtier-Dutton James at superbug.co.uk
Sat Jan 13 04:20:34 UTC 2007

Milan Mimica wrote:
> Hello!
> We're designing a new sound subsystem for allegro game programming 
> library, and we would like to take advantages of multiple hardware 
> voice capabilities.
> On linux, ALSA is the only software that possibly could expose API for 
> such a capability, is that right? It is possible to open multiple PCM 
> outputs and play sound at the same time on all of them. The problem is 
> that we miss some basic mixing features, like panning a mono sound on 
> multichannel output for example. A similar feature is implemented as 
> 'route' ALSA plug-in that can be specified in .asoundrc file, but it 
> is not flexible enough.
> So the question is, does ALSA provide such functionality? If not, 
> which library could? Is it possible that linux OS doesn't provide any 
> API to take advantage of such hardware capabilities?
For games programming, I suggest you use the OpenAL API.
OpenAL will use the hardware capabilities of the sound card, if present, 
leaving the game to not worry if the work is done in hardware or software.

One extra suggestion I would make is to make sure the game uses 48kHz 
audio, and not 44.1kHz audio, as not many sound cards support 44.1kHz in 
hardware, resulting is CPU intensive resampling.

If I missunderstood what you are doing, and you instead wish to 
implement your own OpenAL type API, then you can ask alsa-lib to tell 
you how many channels the hardware can mix together.


More information about the Linux-audio-dev mailing list