if ($config['audioFormats'][$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) { $tempname2 = getTempWavName(); convertWithSox($config['sox'] . " \"{$tempname1}\" -c2 \"{$tempname2}\""); checkFile($tempname2); rmFile($tempname1); encodeWithLame($config['lame'] . " --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname2}\" \"{$target}\""); checkFile($target); rmFile($tempname2); } else { encodeWithLame($config['lame'] . " --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname1}\" \"{$target}\""); checkFile($target); rmFile($tempname1); } } elseif ($config['audioFormats'][$index]['format'] == 'ogg' && $audioFiles->list[$sourceindex]->format == 'ogg') { $tempname1 = getTempWavName(); decodeWithOgg($config['oggdec'] . " -o \"{$tempname1}\" \"{$source}\""); checkFile($tempname1); if ($config['audioFormats'][$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) { $tempname2 = getTempWavName(); convertWithSox($config['sox'] . " \"{$tempname1}\" -c2 \"{$tempname2}\""); checkFile($tempname2); rmFile($tempname1); encodeWithOgg($config['oggenc'] . " -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} -o \"{$target}\" \"{$tempname2}\""); checkFile($target); rmFile($tempname2); } else { if ($config['audioFormats'][$index]['channels'] == 1 && $audioFiles->list[$sourceindex]->channels == 2) { $addparam = "--downmix"; } encodeWithOgg($config['oggenc'] . " -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} {$addparam} -o \"{$target}\" \"{$tempname1}\""); checkFile($target);
} elseif ($audioFormats[$index]['format'] == 'mp3' && $audioFiles->list[$sourceindex]->format == 'ogg') { $tempname1 = getTempWavName(); decodeWithOgg("{$oggdec} -o \"{$tempname1}\" \"{$source}\""); if ($audioFormats[$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) { $tempname2 = getTempWavName(); convertWithSox("{$sox} \"{$tempname1}\" -c2 \"{$tempname2}\""); unlink($tempname1); encodeWithLame("{$lame} --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname2}\" \"{$target}\""); unlink($tempname2); } else { encodeWithLame("{$lame} --disptime 1 --cbr -b {$bitrate} -m {$mode} --resample {$samplerate} \"{$tempname1}\" \"{$target}\""); unlink($tempname1); } } elseif ($audioFormats[$index]['format'] == 'ogg' && $audioFiles->list[$sourceindex]->format == 'ogg') { $tempname1 = getTempWavName(); decodeWithOgg("{$oggdec} -o \"{$tempname1}\" \"{$source}\""); if ($audioFormats[$index]['channels'] == 2 && $audioFiles->list[$sourceindex]->channels == 1) { $tempname2 = getTempWavName(); convertWithSox("{$sox} \"{$tempname1}\" -c2 \"{$tempname2}\""); unlink($tempname1); encodeWithOgg("{$oggenc} -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} -o \"{$target}\" \"{$tempname2}\""); unlink($tempname2); } else { if ($audioFormats[$index]['channels'] == 1 && $audioFiles->list[$sourceindex]->channels == 2) { $addparam = "--downmix"; } encodeWithOgg("{$oggenc} -b {$bitrate} -m {$bitrate} -M {$bitrate} --resample {$samplerate} {$addparam} -o \"{$target}\" \"{$tempname1}\""); unlink($tempname1); } } $prg->setAudio($target);