asound.conf is different between 2mic and 4mic

This commit is contained in:
Baozhu Zuo 2017-10-18 15:51:54 +08:00
parent 9e6b2472e3
commit 3fed3fdc8a
4 changed files with 51 additions and 18 deletions

View file

@ -1,11 +1,11 @@
# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one
# pcm.!default {
# type asym
# playback.pcm "playback"
# capture.pcm "capture"
# }
pcm.!default {
type asym
playback.pcm "playback"
capture.pcm "capture"
}
pcm.playback {
type plug
@ -32,8 +32,3 @@ pcm.array {
ipc_key 666666
}
pcm.ac108 {
type ac108
slavepcm "hw:1,0"
channels 4
}

27
asound_4mic.conf Normal file
View file

@ -0,0 +1,27 @@
# The IPC key of dmix or dsnoop plugin must be unique
# If 555555 or 666666 is used by other processes, use another one
pcm.!default {
type asym
playback.pcm "playback"
capture.pcm "ac108"
}
pcm.playback {
type plug
slave.pcm "dmixed"
}
pcm.dmixed {
type dmix
slave.pcm "hw:0,0"
ipc_key 555555
}
pcm.ac108 {
type ac108
slavepcm "hw:1,0"
channels 4
}

View file

@ -56,7 +56,6 @@ if [ ! -f "/boot/overlays/seeed-4mic-voicecard.dtbo" ] && [ ! -f "/lib/modules/$
cp seeed-2mic-voicecard.dtbo /boot/overlays
cp seeed-4mic-voicecard.dtbo /boot/overlays
cp ac108_plugin/libasound_module_pcm_ac108.so /usr/lib/arm-linux-gnueabihf/alsa-lib/
cp asound.conf /etc/
else
echo "card driver already installed"
fi
@ -80,6 +79,7 @@ case "${card}" in
"2mic")
echo "cp wm8960_asound.state /var/lib/alsa/asound.state"
cp wm8960_asound.state /var/lib/alsa/asound.state
cp asound_2mic.conf /etc/asound.conf
if [ "x${has_4mic}" != x ] ; then
echo "has 4mic before, now remove it"
sed -i "s/dtoverlay=seeed-4mic-voicecard//g" /boot/config.txt
@ -91,6 +91,7 @@ case "${card}" in
"4mic")
echo "cp ac108_asound.state /var/lib/alsa/asound.state"
cp ac108_asound.state /var/lib/alsa/asound.state
cp asound_4mic.conf /etc/asound.conf
if [ "x${has_2mic}" != x ] ; then
echo "has 2mic before, now remove it"
sed -i "s/dtoverlay=seeed-2mic-voicecard//g" /boot/config.txt

View file

@ -43,6 +43,11 @@ if [ x${card} = "x2mic" ] ; then
echo "remove wm8960_asound.state"
rm /var/lib/alsa/asound.state
fi
if [ -f /etc/asound.conf ] ; then
echo "remove asound_2mic.conf"
rm /etc/asound.conf
fi
fi
if [ x${card} = "x4mic" ] ; then
@ -50,13 +55,13 @@ if [ x${card} = "x4mic" ] ; then
sed -i "s/dtoverlay=seeed-4mic-voicecard//g" /boot/config.txt
if [ -f /boot/overlays/seeed-4mic-voicecard.dtbo ] ; then
echo "remove seeed-4mic-voicecard.dtbo in /boot/overlays"
rm /boot/overlays/seeed-4mic-voicecard.dtbo
echo "remove seeed-4mic-voicecard.dtbo in /boot/overlays"
rm /boot/overlays/seeed-4mic-voicecard.dtbo
fi
if [ -f /lib/modules/${uname_r}/kernel/sound/soc/codecs/snd-soc-ac108.ko ] ; then
echo "remove snd-soc-ac108.ko"
rm /lib/modules/${uname_r}/kernel/sound/soc/codecs/snd-soc-ac108.ko
echo "remove snd-soc-ac108.ko"
rm /lib/modules/${uname_r}/kernel/sound/soc/codecs/snd-soc-ac108.ko
fi
if [ -d /var/lib/dkms/seeed-voicecard ] ; then
@ -68,10 +73,15 @@ if [ x${card} = "x4mic" ] ; then
sed -i "s/snd-soc-ac108//g" /etc/modules
if [ -f /var/lib/alsa/asound.state ] ; then
echo "remove ac108_asound.state"
rm /var/lib/alsa/asound.state
echo "remove ac108_asound.state"
rm /var/lib/alsa/asound.state
fi
if [ -f /etc/asound.conf ] ; then
echo "remove asound_4mic.conf"
rm /etc/asound.conf
fi
if [ -f /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_ac108.so ] ; then
echo "remove libasound_module_pcm_ac108.so in /usr/lib/arm-linux-gnueabihf/alsa-lib/ "
rm /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_ac108.so