Template:RK3399SelectALSAAudioDevice

From FriendlyARM WiKi
Revision as of 07:00, 21 December 2018 by Tzs (Talk | contribs) (updated by API)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

选择系统默认音频设备

如果当前系统存在多个音频设备, 例如HDMI-Audio、3.5mm耳机座、I2S-Codec时, 可以通过下面的操作步骤,设置默认使用的音频设备。

用以下命令查看系统中所有的声卡设备 (注:不同的开发板结果会有所不同):

pi@NanoPi:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: realtekrt5651co [realtek,rt5651-codec], device 0: ff880000.i2s-rt5651-aif1 rt5651-aif1-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: rockchiphdmi [rockchip,hdmi], device 0: ff8a0000.i2s-i2s-hifi i2s-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: ROCKCHIPSPDIF [ROCKCHIP,SPDIF], device 0: ff870000.spdif-dit-hifi dit-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

上面的信息表示realtekrt5651co代表3.5mm耳机座,rockchiphdmi代表HDMI, ROCKCHIPSPDIF代表光纤输出。

要配置成将音频输出到3.5mm耳机接口(对应aplay -l命令结果的card 0),可修改配置文件/etc/asound.conf,修改成如下内容:

defaults.pcm.card 0
defaults.pcm.device 0

要配置成将音频输出到HDMI (对应aplay -l命令结果的card 1),则将上面的defaults.pcm.card修改为1。
有些板子由于没有耳机输出接口,所以HDMI可能是card 0,这个需要以 aplay -l命令的查询结果为准。