Preparing for sound device control in ES.
This commit is contained in:
parent
38bc64dd19
commit
a2be76d26d
2 changed files with 45 additions and 16 deletions
45
packages/jelos/sources/scripts/essound
Executable file
45
packages/jelos/sources/scripts/essound
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright (C) 2020 Fewtarius (https://github.com/fewtarius)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
ES_SETTINGS="/storage/.config/emulationstation/es_settings.cfg"
|
||||
|
||||
get_controls() {
|
||||
IFS=""
|
||||
CONTROLS=$(amixer controls | sed -e 's#^.*name=##g' -e "s#'##g")
|
||||
|
||||
for CONTROL in "${CONTROLS[@]}"
|
||||
do
|
||||
echo ${CONTROL} | awk '{print $1}' | grep -v -E 'Mic|Extension|Capture|Differential|Left|Right' | uniq
|
||||
done
|
||||
echo "--------"
|
||||
for CONTROL in "${CONTROLS[@]}"
|
||||
do
|
||||
echo ${CONTROL}
|
||||
done
|
||||
}
|
||||
|
||||
set_es() {
|
||||
AUDIODEVICE=${1}
|
||||
systemctl stop ${UI_SERVICE}
|
||||
AUDIOTEST=$(grep "AudioDevice" ${ES_SETTINGS} 2>/dev/null)
|
||||
if [ ! "$?" = 0 ]
|
||||
then
|
||||
sed -i '/^.*AudioCard.*$/a \\t<string name="AudioDevice" value="${AUDIODEVICE}" \/>' ${ES_SETTINGS}
|
||||
else
|
||||
sed -i '/<string name="AudioDevice".*$/d'
|
||||
sed -i '/^.*AudioCard.*$/a \\t<string name="AudioDevice" value="${AUDIODEVICE}" \/>' ${ES_SETTINGS}
|
||||
fi
|
||||
set_setting system.audiodevice "${AUDIODEVICE}"
|
||||
systemctl start ${UI_SERVICE}
|
||||
}
|
||||
case ${1} in
|
||||
controls)
|
||||
get_controls 2>/dev/null
|
||||
;;
|
||||
set_es)
|
||||
set_es $2
|
||||
;;
|
||||
esac
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright (C) 2020 Fewtarius (https://github.com/fewtarius)
|
||||
|
||||
IFS=""
|
||||
CONTROLS=$(amixer controls | sed -e 's#^.*name=##g' -e "s#'##g")
|
||||
|
||||
for CONTROL in "${CONTROLS[@]}"
|
||||
do
|
||||
echo ${CONTROL} | awk '{print $1}' | grep -v -E 'Mic|Extension|Capture|Differential|Left|Right' | uniq
|
||||
done
|
||||
echo "--------"
|
||||
for CONTROL in "${CONTROLS[@]}"
|
||||
do
|
||||
echo ${CONTROL}
|
||||
done
|
Loading…
Reference in a new issue