Bladeren bron

优化声卡相关配置

Yu.Ding 4 uur geleden
bovenliggende
commit
7edd14e3f4
5 gewijzigde bestanden met toevoegingen van 71 en 24 verwijderingen
  1. 42 0
      etc/asound.conf
  2. 2 0
      etc/rc.local
  3. 25 23
      etc/scripts/audio_init.sh
  4. 2 1
      system_init.sh
  5. BIN
      usr/lib/silence.wav

+ 42 - 0
etc/asound.conf

@@ -1,4 +1,46 @@
+defaults.pcm.rate_converter "speexrate_medium"
+pcm.!default
+{
+    type asym
+    playback.pcm {
+        type plug
+        slave.pcm "softvol"
+    }
+    capture.pcm {
+        type plug
+        slave {
+            pcm "hw:0,0"
+        }
+    }
+}
+
+pcm.softvol {
+    type softvol
+    slave.pcm "paging_playback"
+    control {
+        name "Master Playback Volume"
+        card 0
+    }
+    min_dB -40.0
+    max_dB 0.0
+    resolution 101
+}
 
+pcm.paging_playback {
+    type dmix
+    ipc_key 100406
+    slave {
+        pcm "hw:0,0"
+	channels 2
+	rate 48000
+	period_size 960
+	buffer_size 3840
+    }
+    bindings {
+	0 0
+	1 1
+    }
+}
 
 pcm.mixmic_1 {
 	ipc_key 1026

+ 2 - 0
etc/rc.local

@@ -9,6 +9,8 @@ etc/scripts/S99input-event-daemon start
 
 /etc/scripts/gpio_init.sh
 
+/etc/scripts/audio_init.sh
+
 /etc/scripts/product_model.sh
 chmod 777 /dev/ttyS*
 # Create dummy video node for chromium V4L2 VDA/VEA with rkmpp plugin

+ 25 - 23
etc/scripts/audio_init.sh

@@ -8,44 +8,46 @@ volctrl_path="/oem/etc/volctrl.conf"
 volume_out=`sysconf ${volctrl_path} get volume volume_out`
 volume_in=`sysconf ${volctrl_path} get volume volume_in`
 
+aplay  /usr/lib/silence.wav 2>/dev/null
+
 # Set output volume
 case ${volume_out} in
-    10)
-        value_out=192
+        10)
+            value_out=100
         ;;
-    9)
-        value_out=187
+        9)
+            value_out=96
         ;;
-    8)
-        value_out=180
+        8)
+            value_out=93
         ;;
-    7)
-        value_out=173
+        7)
+            value_out=90
         ;;
-    6)
-        value_out=165
+        6)
+            value_out=85
         ;;
-    5)
-        value_out=156
+        5)
+            value_out=80
         ;;
-    4)
-        value_out=144
+        4)
+            value_out=74
         ;;
-    3)
-        value_out=129
+        3)
+            value_out=66
         ;;
-    2)
-        value_out=108
+        2)
+            value_out=51
         ;;
-    1)
-        value_out=72
+        1)
+            value_out=35
         ;;
-    0)
-        value_out=0
+        0)
+            value_out=0
         ;;
 esac
 
-/usr/bin/amixer -q sset 'DAC',0 ${value_out}
+/usr/bin/amixer -q sset 'Master',0 ${value_out}
 
 # Set input volume
 case ${volume_out} in

+ 2 - 1
system_init.sh

@@ -4,4 +4,5 @@ rm -f /usr/lib/aarch64-linux-gnu/libgst*
 rm -rf /usr/lib/aarch64-linux-gnu/gstreamer-1.0/
 rm -f /etc/systemd/user/default.target.wants/pulseaudio.service 
 rm -f /etc/systemd/user/sockets.target.wants/pulseaudio.socket
-systemctl disable docker
+systemctl disable docker
+systemctl disable adbd

BIN
usr/lib/silence.wav