Add PulseAudio sink control to audio select option

This commit is contained in:
Simon Long 2020-10-12 14:48:37 +01:00
parent 78a0a8b916
commit 1a4671f109

View File

@ -1871,6 +1871,23 @@ do_update() {
} }
do_audio() { do_audio() {
if is_pulseaudio ; then
if [ "$INTERACTIVE" = True ]; then
oIFS="$IFS"
IFS="/"
list=$(sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pacmd list-sinks | grep -e index -e alsa.name | sed s/*//g | sed s/^[' '\\t]*//g | sed s/'index: '//g | sed s/'alsa.name = '//g | sed s/'bcm2835 '//g | sed s/\"//g | tr '\n' '/')
if ! [ -z "$list" ] ; then
AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${list} 3>&1 1>&2 2>&3)
else
whiptail --msgbox "No internal audio devices found" 20 60 1
return 1
fi
IFS=$oIFS
else
AUDIO_OUT=$1
fi
sudo -u $SUDO_USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pactl set-default-sink $AUDIO_OUT
else
if aplay -l | grep -q "bcm2835 ALSA"; then if aplay -l | grep -q "bcm2835 ALSA"; then
if [ "$INTERACTIVE" = True ]; then if [ "$INTERACTIVE" = True ]; then
AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \
@ -1938,6 +1955,7 @@ ctl.!default {
EOF EOF
fi fi
fi fi
fi
} }
do_resolution() { do_resolution() {