ALSA架构之声卡设备信息

最近项目中遇到了一个蓝牙和语音同时占用一个录音设备的问题。

报错打印如下:
audio_hw_primary: cannot open pcm_cap: cannot open device ‘/dev/snd/pcmC0D0c’: Device or resource busy

在系统中/dev/snd中去查看:

# ls /dev/snd/ -l
total 0
crw-rw---- 1 system audio 116,   0 2019-04-19 17:50 controlC0
crw-rw---- 1 system audio 116,  32 2019-04-19 17:50 controlC1
crw-rw---- 1 system audio 116,  24 2019-04-19 17:50 pcmC0D0c
crw-rw---- 1 system audio 116,  16 2019-04-19 17:50 pcmC0D0p
crw-rw---- 1 system audio 116,  25 2019-04-19 17:50 pcmC0D1c
crw-rw---- 1 system audio 116,  17 2019-04-19 17:50 pcmC0D1p
crw-rw---- 1 system audio 116,  56 2019-04-19 17:50 pcmC1D0c
crw-rw---- 1 system audio 116,  48 2019-04-19 17:50 pcmC1D0p
crw-rw---- 1 system audio 116,  33 2019-04-19 17:50 timer

可以看到所有的声卡设备:
controlC0,声卡控制设备
pcmC0D0c,录音设备
pcmC0D0p,播放设备
timer,时序

C0D0c,表示Card 0 Device 0,即编号0的声卡下的编号0设备,c代表capture,表示录音设备;p代表playback,表示播放设备。

playback:回放能力描述,如回放设备所支持的声道数、采样率、音频格式;
capture:录制能力描述,如录制设备所支持声道数、采样率、音频格式;

tinymix

通过输入tinymix,来查看音频通路相关的各项配置参数:

# tinymix
Mixer name: 'saf775d-audio'
Number of controls: 22
ctl     type    num     name                                     value

0       INT     2       DAC1 Playback Volume                     -1 -1
1       INT     2       DAC2 Playback Volume                     -1 -1
2       INT     2       DAC3 Playback Volume                     -1 -1
3       INT     2       DAC4 Playback Volume                     -1 -1
4       INT     2       ADC1 Capture Volume                      -1 -1
5       INT     2       ADC2 Capture Volume                      -1 -1
6       BOOL    2       DAC1 Invert Switch                       On On
7       BOOL    2       DAC2 Invert Switch                       On On
8       BOOL    2       DAC3 Invert Switch                       On On
9       BOOL    2       DAC4 Invert Switch                       On On
10      BOOL    2       ADC1 Invert Switch                       On On
11      BOOL    2       ADC2 Invert Switch                       On On
12      BOOL    1       ADC High-Pass Filter Switch              On
13      BOOL    1       DAC De-emphasis Switch                   On
14      ENUM    1       ADC1 Single Ended Mode Switch            (null)
15      ENUM    1       ADC2 Single Ended Mode Switch            (null)
16      INT     1       DAC Single Volume Control Switch         -1
17      ENUM    1       DAC Soft Ramp & Zero Cross Control Switch (null)
18      BOOL    1       DAC Auto Mute Switch                     On
19      BOOL    1       Mute ADC Serial Port Switch              On
20      INT     1       ADC Single Volume Control Switch         -1
21      ENUM    1       ADC Soft Ramp & Zero Cross Control Switch (null)

DAC,Digital-to-analog converter,数模转换器
ADC,Analog-to-digital converter,模数转换器

DAC1 Playback Volume,播放音频控制最大值,对应相应的寄存器,可修改最大音量输出电压;
ADC1 Capture Volume,录音音频最大值,,对应相应的寄存器,可修改最大音量输出电压;

上一篇:在bash脚本中设置系统卷(在linux中)


下一篇:ArchLinux声卡安装