Ubuntu

asound.conf 文件已損壞不允許使用正確的音效卡播放,因此一直失敗

  • June 5, 2013

我有這個以下 asound.conf 文件,但是當我播放 $ speaker-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"
        }
}

要更改預設卡,請將其替換asound.conf為:

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

要獨立於更改卡號,請改用卡 ID:

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

引用自:https://unix.stackexchange.com/questions/78362