#!/bin/sh
#
# set default volumes for playback on ALSA
#
# set_default_mixer [-f] [card#]
#
# written by Takashi Iwai <tiwai@suse.de>
#

if [ -f /etc/asound.state -a x$1 != x-f ]; then
  /usr/sbin/alsactl restore >/dev/null 2>&1
  exit 0
fi

if [ x$1 = x-f ]; then
    shift
fi

if [ -n "$1" ]; then
    card="-c $1"
fi

function mixer() {
  amixer $card set "$1" "$2" >/dev/null 2>&1
  amixer $card set "$1" unmute >/dev/null 2>&1
}

mixer Master 75%
mixer 'Master Mono' 75%
mixer Front 75%
mixer PCM 90%
mixer Synth 90%
mixer CD 90%
# mute mic
amixer set Mic 0% mute >/dev/null 2>&1
# ESS 1969 chipset has 2 PCM channels
mixer PCM,1 90%
# Trident/YMFPCI/emu10k1
mixer Wave 100%
mixer Music 100%
mixer AC97 100%
# CS4237B chipset:
mixer 'Master Digital' 75%
# Envy24 chips with analog outs
mixer DAC 90%
mixer DAC,0 90%
mixer DAC,1 90%
# some notebooks use headphone instead of master
mixer Headphone 75%
mixer Playback 100%
# turn off digital switches
amixer set "SB Live Analog/Digital Output Jack" off >/dev/null 2>&1
amixer set "Audigy Analog/Digital Output Jack" off >/dev/null 2>&1

exit 0
