Permalink
Browse files

wiiplay: sox can convert by itself (thx mxey)

  • Loading branch information...
derf committed Dec 24, 2011
1 parent 63f984d commit ea645480d7ebbe031c9bb5dfd7b6fdccea4a73d0
Showing with 9 additions and 21 deletions.
  1. +9 −21 wiiplay
View
30 wiiplay
@@ -6,33 +6,21 @@
setopt err_exit
if [[ -z $1 || -z $2 ]]; then
- echo "Usage: $0 <btaddr> <file>" >&2
+ echo "Usage: $0 <btaddr> <file> [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

0 comments on commit ea64548

Please sign in to comment.