From ea645480d7ebbe031c9bb5dfd7b6fdccea4a73d0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 24 Dec 2011 18:28:00 +0100 Subject: wiiplay: sox can convert by itself (thx mxey) --- wiiplay | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/wiiplay b/wiiplay index ae33b17..237fab8 100755 --- a/wiiplay +++ b/wiiplay @@ -6,33 +6,21 @@ setopt err_exit if [[ -z $1 || -z $2 ]]; then - echo "Usage: $0 " >&2 + echo "Usage: $0 [volume]" >&2 + echo "volume: 0 .. 255, default 64" >&2 exit 1 fi -if [[ ${2:e} == ogg ]]; then +sox --show-progress --norm ${2} -b 8 /tmp/wiiplay.raw \ + channels 1 rate 2000 vol 0.5 - oggdec -o /tmp/wiiplay.wav ${2} +./wiispkr ${1} ${3} < /tmp/wiiplay.raw 2> /dev/null & +PID=$! -elif [[ ${2:e} == mp3 ]]; then +sudo renice -10 $PID - mpg321 -w /tmp/wiiplay.wav ${2} +trap 'kill $PID' INT -elif [[ ${2:e} == wav ]]; then - - cp ${2} /tmp/wiiplay.wav - -else - - echo "${2:e}: unsupported format" >&2 - exit 1 - -fi - -sox --norm /tmp/wiiplay.wav -b 8 /tmp/wiiplay.raw channels 1 rate 2000 - -rm /tmp/wiiplay.wav - -./wiispkr ${1} < /tmp/wiiplay.raw 2> /dev/null +wait rm /tmp/wiiplay.raw -- cgit v1.2.3