/
audiosettings.sh
61 lines (57 loc) · 1.83 KB
/
audiosettings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#
rp_module_id="audiosettings"
rp_module_desc="Configure audio settings"
rp_module_section="config"
rp_module_flags="!x86 !mali"
function depends_audiosettings() {
if [[ "$md_mode" == "install" ]]; then
getDepends alsa-utils
fi
}
function gui_audiosettings() {
local cmd=(dialog --backtitle "$__backtitle" --menu "Set audio output." 22 86 16)
local options=(
1 "Auto"
2 "Headphones - 3.5mm jack"
3 "HDMI"
4 "Mixer - adjust output volume"
R "Reset to default"
)
choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
if [[ -n "$choice" ]]; then
case "$choice" in
1)
amixer cset numid=3 0
alsactl store
printMsgs "dialog" "Set audio output to auto"
;;
2)
amixer cset numid=3 1
alsactl store
printMsgs "dialog" "Set audio output to headphones / 3.5mm jack"
;;
3)
amixer cset numid=3 2
alsactl store
printMsgs "dialog" "Set audio output to HDMI"
;;
4)
alsamixer >/dev/tty </dev/tty
alsactl store
;;
R)
/etc/init.d/alsa-utils reset
alsactl store
printMsgs "dialog" "Audio settings reset to defaults"
;;
esac
fi
}