#!/bin/bash

# this version works with ALSA. developed on debian/woody but should work anywhere.
# PB: updated for alsa-0.9.0beta4

. /etc/jogdiald/functions

msg_on="LABEL Unmute\nCOLOR yellow"
msg_off="LABEL Mute\nCOLOR white"

read_volume
case $VOLUME in
  "0")  echo -e "$msg_on\nOK"
	read press
	OLDVOL=`cat ~/.mutevol`
	$AUMIX $CHANNEL $OLDVOL && echo -e "$msg_off"
	echo "OK"
    ;;
  *)  echo -e "$msg_off\nOK"
	read press
	echo $VOLUME > ~/.mutevol
	$AUMIX $CHANNEL 0 && echo -e "$msg_on"
	echo "OK"
    ;;
esac
