sound/music initialization failure workaround
Gussak Dec 24th, 2012 310 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- echo "DETECT IF ANY SOUND IS PLAYING, configuration for Pulse Audio:"
- echo "- run: pavucontrol; and click at recording tab"
- echo "- run: arecord -f S16_LE >/dev/null"
- echo "- at pavucontrol, at recording, for arecord, select: Monitor of builtin audio.."
- echo "- stop arecord and it will keep that setup!"
- echo -n "press a key to continue...";read -n 1;echo
- # capture thru pulse audio
- delay=1 #it doesnt accept less than 1s ...
- sedValOfMaxAmp='s".*: *""'
- maxAmp=`arecord -d $delay -f S16_LE \
- |sox -t .wav - -n stat 2>&1 \
- |grep "Maximum amplitude" \
- |sed "$sedValOfMaxAmp"`
- echo "maxAmp=$maxAmp"
- iHasSound=`echo "$maxAmp > 0.0" |bc -l`
- bHasSound=false;if((iHasSound==1));then bHasSound=true;fi
- if ! $bHasSound; then
- # !!! your code to kill the application/game and restart it !!!
RAW Paste Data