summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-12-24 18:28:00 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-12-24 18:28:00 +0100
commitea645480d7ebbe031c9bb5dfd7b6fdccea4a73d0 (patch)
tree8f91807244bb7f3682f07f7e491e3dd3eff9a91b
parent63f984d616904262da42f28c845e54c0e02d5f6f (diff)
wiiplay: sox can convert by itself (thx mxey)
-rwxr-xr-xwiiplay30
1 files 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 <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