From ce872af94c76c51ccc3b42db532f2042e9002eff Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sat, 6 Aug 2011 14:12:20 +0200 Subject: [PATCH] Apply "Force Stereo Downmix" only for sources with more than two channels. --- etc/Translation/Blank.ts | 10 +++++----- src/Config.h | 2 +- src/Dialog_Processing.cpp | 9 +++++++-- src/Thread_Process.cpp | 4 ++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index fd990662..e5374ac0 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -2607,23 +2607,23 @@ - + Playlist creation failed - + The playlist file could not be created: - + Warning: Computer will shutdown in %1 seconds... - - + + Cancel Shutdown diff --git a/src/Config.h b/src/Config.h index b3cb30d1..8d7182f9 100644 --- a/src/Config.h +++ b/src/Config.h @@ -30,7 +30,7 @@ #define VER_LAMEXP_MINOR_LO 3 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 8 -#define VER_LAMEXP_BUILD 622 +#define VER_LAMEXP_BUILD 623 /////////////////////////////////////////////////////////////////////////////// // Tools versions diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index b4ab1b49..958e6637 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -552,6 +552,7 @@ void ProcessingDialog::startNextJob(void) AbstractEncoder *encoder = NULL; bool nativeResampling = false; + //Create encoder instance switch(m_settings->compressionEncoder()) { case SettingsModel::MP3Encoder: @@ -637,6 +638,7 @@ void ProcessingDialog::startNextJob(void) throw "Unsupported encoder!"; } + //Create processing thread ProcessThread *thread = new ProcessThread ( currentFile, @@ -646,7 +648,8 @@ void ProcessingDialog::startNextJob(void) m_settings->prependRelativeSourcePath() ); - if(m_settings->forceStereoDownmix() && !encoder->requiresDownmix()) + //Add audio filters + if(m_settings->forceStereoDownmix() && (!encoder->requiresDownmix()) && ((currentFile.formatAudioChannels() > 2) || (currentFile.formatAudioChannels() == 0))) { thread->addFilter(new DownmixFilter()); } @@ -665,7 +668,7 @@ void ProcessingDialog::startNextJob(void) { thread->addFilter(new NormalizeFilter(m_settings->normalizationFilterMaxVolume())); } - if(m_settings->renameOutputFilesEnabled()) + if(m_settings->renameOutputFilesEnabled() && (!m_settings->renameOutputFilesPattern().simplified().isEmpty())) { thread->setRenamePattern(m_settings->renameOutputFilesPattern()); } @@ -673,12 +676,14 @@ void ProcessingDialog::startNextJob(void) m_threadList.append(thread); m_allJobs.append(thread->getId()); + //Connect thread signals connect(thread, SIGNAL(finished()), this, SLOT(doneEncoding()), Qt::QueuedConnection); connect(thread, SIGNAL(processStateInitialized(QUuid,QString,QString,int)), m_progressModel, SLOT(addJob(QUuid,QString,QString,int)), Qt::QueuedConnection); connect(thread, SIGNAL(processStateChanged(QUuid,QString,int)), m_progressModel, SLOT(updateJob(QUuid,QString,int)), Qt::QueuedConnection); connect(thread, SIGNAL(processStateFinished(QUuid,QString,bool)), this, SLOT(processFinished(QUuid,QString,bool)), Qt::QueuedConnection); connect(thread, SIGNAL(processMessageLogged(QUuid,QString)), m_progressModel, SLOT(appendToLog(QUuid,QString)), Qt::QueuedConnection); + //Give it a go! m_runningThreads++; thread->start(); } diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp index b6898676..1b8c7ca7 100644 --- a/src/Thread_Process.cpp +++ b/src/Thread_Process.cpp @@ -128,14 +128,14 @@ void ProcessThread::processFile() return; } - //Do we need to take of downsampling the input? + //Do we need to take care of downsampling the input? if(m_encoder->requiresDownsample()) { insertDownsampleFilter(); } //Do we need Stereo downmix? - if(m_audioFile.formatAudioChannels() > 2 && m_encoder->requiresDownmix()) + if(((m_audioFile.formatAudioChannels() > 2) || (m_audioFile.formatAudioChannels() == 0)) && m_encoder->requiresDownmix()) { m_filters.prepend(new DownmixFilter()); }