diff --git a/asound.conf b/asound_2mic.conf similarity index 70% rename from asound.conf rename to asound_2mic.conf index c696042..4b13cb1 100644 --- a/asound.conf +++ b/asound_2mic.conf @@ -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 -} diff --git a/asound_4mic.conf b/asound_4mic.conf new file mode 100644 index 0000000..a5c9edb --- /dev/null +++ b/asound_4mic.conf @@ -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 +} diff --git a/install.sh b/install.sh index d81cce0..e76368a 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/uninstall.sh b/uninstall.sh index 89f3f3e..1dc401c 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -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