Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
why cant Alsa sound drivers cant play 2 things at once?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
nejiron
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2004
Posts: 95
Location: U.S.A.

PostPosted: Tue Mar 01, 2005 4:20 pm    Post subject: why cant Alsa sound drivers cant play 2 things at once? Reply with quote

is it because only one thing can gain access to the sound card device at a time and it is not preemptible? Also does it not allow the interleaving of outputs to the sound card?

In my opinion I like it better the way windows does it where it overlaps the sound rather than waiting for one to finish. I am tired of having to hit play again on xmms because I get an instant message that requires the sound driver. (xmms says cant get control of the sound card, and stops playing rather then trying to keep get control)
_________________
I am a traveler of both time and space
Back to top
View user's profile Send private message
adaptr
Watchman
Watchman


Joined: 06 Oct 2002
Posts: 6730
Location: Rotterdam, Netherlands

PostPosted: Tue Mar 01, 2005 5:32 pm    Post subject: Reply with quote

That depends entire on the implementation used by ALSA.

If Windows can do it, you may bet that Linux can do it better - it's not like you suddenly aqcuire magical new hardware capabilities when you stick in a Windows CD...

There are a number of separate issues at work here:
1. does the actual physical sound card support (i.e. have) hardware-based mixing ? this is readily discovered by the presence of terms like "64-channel sound" anywhere in the docs or on the card - that would mean the card itself supports 64 concurrent output streams, which it then mixes itself.
2. If the card supports hardware mixing, is ALSA actually using this ?
3. does the application use ALSA, or does it write directly to the /dev/dsp device ?

The last is probably relevant here - one of the functions of ALSA is to move the playing of sounds from the actual sound device to an abstract layer above it, multiplexing any signals sent to it before sending the final mixed sound output to the dsp device.

Native sound:
Code:
cat /dev/urandom /dev/dsp

(You may want to turn down the volume first...)

ALSA:
Code:
Application 1 -> abstraction layer -> ALSA driver -> /dev/dsp
Application 2 -^
Application 3 -^

I'm no ALSA guru, so I can't guarantee that's exactly how it works, but if it doesn't, then playing simultaneous sounds would be impossible.
_________________
>>> emerge (3 of 7) mcse/70-293 to /
Essential tools: gentoolkit eix profuse screen
Back to top
View user's profile Send private message
z3ro
Apprentice
Apprentice


Joined: 16 Jun 2004
Posts: 261

PostPosted: Tue Mar 01, 2005 5:41 pm    Post subject: Reply with quote

Have a look at the Alsa Project website, and find your soundcard there. It will be under the "SoundCards" option at the top of the page.

Usually there will be a sample ".asoundrc" file there, this is what you need to get the playback of multiple streams working - it uses the dmixer plugin.
Back to top
View user's profile Send private message
curtis119
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 2160
Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.

PostPosted: Tue Mar 01, 2005 5:51 pm    Post subject: Reply with quote

MS uses an abstraction layer called "DirectSound". DirectSound is nothing more than a little server that sits in the background and all audio streams are sent to it. It mixes them together and then sends the result to the sound card for playing. It is the EXACT same thing as Esound or Arts or Jack or dmix(dmix is actually a little different but for your purposes it is the same as the rest). The only difference is that windows programs only have DirectSound to choose from so they all use it by default. In the Linux world you have to choose which software mixer you want to use and then set up all your apps to use it. Or you can setup dmix and just have all the apps use the default alsa device (I find this to be the easiest solution since almost all alsa enabled apps use the default alsa channel by default). The HOWTO on dmix is here:

dmix HOWTO on alsa-project.org

This one should work better though and has more explanation:

dmix HOWTO from debian
_________________
Gentoo: it's like wiping your ass with silk.
Back to top
View user's profile Send private message
nejiron
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2004
Posts: 95
Location: U.S.A.

PostPosted: Wed Mar 02, 2005 12:02 am    Post subject: Reply with quote

got it working, thanks for the help fella's. figured if i brought windows into it id get a speady response :wink:
_________________
I am a traveler of both time and space
Back to top
View user's profile Send private message
wswartzendruber
Veteran
Veteran


Joined: 23 Mar 2004
Posts: 1261
Location: Idaho, USA

PostPosted: Wed Mar 02, 2005 12:07 am    Post subject: Reply with quote

I have a CS46XX and I'm able to send multiple streams into it using a kernel option: "Enable Multiple DSP..."
_________________
Git has obsoleted SVN.
10mm Auto has obsoleted 45 ACP.
Back to top
View user's profile Send private message
curtis119
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 2160
Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.

PostPosted: Wed Mar 02, 2005 12:29 am    Post subject: Reply with quote

wswartzendruber wrote:
I have a CS46XX and I'm able to send multiple streams into it using a kernel option: "Enable Multiple DSP..."


To bad not all soundcards have built in hardware mixers. :cry:
_________________
Gentoo: it's like wiping your ass with silk.
Back to top
View user's profile Send private message
Arainach
l33t
l33t


Joined: 08 Jul 2004
Posts: 609

PostPosted: Wed Mar 02, 2005 12:54 am    Post subject: Reply with quote

This should be in the multimedia forums.

What you're talking about is mixing. Most sound cards have hardware Mixing (For instance, every Sound Blaster since the ancient Sound Blaster 1024 does). For instance, my Audigy2 plays about a billion sounds simultaneously no problem. Onboard soundchips like AC97 often don't. You need software mixing via dmix. Look into it in the Multimedia forum.
_________________
Gentoo: Stage3 w/ NPTL & udev, gcc 3.4.4 full rebuild
Kernel: 2.6.15-gentoo-r1 w/ 1G-Lowmem Patch
System: Athlon XP 2.2Ghz/1GB Corsair Value/160GB, 250GB WD IDE/128MB GeForce 6800/Sony 17" Trinitron G200 @ 1280x1024x75Hz
Back to top
View user's profile Send private message
curtis119
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 2160
Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.

PostPosted: Wed Mar 02, 2005 1:38 am    Post subject: Reply with quote

Arainach wrote:
This should be in the multimedia forums.



I reported this. It should be moved to multimedia soon.
_________________
Gentoo: it's like wiping your ass with silk.
Back to top
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Wed Mar 02, 2005 9:57 am    Post subject: Reply with quote

Moved from OTW.
Back to top
View user's profile Send private message
transient
l33t
l33t


Joined: 13 Jan 2005
Posts: 759

PostPosted: Wed Mar 02, 2005 10:49 am    Post subject: Reply with quote

Even with a chipset having a hardware mixer, its not gonna do anything unless the specs for said mixer are released or someone manages to reverseengineer a solution. Case in point being nForce2 under linux. Supports hardware mixing fine, but as of yet, nVidia are being horribly stingy, so we're limited to either OSS hardware mixing, or using an ALSA plugin such as dmix.
Which to be honest, does almost as good a job. It only requires some more RAM for the IPC stuff.
Back to top
View user's profile Send private message
hvengel
Guru
Guru


Joined: 19 Sep 2004
Posts: 515

PostPosted: Thu Mar 03, 2005 4:29 am    Post subject: Reply with quote

wswartzendruber wrote:
I have a CS46XX and I'm able to send multiple streams into it using a kernel option: "Enable Multiple DSP..."


Where is this at? I just had a look at menuconfig for my 2.6 kernel and I can't find this. Also are your running a 2.4 or a 2.6 kernel?
Back to top
View user's profile Send private message
Epyon
l33t
l33t


Joined: 11 Sep 2003
Posts: 754
Location: NJ, USA

PostPosted: Thu Mar 03, 2005 6:38 am    Post subject: Reply with quote

hvengel wrote:
wswartzendruber wrote:
I have a CS46XX and I'm able to send multiple streams into it using a kernel option: "Enable Multiple DSP..."


Where is this at? I just had a look at menuconfig for my 2.6 kernel and I can't find this. Also are your running a 2.4 or a 2.6 kernel?


Its in device drivers -> sound -> alsa -> pci devices -> Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x -> Cirrus Logic (Sound Fusion) New DSP support (EXPERIMENTAL) (NEW)

It works pretty well. I got rid of my cs46xx card because there wasn't any working 4 speaker output in Linux that I could find.
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Thu Mar 10, 2005 8:52 pm    Post subject: Reply with quote

transient wrote:
Even with a chipset having a hardware mixer, its not gonna do anything unless the specs for said mixer are released or someone manages to reverseengineer a solution. Case in point being nForce2 under linux. Supports hardware mixing fine, but as of yet, nVidia are being horribly stingy, so we're limited to either OSS hardware mixing, or using an ALSA plugin such as dmix.
Which to be honest, does almost as good a job. It only requires some more RAM for the IPC stuff.


Isn't that what nforce-audio is for? *wonders*

I have no idea what it does, and I dont feel like breaking my system just to find out. Well ... yes I do, but I won't. :)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
transient
l33t
l33t


Joined: 13 Jan 2005
Posts: 759

PostPosted: Thu Mar 10, 2005 11:29 pm    Post subject: Reply with quote

The nforce-audio driver only provides hardware mixing under OSS so far.
Hopefully nVidia will get around to providing ALSA hardware mixing too soon..
Back to top
View user's profile Send private message
beandog
Bodhisattva
Bodhisattva


Joined: 04 May 2003
Posts: 2072
Location: /usa/utah

PostPosted: Thu Mar 10, 2005 11:51 pm    Post subject: Reply with quote

Yah, I noticed the "tell nvidia .... " sticky. Right after posting here, of course. :)
_________________
If it ain't broke, tweak it. dvds | blurays | blog | wiki
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum