dotfiles

My collection of dotfiles
git clone git://git.stellar-nexus.ru/dotfiles
Log | Files | Refs

sound (898B)


      1 #!/bin/sh
      2 alsastatedir=/var/lib/alsa
      3 alsascrdir=/etc/alsa.d
      4 alsahomedir=/run/alsasound
      5 cards="$(sed -n -e 's/^ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
      6 for cardnum in $cards; do
      7 	[ -e /dev/snd/controlC$cardnum ] || sleep 2
      8 	[ -e /dev/snd/controlC$cardnum ] || sleep 2
      9 	[ -e /dev/snd/controlC$cardnum ] || sleep 2
     10 	[ -e /dev/snd/controlC$cardnum ] || sleep 2
     11 	alsactl -E HOME="$alsahomedir" -I -f "$alsastatedir/asound.state" restore $cardnum
     12 done
     13 
     14 for ossfile in "$alsastatedir"/oss/card*_pcm* ; do
     15 	[ -e "$ossfile" ] || continue
     16 	# We use cat because I'm not sure if cp works properly on /proc
     17 	procfile=$ossfile$alsastatedir/oss
     18 	procfile="$(echo "$procfile" | sed -e 's,_,/,g')"
     19 	if [ -e /proc/asound/"$procfile"/oss ] ; then
     20 	    cat "$ossfile" > /proc/asound/"$procfile"/oss 
     21 	fi
     22 done
     23 sleep 3
     24 chown root:audio /dev/snd/*
     25 chown root:audio /dev/snd
     26 chmod -R a+rw /dev/snd
     27 lk_forever 3600