LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 992|回复: 0

Arch WiKi 译文:Alsa,XMMS and GAIM

[复制链接]
发表于 2004-11-9 09:14:38 | 显示全部楼层 |阅读模式
Alsa,XMMS and GAIM
如果要使用xmms、gaim或其他程序,那么就需要同时使用dmix。
/etc/asound.conf
如同之前在WiKi页上说的那样,root可以打开/etc/asound.conf(全系统设定)、普通用户可以在自己的home目录中加入 .asound来设置Alsa。

在代码中加入以下几行:
如果你的硬件支持混音(mixing),下面的一个简单的文件应该可以工作
        pcm.dsp0 {
             type hw
             card 0
        }
        ctl.mixer0 {
             type hw
             card 0
        }
        pcm.!default {
             type plug
             slave.pcm "dmix" ## this accesses default settings for dmix
        }

测试一下:
        #aplay <somefile.wav>
测试硬件混音:
        #aplay <somelongfile.wav> &
        #aplay <someotherfile.wav>
你可能同时听到两个文件的声音,或者只听一个。如果是前者,就跳过下一步。
修改/etc/asound.conf(或/.asound),设置软件混音“dmix”:
        pcm.dsp0 { ## This is accessed by oss applications
             type plug
             slave.pcm "dmixer"
        }
        ctl.mixer0 {  ## This ties mixer controls for oss mixer programs
             type hw
             card 0
        }
        pcm.dmixer {  ## This is a softward driven mixer, alsa's 'dmix'
             type dmix
             ipc_key 1024 ## this can be any unique value
             slave {
                  pcm "hw:0,0" ## pointing to your card
                  period_time 0
                  period_size 1024 ## These options are tweakable,
                  buffer_size 4096 ## but use powers of 2 for sizes
                  rate 48000 ## the sample rate
                  periods 518
             }
             bindings {  ## this binds channel 'n's input to channel 'n' output
                  0 0
                  1 1
             }
        }
        pcm.!default { ## The default sound driver, a wrapper for dmixer
             type plug
             slave.pcm "dmixer"
        }
下一步,专门针对gaim用户,以root身份运行:
        #cat > /etc/libao.conf
        default_driver=alsa
        ctrl^D
        #
这样,设置oss程序缺省使用alsa驱动。

设置Xmms:
        Options -> preferences
        选择Alsa output plugin
        点击configure
        将PCM设为你的混音设备 (mixer)
        播放音乐

设置Gaim
        Tools -> Preferences
        选择sound
        选择Automatic
        点击test按钮(你应该能听到声音)

所有的设置(asound.conf, libao.conf, gaim, xmms),不需重启就可以生效,只需要将相关的正在运行的程序关闭,再重新运行了即可。
用XMMS放段MP3,同时也用gaim来一个,测试一下设置。如果是同时播放而不是一首一首地放,那么,你所寻求的混音就设置好了。
一些用户使用arts或esd来支持alsa混音。详细资料可以在Google上搜一搜。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表