Advanced Linux Sound Architecture (简体中文)

From ArchWiki
Revision as of 07:08, 27 December 2005 by Wd (talk | contribs)
Jump to navigation Jump to search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

这篇文章将讲述如何使Alsa在2.4和2.6内核中正常使用。同时请参考allow multiple programs to play sound at once

本文基于Arjan Timmerman的Alsa设置指南: http://www.soulfly.nl/~arjan/archlinux/alsa-setup.html 其他附加消息: http://bbs.archlinux.org/viewtopic.php?t=2544 如果你使用的是配置了Creative Labs Sound Blaster Live! card声卡的Dell电脑,你需要手动编译ALSA。

安装

  • 2.4和2.6内核都需要做的:
 # pacman -Sy alsa-lib alsa-utils


  • 只需要2.4内核做的:
 # pacman -S alsa-driver
 # depmod -a


  • 推荐但不是必须的操作:
 # pacman -S alsa-oss

需要注意的是,“alsa-driver"包包括了基于Arch官方内核所需要的模块。如果你使用的是自己编译的2.4内核,它在大多数情况下都不能正常使用,你需要在自己编译的内核中通过ABS自己编译一份新的“alsa-driver"包,然后安装新编译的包。

配置

注意:如果hotplug正确的检测到了你的声卡,你就不需要手动加载声卡模块了。如果是那样,你只需要按照第3步(和第4步)进行操作。如果你不确定你的声卡是不是被正确加载,使用root用户输入“lsmod”命令,(如果正确加载)你将看到已经加载了一些名称为“snd-“开头的模块。

  • 到来查找你的声卡。声卡模块通常使用“snd-"作前缀(例如: 'snd-via82xx'). Optionally, run 'alsaconf' as root.
  • 加载模块:
 # modprobe snd-NAME-OF-MODULE
 # modprobe snd-pcm-oss


  • 设置音量
 # amixer set Master 75 unmute
 # amixer set PCM 75 unmute


或者也可以使用图形界面来设置,使用“alsamixer”命令
需要注意的是,当使用“alsamixer”命令的时候,在提高音量的时候确定要去掉“静音”(按M)。


  • 通过系统中存在的音频文件测试一下:
 # aplay mywav.wav


  • 在 '/etc/rc.conf' 的MODULES行中添加snd-pcm-oss 和 'snd-NAME-OF-MODULE'。

Still Getting No Sound?

Even though your drivers are installed correctly, and your volume is right, and nothing is muted, you might not hear anything! Adding the following line to /etc/modprobe.conf fixes this problem (with the via82xx driver, at least).

options snd-NAME-OF-MODULE ac97_quirk=0


Setup Permissions

  • Add your user to the audio group:
 # gpasswd -a USERNAME audio


  • Log your user out and back in to ensure the audio group is loaded.

Restore Alsa Mixer settings at Startup

  • Run 'alsactl' once to create '/etc/asound.state'
 alsactl store


  • Edit '/etc/rc.conf' and add 'alsa' to the list of daemons to start on bootup


Getting SPDIF output

  • (from gralves from the gentoo forums)
  • In Gnome Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.
  • If you don't have Gnome Volume Control installed,
    • Edit /etc/asound.state. This file is where alsasound store your mixer settings.
    • Find a line that says : 'IEC958 Playback Switch'. Near it you will find a line saying value:false. Change it to value:true
    • Now find this line: 'IEC958 Playback AC97-SPSA' and change value to 0.
    • Restart alsa.


KDE settings

  • Start up KDE:
 # startx


  • Setup the volumes as you want them for this user (each user has their own settings):
 # alsamixer


  • KDE 3.3 Go to the K Menu > Multimedia > KMix
    • Choose Settings > Configure KMix...
    • Un-check the option "Restore volumes on logon"
    • Press OK, and you should be all set. Now your volumes will be the same from the command line or within KDE.