OpenELEC/OpenELEC.tv — Issue #77: alsa-utils soundconfig script improvments.
Author: queeup
Created: 2011-11-25 11:40:54+00:00
State: open

Original soundconfig is ll about digital output. What if somebody wants to use analog? This concept help people who are not build their own OpenElec.

It's just idea. Above script not working :)

```bash
# setup alsa (especially the mixer config)

# find soundcard module
module=`cat "/proc/asound/modules"`
# find xbmc sount output style
sound_output="I have no idea how to find that value :)"

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
# if soundcard module is ca0106
if test "${module}" = " 0 snd_ca0106" ; then
# if XBMC sound output analog
if test "${sound_output}" = "Analog" ; then
# CA0106
mixer 0 'IEC958',0 off off
mixer 0 'Master',0 90%
mixer 0 'Analog Center/LFE',0 80%
mixer 0 'Analog Front',0 80%
mixer 0 'Analog Rear',0 80%
mixer 0 'Analog Side',0 80%
fi
if test "${sound_output}" = "HDMI" ; then
mixer 0 'IEC958',0 on on
fi
fi
fi

exit 0
)&
```