Thursday, March 31, 2005

aumix.sh update

slight update to get PCM and PCM2 working:

#!/bin/sh

cd $HOME

action=$1; shift
killall -q osd_cat > /dev/null 2>&1

get_volume() {
volume=`aumix -q | sed -ne 's/^vol \([^,]*\).*/\1/p'`
}

show_volume() {
#echo Volume:\ $1|osd_cat -o 300 -A center -c green -s 10
osd_cat --text Volume:\ $1 --barmode=percentage --percentage=$1 -o 300 -A center -c green -s 10
}

case "$action" in

incr)
delta=${1:-5}
rm -f .mutevol
aumix -v +$delta -w +$delta -W +$delta
get_volume
show_volume $volume
;;

decr)
delta=${1:-5}
rm -f .mutevol
aumix -v -$delta -w -$delta -W -$delta
get_volume
show_volume $volume
;;

mute)
if [ -s .mutevol ]
then
vol=`cat .mutevol`
rm -f .mutevol
aumix -v $vol
# echo "Volume: $vol" | xosd -- -
show_volume $vol
else
get_volume
[ $volume != 0 ] && echo $volume > .mutevol
aumix -v 0
echo "Volume: muted" | xosd -- -
fi
;;
esac

No comments: