///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2015 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2017 LoRd_MuldeR <MuldeR2@GMX.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
{
}
-bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *formatInfo, volatile bool *abortFlag)
+AbstractFilter::FilterResult ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, AudioFileModel_TechInfo *const formatInfo, QAtomicInt &abortFlag)
{
QProcess process;
QStringList args;
{
messageLogged("Skipping resample filter!");
qDebug("Resampling filter target samplerate/bitdepth is equals to the format of the input file, skipping!");
- return true;
+ return AbstractFilter::FILTER_SKIPPED;
}
- process.setWorkingDirectory(QFileInfo(outputFile).canonicalPath());
-
args << "-V3" << "-S";
args << "--guard" << "--temp" << ".";
args << QDir::toNativeSeparators(sourceFile);
args << "dither" << "-s"; //if you're mastering to 16-bit, you also need to add 'dither' (and in most cases noise-shaping) after the rate
}
- if(!startProcess(process, m_binary, args))
+ if(!startProcess(process, m_binary, args, QFileInfo(outputFile).canonicalPath()))
{
- return false;
+ return AbstractFilter::FILTER_FAILURE;
}
bool bTimeout = false;
while(process.state() != QProcess::NotRunning)
{
- if(*abortFlag)
+ if(checkFlag(abortFlag))
{
process.kill();
bAborted = true;
if(bTimeout || bAborted || process.exitCode() != EXIT_SUCCESS || QFileInfo(outputFile).size() == 0)
{
- return false;
+ return AbstractFilter::FILTER_FAILURE;
}
- if(m_samplingRate) formatInfo->setAudioSamplerate(m_samplingRate);
- if(m_bitDepth) formatInfo->setAudioBitdepth(m_bitDepth);
+ if(m_samplingRate)
+ formatInfo->setAudioSamplerate(m_samplingRate);
+ if(m_bitDepth)
+ formatInfo->setAudioBitdepth(m_bitDepth);
- return true;
+ return AbstractFilter::FILTER_SUCCESS;
}