mirror of
https://github.com/Pecusx/piradio-mini.git
synced 2026-05-20 22:33:44 +02:00
Scripts are needed to change audio configuration.
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user