mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
Audio - Added initial script to adjusting audio settings for ET supported audio devices
This commit is contained in:
Executable
+95
@@ -0,0 +1,95 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Author : Gaston Gonzalez
|
||||||
|
# Date : 31 October 2024
|
||||||
|
# Purpose : Configures ET audio device with sane defaults
|
||||||
|
#
|
||||||
|
# Preconditions
|
||||||
|
# 1. Supported audio interface is connected and properly detected
|
||||||
|
#
|
||||||
|
# Postconditions
|
||||||
|
# 1. ASLA settings set on ET audio device
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo "usage: $(basename $0) <command>"
|
||||||
|
echo " update-config - Update amixer config"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
start() {
|
||||||
|
update-config
|
||||||
|
}
|
||||||
|
|
||||||
|
update-config () {
|
||||||
|
|
||||||
|
# 1. Check if the symlink was created by the udev rules
|
||||||
|
if [ -e /dev/et-audio ]; then
|
||||||
|
|
||||||
|
# 2. Check that this device was properly tagged with the ET_AUDIO env variable with a udev rule
|
||||||
|
APLAY_OUT=$(arecord -l | grep ET_AUDIO)
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
AUDIO_CARD=$(echo $APLAY_OUT | cut -d":" -f1 | awk '{print $2}')
|
||||||
|
AUDIO_DEVICE=$(echo $APLAY_OUT | cut -d"," -f2 | cut -d":" -f1 | awk '{print $2}')
|
||||||
|
FULL_AUDIO_DEVICE="$AUDIO_CARD,$AUDIO_DEVICE"
|
||||||
|
|
||||||
|
|
||||||
|
# Use device descriptor assigned by udev rules
|
||||||
|
ET_DEVICE=$(udevadm info /dev/et-audio | grep ET_DEVICE | cut -d"=" -f2)
|
||||||
|
|
||||||
|
et-log "Updating audio device: '${ET_DEVICE}' (${FULL_AUDIO_DEVICE})' for ALSA PnP configuration."
|
||||||
|
|
||||||
|
case ${ET_DEVICE} in
|
||||||
|
"DIGIRIG_MOBILE")
|
||||||
|
# Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls.
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute
|
||||||
|
# Unmute Mic
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset Mic Playback Switch 52% unmute
|
||||||
|
# Set "L/R Capture" to 19. Adjust if you can't decode received audio. Your RX controls.
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute
|
||||||
|
# Disable Auto Gain Control
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute
|
||||||
|
|
||||||
|
et-log "Applied amixer settings for ${ET_DEVICE}"
|
||||||
|
;;
|
||||||
|
"DIGIRIG_LITE")
|
||||||
|
# Unmute Speaker a set volume. Adjust if remote station can't decode you. Your TX controls.
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset Speaker Playback Switch 42% unmute
|
||||||
|
# Unmute Mic
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset Mic Playback Switch 52% unmute
|
||||||
|
# Set "L/R Capture" to 19. Adjust if you can't decode received audio. Your RX controls.
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset Mic Capture Switch 31% unmute
|
||||||
|
# Disable Auto Gain Control
|
||||||
|
amixer -q -c ${AUDIO_CARD} sset 'Auto Gain Control' mute
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
el-log "No ALSA configuration specified for this ET_DEVICE."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
else
|
||||||
|
et-log "No ET_AUDIO device detected. Can't change ALSA settings."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
et-log "No ET_AUDIO device plugged in. Can't change ALSA settings."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
update-config)
|
||||||
|
update-config
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid command."
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user