|
HOWTO: Hear multiple sounds at once
This one seems to stump most linux newbies..."Why can't I hear sounds from two applications at once?" This is because your sound card requires something called "software mixing." Thankfully, ALSA provides software mixing, so this shouldn't be very hard.
The first thing to do is install the package libesd-alsa0. Use synaptic, a sudo apt-get install, or whatever. Its available in the Ubuntu repositories.
Then, create the following file using "sudo gedit" or your favorite text editor, and save it as /etc/asound.conf. (Make sure you use sudo, you need root priviledges to do this.)
pcm.card0 {
type hw
card 0
}
pcm.!default {
type plug
slave.pcm "dmixer"
}
pcm.dmixer {
type dmix
ipc_key 1025
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096 #notice
periods 128
rate 44100
}
bindings {
0 0
1 1
}
}
(the above file should work with most sound cards...I've tried it with 3 different ones with success. I can't guarantee it'll work in all cases, though.)
Next, execute a "sudo gedit /etc/esound/esd.conf" and change the file to the following:
[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
default_options=
Next, go to your Sound control panel in Gnome and enable sound server startup. After this, go to your Multimedia Systems Selector control panel and set it to either ALSA or ESD. Then, reboot your computer.
After doing this, you can set any application to use alsa or ESD, and you'll hear multiple sounds at once! No more problems playing games that use ALSA and hearing sounds from a Gnome app that uses ESD...
notice:缓存的大小最好改大一点,不然会“卡”,改成 8192 或者更大,原作者的是4096。
From:http://www.ubuntuforums.org/showthread.php?t=8882 |
|