#!/bin/bash
decodeSox() {
	commandline=(${ionice}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//$'\n'/::AtOM:NewLine:SQL:Inline::}")
	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
	if (( ${depth:-0} > 16 ))
	then
		commandline+=(-b 16)
		soxoptions_out+=" -b 16"
	fi
	tmpfile="$fileid${soxoptions_in// /}${soxoptions_out// /}"
	commandline+=("$tempdir/$tmpfile.wav")
}
