diff options
Diffstat (limited to 'wiiplay')
-rwxr-xr-x | wiiplay | 30 |
1 files changed, 9 insertions, 21 deletions
@@ -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 |