[linux-audio-dev] alsa mixing

James Courtier-Dutton James at superbug.co.uk
Sat Jan 13 23:15:30 UTC 2007


Milan Mimica wrote:
>
> > 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.
>
> OpenAL can use hardware capabilities of the sound card? Hm, can it do 
> mixing in hardware too? Maybe I just have to check how do they 
> implement it in linux.
>

If "mixing in hardware" is one of the "hardware capabilities", then yes. 
Not all sound cards can do hardware mixing.
If these are ALSA specific questions, then you might do better asking on 
the alsa-user mailing list instead of this one.
ALSA presents a very simple picture regarding hardware mixing.
If the device has more than one sub PCM device, it can do hardware mixing.
/proc/asound/card0/pcm0p
Then "ls" will display the sub devices.
There is an api call to retrieve it as a simple integer, but I don't 
remember the call off hand.
I.e. return 1 for not hardware mixing, and >1 for hardware mixing, with 
the returned integer indicating how many channels can be mixed together 
in hardware.

To do the hardware mixing, one simply opens the alsa device name, e.g. 
"plug:front" multiple times, and the hardware will mix them together.
Do not use the alsa device names starting with hw:   .  These are for 
use internally by alsa-lib, and should not be used by applications.

Is that what you need?

James




More information about the Linux-audio-dev mailing list