Saturday, June 29, 2013

aumix and mute not working on Ubuntu 10.10+

As I wrote elsewhere, some dunce decided we didn't need /dev/dsp et al any more and failed to notice that several utilities depend on those files being available, among them aumix and mute.

That means among others that my nifty, shiny volume bars described in this post are no longer working. I'm working on a permanent fix, but for now, to replace mute just use this script:
if [ -e $HOME/.mute-save ] ; then #muted
        amixer sset Master,0 $(cat $HOME/.mute-save) #restore
        rm -f $HOME/.mute-save #and delete the storage
else #not muted
        echo $(amixer sget Master,0|egrep 'Playback[[:space:]]+[0-9]+[[:space:]]+\['\
        |sed -r -e 's/.*Playback[[:space:]]+([0-9]+)[[:space:]]+\[.*/\1/') > $HOME/.mute-save #dissect the amixer output and save it
        amixer sset Master,0 0 #and mute
exit 0
Please excuse if I don't go over it line by line today but I've had a bad day so far and it don't look to be getting better. It's a hack, and it's not so different from the original mute script Just the gist of it: the egrep call makes sure we select the right line from the output and the sed call dissects the actual numeric volume value from it. That's all for today folks, enjoy and have a nicer day than me.

No comments:

Post a Comment