Files
LibreELEC.tv/packages/audio/alsa/alsa-utils/scripts/soundconfig
2014-05-23 23:06:54 +02:00

132 lines
3.4 KiB
Bash
Executable File

#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
#
# OpenELEC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# OpenELEC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
################################################################################
# setup alsa (especially the mixer config)
mixer() {
parm=${4:-on}
amixer -c "$1" sset "$2" "$3" $parm >/dev/null 2>&1
amixer -c "$1" sset "$2" $parm >/dev/null 2>&1
}
(
. /etc/profile
progress "Setting up sound card"
if [ -f $HOME/.config/sound.conf ]; then
alsactl restore -f $HOME/.config/sound.conf
else
for i in `seq 0 9` ; do
# set common mixer params
mixer $i Master 100%
mixer $i Front 100%
mixer $i PCM 100%
mixer $i Synth 100%
# mute CD, since using digital audio instead
mixer $i CD 0% mute
# Only unmute Line and Aux if they are possibly used.
# mixer $i Line 100%
# mixer $i Aux 100%
# mute mic
mixer $i Mic 0% mute
# ESS 1969 chipset has 2 PCM channels
mixer $i PCM,1 100%
# Trident/YMFPCI/emu10k1
mixer $i Wave 100%
mixer $i Music 100%
mixer $i AC97 100%
mixer $i Surround 90%
mixer $i 'Surround Digital' 90%
mixer $i 'Wave Surround' 90%
mixer $i 'Duplicate Front' 90%
mixer $i 'Sigmatel 4-Speaker Stereo' 90%
# CS4237B chipset:
mixer $i 'Master Digital' 100%
# DRC
mixer $i 'Dynamic Range Compression' 90%
# Envy24 chips with analog outs
mixer $i DAC 100%
mixer $i DAC,0 100%
mixer $i DAC,1 100%
# some notebooks use headphone instead of master
mixer $i Headphone 100%
mixer $i Speaker 100%
mixer $i 'Internal Speaker' 0% mute
mixer $i Playback 100%
mixer $i Headphone 100%
mixer $i Speaker 100%
mixer $i Center 100%
mixer $i LFE 100%
mixer $i Center/LFE 100%
# Intel P4P800-MX (Ubuntu bug #5813)
mixer $i 'Master Playback Switch' on
# set digital output mixer params
mixer $i 'IEC958' 100% on
mixer $i 'IEC958 Output' 100%
mixer $i 'IEC958 Coaxial' 100%
mixer $i 'IEC958 LiveDrive' 100%
mixer $i 'IEC958 Optical Raw' 100%
mixer $i 'SPDIF Out' 100%
mixer $i 'SPDIF Front' 100%
mixer $i 'SPDIF Rear' 100%
mixer $i 'SPDIF Center/LFE' 100%
mixer $i 'Master Digital' 100%
mixer $i 'Analog Front' 100%
mixer $i 'Analog Rear' 100%
mixer $i 'Analog Center/LFE' 100%
# ASRock ION 330 (and perhaps others) has 2 IEC958 channels
mixer $i IEC958,0 on
mixer $i IEC958,1 on
# some ION2 has much more IEC958 channels ...
mixer $i IEC958,2 on
mixer $i IEC958,3 on
# ASRock ION 330 has Master Front set to 0
mixer $i 'Master Front' 100%
# Shuttle XS35GT needs this too
mixer $i 'Master',0 100% on
# and this for various Fusion devices like Zotac ZBOX
mixer $i 'Front',0 100% on
done &>/dev/null
fi
exit 0
)&