[LAU] RME HDSP: X11-less mixer state restoring

Andrew Gaydenko a at gaydenko.com
Sun Apr 3 16:21:06 UTC 2011


On Sunday 03 April 2011 19:59:30 Paul Davis wrote:
> On Sun, Apr 3, 2011 at 11:51 AM, Andrew Gaydenko <a at gaydenko.com> wrote:
> > How to?
> 
> example script below. its not commented or explained, because i wrote
> it for me alone.

Paul, thanks! I'm not bash guru at all, but will try to dig in your script. In 
fact, if I understand correctly, it isn't a restoring (to restore we must at 
first save a state, and it is impossible to read current state), but it is a 
setting.


Andrew

> 
> 
> #!/bin/bash
> 
> AMIXER="amixer -q"
> CARD="-c 1"
> 
> if [ x$1 = xon ] ; then
>     gain=32768
>     verb="route"
> else
>     gain=0
>     verb="mute"
> fi
> 
> shift;
> 
> #input_source : 0-25  (physical channels),
> #               26-51 (software playback)
> #output_source : 0-25 (physical channels),
> #               26-27 (line out)
> 
> case $1 in
>     play)
> 	for chn in $(seq 26 51);do
> 	    $AMIXER $CARD cset numid=5 $chn,$(($chn-26)),$gain
> 	done
> 	;;
> 
>     thru)
> 	for input in $(seq 0 25);do
> 	    for output in $(seq 0 25); do
> 		if [ $input != $output ]; then
> 		    $AMIXER $CARD cset numid=5 $input,$output,$gain
> 		fi
> 	    done
> 	done
> 	;;
> 
>     thru12)
> 	$AMIXER $CARD cset numid=5 0,0,$gain
> 	$AMIXER $CARD cset numid=5 1,1,$gain
> 	;;
> 
>     mon)
> 	for chn in $(seq 26 51);do
> 	    if [ $(($chn % 2)) -eq 0 ] ; then
> 		$AMIXER $CARD cset numid=5 $chn,$26,$gain
> 	    else
> 		$AMIXER $CARD cset numid=5 $chn,$27,$gain
> 	    fi
> 	done
> 	;;
> 
>     all)
> 	for input in $(seq 0 51); do
> 	    for output in $(seq 0 27); do
> 		echo -n "."
> 		if [ $gain = 0 -o $input != $output ]; then
> 		    $AMIXER $CARD cset numid=5 $input,$output,$gain
> 		fi
> 	    done
> 	    echo
> 	done
> 	;;
> esac


More information about the Linux-audio-user mailing list