Scripts are needed to change audio configuration.

This commit is contained in:
Pecusx
2016-11-17 17:52:57 +01:00
committed by GitHub
parent 571d2b1325
commit 87b27fbc77
2 changed files with 42 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
aplay -l | grep "card 0" -m 1
amixer -c0 scontrols | grep "Simple" -m 1
aplay -l | grep "card 1" -m 1
amixer -c1 scontrols | grep "Simple" -m 1
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# Files to modify
BOOTCONFIG=/boot/config.txt
MPDCONFIG=/etc/mpd.conf
CARDPRIORYTY=/lib/modprobe.d/aliases.conf
INTERNALFIRST=/usr/share/radio/hardware/audio/internal.conf
USBFIRST=/usr/share/radio/hardware/audio/usb.conf
# Only if 3 params
if [ $# = 3 ]; then
# Get parameters from commandline
# "internal or "usb"
CARD=$1
# Mixer name for volume control
MIXER=$2
# PWM mode 1 - standard , 2 - high quality
PWM=$3
# Set prioryty of audio device
if [ ${CARD} = "internal" ]; then
cp ${INTERNALFIRST} ${CARDPRIORYTY}
elif [ ${CARD} = "usb" ]; then
cp ${USBFIRST} ${CARDPRIORYTY}
fi
# Set PWM mode
sed -i "s/audio_pwm_mode.*/audio_pwm_mode=${PWM}/" ${BOOTCONFIG}
# Set mixer name
sed -i "s/^[ \t]*mixer_control.*/\tmixer_control\t\"${MIXER}\"/" ${MPDCONFIG}
reboot
fi