我有以下 asound.conf 文件,但是当我播放 $ seller-test 时它失败了。你怎么能告诉asound.conf每次电脑重新启动时也只使用这个声卡?
"card 2: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1"??
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
ALSA lib conf.c:1220:(parse_def) default is not a compound
ALSA lib conf.c:1686:(snd_config_load1) _toplevel_:2:13:Invalid argument
ALSA lib conf.c:3406:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
card 1: Device [C-Media USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
$ cat /etc/asound.conf
pcm.default {
type hw # Kernel PCM
card 2
device 0 # Device number (default 0)
#[subdevice] INT # Subdevice number, -1 first available (default -1)
#mmap_emulation BOOL # enable mmap emulation for ro/wo devices
}
pcm.!default {
type hw # Kernel PCM
card 2
device 0 # Device number (default 0)
#[subdevice] INT # Subdevice number, -1 first available (default -1)
#mmap_emulation BOOL # enable mmap emulation for ro/wo devices
}
我尝试过它可以工作,但如何避免使用 hw:2,0 但使用一些静态字符串,以便在重新启动时它不会丢失?
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "hw:0,1"
}
}
答案1
要仅更改默认卡,请将其替换asound.conf
为:
defaults.pcm.card 2
defaults.pcm.device 0
要独立于更改卡号,请改用卡 ID:
defaults.pcm.card PCH
defaults.pcm.device 0