Multiple Sound Streams out of a single card
Hey list-
I'm wondering exactly how things work, playing multiple streams of audio out of a single card/chip.
In Windows, I'm able to have WinAmp running in the background and still hear event sounds from other applications.
In Linux, only one thing can play at a time, without the use of high-latency audio servers.
Why is this? I understand some alsa drivers support playing multiple streams.. dependent upon driver support and a certain property of hardware (which I have been told doesn't exist on the nForce, although I've read elsewhere it does... and doesn't exist on any i8x0 based chips).
I only question this because about six months ago I was told, flat out, that the hardware didn't support playing multiple audio streams at once. On one machine, I have an i8x0 chip, and on another an nForce chip (which uses the i8x0 driver). Both play multiple audio streams at once in Windows, but neither seem capable with either OSS or ALSA drivers.
Is this a fundamental difference between Windows and ALSA driver architectures, something the Alsa or OSS people haven't gotten around to yet, a big mystery, or what? Maybe Windows runs some fairly low-latency sound server type setup?
Inquiring minds want to know. :-)
Rob
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 5 lines
In Windows, I'm able to have WinAmp running in the background and still hear event sounds from other applications.
In Linux, only one thing can play at a time, without the use of high-latency audio servers.
not true. ALSA now offers the "dmix" plugin layer that allows multiple applications to write to a PCM device without locks. just tell an ALSA aware app to use "dmix:0" and both it and many other apps will all be able to share the device.
Quoted 4 lines
Is this a fundamental difference between Windows and ALSA driver architectures, something the Alsa or OSS people haven't gotten around to yet, a big mystery, or what? Maybe Windows runs some fairly low-latency sound server type setup?
yes, there is a fundamental difference between Windows various driver architectures and ALSA's. if you had to pick on Windows driver model that ALSA is more similar to, its would probably be ASIO, though ALSA is a lot more flexible. ASIO doesn't allow multiple apps to use the soundcard simultaneously.
and remember that Linux (and Mac OS X) also have JACK, which offers a service that isn't exactly matched on Windows, though rewire comes close, sort of.
--p
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 4 lines · Paul Davis
ALSA now offers the "dmix" plugin layer that allows multiple applications to write to a PCM device without locks. just tell an ALSA aware app to use "dmix:0" and both it and many other apps will all be able to share the device.
Wow, it's good to see something like that. :-)
I just tried it, though, and it didn't seem to want to work for me...
With my .asoundrc looking like this:
pcm.main {
type dmix
slave {
pcm default
}
}I got this, running alsaplayer -d main /path/to/wav/file :
ALSA lib pcm_dmix.c:1184:(_snd_pcm_dmix_open) Unique IPC key is not definedsnd_pcm_open: Invalid argument (main)
Failed to initialize plugin!
Failed to register plugin: /usr/lib/alsaplayer/output/libalsa_out.so Failed to load output plugin "alsa". Trying defaults.
ALSA lib pcm_dmix.c:1184:(_snd_pcm_dmix_open) Unique IPC key is not definedsnd_pcm_open: Invalid argument (main)
Failed to initialize plugin! /usr/lib/alsaplayer/output/libalsa_out.so failed to load
If I run alsaplayer -d dmix:0 /path/to/wav/file, I get this:
ALSA lib pcm.c:1908:(snd_pcm_open_noupdate) Unknown PCM 0 ALSA lib pcm_dmix.c:954:(snd_pcm_dmix_open) unable to open slavesnd_pcm_open: No such file or directory (dmix:0)
Failed to initialize plugin!
Failed to register plugin: /usr/lib/alsaplayer/output/libalsa_out.so Failed to load output plugin "alsa". Trying defaults. ALSA lib pcm.c:1908:(snd_pcm_open_noupdate) Unknown PCM 0 ALSA lib pcm_dmix.c:954:(snd_pcm_dmix_open) unable to open slavesnd_pcm_open: No such file or directory (dmix:0)
Failed to initialize plugin! /usr/lib/alsaplayer/output/libalsa_out.so failed to load
So I see it really isn't working for me.
Quoted 3 lines
and remember that Linux (and Mac OS X) also have JACK, which offers a service that isn't exactly matched on Windows, though rewire comes close, sort of.
I see how the various Linux audio offerings may be superior to what you can do with Windows, in a real professional setup... but for being able to play multiple things at once, unless DMIX pans out, Windows may have us beaten. :-\
Is there a way to force OSS emulation to use the dmix plugin?
:::off to grep the great WWW for dmix info:::
Rob
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 1 line · AthlonRob
I just tried it, though, and it didn't seem to want to work for me...
Well, I got it working. Alsaplayer doesn't like playing output to alsa, so I switched to aplay, and fixed my .asoundrc so as to define an IPC (123? what's up with the IPC?) and to define a slave (hw:0,0). I was then able to use aplay to play multiple things at once. Yeah! :-)
XMMS crashes and burns when I tell it to use 'main' in the alsa plugin ... I'll have to google about for that, I suppose. Or figure out if I can get mpg123 to play to alsa.
I'd still like to hear, though, if it is possible to get OSS emulation to use the dmix plugin...
Rob
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 2 lines · AthlonRob
I'd still like to hear, though, if it is possible to get OSS emulation to use the dmix plugin...
unfortunately because oss is a kernel only thing, it all goes through the kernel and so only uses hw (because plughw and all the other stuff is userspace).
The way to do it would be to write an oss driver (or alsa driver and use oss emulation) that simply passes playback to user space where you feed it into dmix or whatever. But hopefully all tools will support alsa soon.
Justin
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Quoted 2 lines · AthlonRob
I'd still like to hear, though, if it is possible to get OSS emulation to use the dmix plugin...
In theory, you can define a pcm named "dsp0" in your .asoundrc and start your OSS program with the aoss script from the OSS compatibility package (see the ALSA homepage).
HTH
Clemens
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf