AtOM/lib/decode/decodeSox
2013-04-07 01:27:07 +02:00

31 lines
920 B
Plaintext

decodeSox() {
commandline=(sox --single-threaded --temp "$tempdir")
soxoptions_in=''
soxoptions_out=''
if (( ${destinationnormalize["$destination"]} ))
then
commandline+=(--norm)
soxoptions_in+=' --norm'
fi
if [ -n "$1" ]
then
commandline+=("$1")
else
commandline+=("$sourcepath/$filename")
fi
if [ -n "${destinationfrequency["$destination"]}" ] \
&& (( ${rate:-0} != ${destinationfrequency["$destination"]} ))
then
commandline+=(-r ${destinationfrequency["$destination"]})
soxoptions_out+=" -r ${destinationfrequency["$destination"]}"
fi
if [ -n "${destinationchannels["$destination"]}" ] \
&& (( ${channels:-0} != ${destinationchannels["$destination"]} ))
then
commandline+=(-c ${destinationchannels["$destination"]})
soxoptions_out+=" -c ${destinationchannels["$destination"]}"
fi
tmpfile="$fileid${soxoptions_in// /}${soxoptions_out// /}"
commandline+=("$tempdir/$tmpfile.wav")
}