updated on Mon Jan 23 12:00:23 UTC 2012
[aur-mirror.git] / alsa-utils-transparent / alsa
blobe1d6f285b5bd9d1b6cb443940d087f6a5666af5c
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/conf.d/alsa
5 . /etc/rc.d/functions
7 case "$1" in
8 start)
9 stat_busy "Restoring ALSA Levels"
10 /usr/sbin/alsactl $ALSA_ARGS restore
11 if [ $? -gt 0 ]; then
12 stat_fail
13 else
14 stat_done
15 add_daemon alsa
18 POWERSAVE=${POWERSAVE:-0}
19 if [ -e /sys/module/snd_ac97_codec/parameters/power_save \
20 -a $POWERSAVE -ne 0 ]; then
21 echo $POWERSAVE > /sys/module/snd_ac97_codec/parameters/power_save
22 echo 1 > /dev/dsp
25 if [ -e /sys/module/snd_hda_intel/parameters/power_save \
26 -a $POWERSAVE -ne 0 ]; then
27 echo $POWERSAVE > /sys/module/snd_hda_intel/parameters/power_save
28 echo 1 > /dev/dsp
31 stop)
32 SAVE_VOLUME=${SAVE_VOLUME:-yes}
33 if [ "$SAVE_VOLUME" == "yes" ]; then
34 stat_busy "Saving ALSA Levels"
35 /usr/sbin/alsactl $ALSA_ARGS store
36 else
37 stat_busy "Stopping ALSA"
39 if [ "$MUTE_VOLUME" == "yes" ]; then
40 /usr/bin/amixer -q set Master 0 mute
42 if [ $? -gt 0 ]; then
43 stat_fail
44 else
45 stat_done
46 rm_daemon alsa
49 restart)
50 $0 stop
51 sleep 1
52 $0 start
55 echo "usage: $0 {start|stop|restart}"
56 esac