The field ipc_gid must be a valid group (create group audio)

你好!这里是风筝的博客,

欢迎和我一起交流。


在淘宝上买了一个usb声卡,移植好一些库后使用aplay命令播放音乐,发现:

ALSA lib pcm_direct.c:1654:(snd1_pcm_direct_parse_open_conf) The field ipc_gid must be a valid group (create group audio)
aplay: main:722: audio open error: Invalid argument

这样的错误是由于没有组用户,我们做如下操作即可:
vi /etc/group
admin:x:0:admin
audio:x:0:audio
anonymous:x:500:anonymous
保存退出即可。

还有一个是设置音量大小的:
cat /proc/asound/cards
可以查看是哪个声卡,这里我用的是声卡0

amixer -c 0 controls
可以查看有哪些控件,-c 0代表的就是声卡0
得到:
numid=5,iface=MIXER,name=’Headphone Playback Switch’
numid=6,iface=MIXER,name=’Headphone Playback Volume’
numid=3,iface=MIXER,name=’Mic Playback Switch’
numid=4,iface=MIXER,name=’Mic Playback Volume’
numid=7,iface=MIXER,name=’Mic Capture Switch’
numid=8,iface=MIXER,name=’Mic Capture Volume’
numid=9,iface=MIXER,name=’Auto Gain Control’
numid=2,iface=PCM,name=’Capture Channel Map’
numid=1,iface=PCM,name=’Playback Channel Map’

amixer -c 0 contents
可以看控件里的内容

这样我们就可以设置音量:
amixer cset numid=6 30,30
因为音量对应的索引号就是6,这样左右音量就会变成30了。

如果乱写索引的话,就会出现:
amixer: Cannot find the given element from control default

当然,这样比较麻烦,cset还得指定索引号,设备名,混音器类型
sset只需要指定设备名就行了:
amixer scontrols
得到:
Simple mixer control ‘Headphone’,0
Simple mixer control ‘Mic’,0
Simple mixer control ‘Auto Gain Control’,0

这里我们控制Headphone就是我们的耳机了:
amixer sset Headphone 10
这样就直接设置音量为10了

参考自:http://imgtec.eetrend.com/blog/3975
https://www.linuxquestions.org/questions/linux-hardware-18/can%27t-use-microphone-635428/

猜你喜欢

转载自blog.csdn.net/guet_kite/article/details/80396546