1#!/bin/sh 2 3tmp=/tmp/`basename $0`-$$ 4input=$tmp.wav # no comment support 5 6check_file () { 7 ./sox --i -a $1 > $tmp.comments 8 cmp $tmp.comments $2 || exit 1 9} 10 11check () { 12 f=$1; shift 13 : > $tmp.expected 14 while [ $# != 0 ]; do 15 echo "$1" >> $tmp.expected 16 shift 17 done 18 check_file $f $tmp.expected 19} 20 21com0="Processed by SoX" 22com1="foo bar" 23com2="bar foo" 24 25./sox -n $input trim 0 .1 26 27./sox $input $tmp.au # Apply default comment 28check $tmp.au "$com0" 29 30cp $tmp.au $tmp.comment.au 31 32cat > $tmp.i << . 33TITLE=First Track 34ARTIST=A Band 35ALBUM=A Collection Of Songs 36TRACKNUMBER=01 37. 38 39./sox $input --comment-file $tmp.i $tmp.comments.au 40check_file $tmp.comments.au $tmp.i 41 42./sox $input --comment= $tmp.au # Don't apply default comment 43check $tmp.au 44 45./sox $input --add-comment "$com1" $tmp.au 46check $tmp.au "$com1" 47 48./sox $tmp.comment.au --add-comment "$com1" $tmp.au 49check $tmp.au "$com0" "$com1" 50 51./sox $input --add-comment "$com1" --add-comment "$com2" $tmp.au 52check $tmp.au "$com1" "$com2" 53 54./sox $tmp.comment.au --add-comment "$com1" --add-comment "$com2" $tmp.au 55check $tmp.au "$com0" "$com1" "$com2" 56 57./sox $tmp.comments.au --comment= $tmp.au 58check $tmp.au 59 60./sox $tmp.comments.au --comment "$com1" $tmp.au 61check $tmp.au "$com1" 62 63./sox $tmp.comments.au --add-comment "$com1" $tmp.au 64cp $tmp.i $tmp.j 65echo "$com1" >> $tmp.j 66check_file $tmp.au $tmp.j 67 68./sox $tmp.comments.au --add-comment "$com1" --add-comment "$com2" $tmp.au 69echo "$com2" >> $tmp.j 70check_file $tmp.au $tmp.j 71 72# FIXME: smp mp3 73./sox $tmp.comments.au $tmp.aiff 74./sox $tmp.aiff $tmp.flac 75./sox $tmp.flac $tmp.sf 76./sox $tmp.sf $tmp.ogg 77./sox $tmp.ogg $tmp.sndt 78./sox $tmp.sndt $tmp.sox 79./sox $tmp.sox $tmp.au 80check_file $tmp.au $tmp.i 81 82rm -f $tmp.* 83exit 0 84