6 zero_start=0 trim_end=0 offset=0
7 while getopts flF:L:o:b:a: opt; do
9 f) zero_start=$((588 * 5 - 1)) ;;
10 l) trim_end=$((588 * 5)) ;;
11 F) zero_start=$OPTARG ;;
12 L) trim_end=$OPTARG ;;
23 *) echo >&2 "missing file argument" ;;
27 len=$(metaflac --show-total-samples "$file")
29 if ((offset < 0)); then
31 stop=$((stop + offset))
32 elif ((offset >= 0)); then
38 if ((offset < 0)); then
39 if [ "${before+set}" ]; then
40 n=$(metaflac --show-total-samples "$before")
41 flac -d -s -o- --force-raw-format --sign=signed --endian=little \
42 --skip=$((n + offset)) --until=$n \
45 $JBDIR/bin/cat-prefix $((4 * -offset)) </dev/zero
49 flac -d -s -o- --force-raw-format --sign=signed --endian=little \
50 --skip=$start --until=$stop \
53 if ((offset > 0)); then
54 if [ "${after+set}" ]; then
55 flac -d -s -o- --force-raw-format --sign=signed --endian=little \
56 --skip=0 --until=$offset \
59 $JBDIR/bin/cat-prefix $((4 * offset)) </dev/zero
63 if ((zero_start > 0)); then
64 $JBDIR/bin/cat-prefix $((4 * zero_start)) </dev/zero
65 $JBDIR/bin/cat-prefix $((4 * zero_start)) >/dev/null
66 len=$((len - zero_start))
68 if ((trim_end > 0)); then
69 $JBDIR/bin/cat-prefix $((4 * (len - trim_end)))
70 $JBDIR/bin/cat-prefix $((4 * trim_end)) </dev/zero