experimental old/new eatmydata support switch
[shellsnippets/shellsnippets.git] / mksh / flacplay
1 #!/bin/mksh
2 # $MirOS: contrib/hosted/tg/flacplay,v 1.2 2012/09/29 14:07:15 tg Exp $
3
4 if a=$(whence -p waveplay) && [[ -n $a && -x $a ]]; then
5         alias _wavplay='waveplay -'
6 else
7         alias _wavplay='sox -t wav /dev/stdin -t sunau /dev/audio'
8 fi
9
10 trap "" INT
11
12 for a in "$@"; do
13         if [[ $a = - || -s $a ]]; then
14                 [[ $a = - ]] || print -ru2 "♬ $a"
15                 flac -d -c "$a" | _wavplay
16         else
17                 print -ru2 "Skipping illegible '$a'"
18         fi
19 done