From d13050c3dbda8802afc3a134dde6fac9bec7b900 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Wed, 26 Jan 2011 20:16:46 +0100 Subject: [PATCH] Added "Resample" filter, based on SoX. Used for encoders that don't support "native" resampling. Also added a "Tone Adjustment" filter, based on SoX too. --- LameXP.vcproj | 16 ++ etc/Translation/Blank.ts | 36 +++- etc/Translation/LameXP_DE.ts | 28 +++ etc/Translation/LameXP_ES.ts | 28 +++ etc/Translation/LameXP_FR.ts | 28 +++ etc/Translation/LameXP_IT.ts | 28 +++ etc/Translation/update.lst | 6 + gui/MainWindow.ui | 388 +++++++++++++++++++++++++--------- res/Tools.qrc | 2 - res/localization/LameXP_DE.qm | Bin 46479 -> 47611 bytes src/Config.h | 4 +- src/Dialog_About.cpp | 17 +- src/Dialog_MainWindow.cpp | 38 ++++ src/Dialog_MainWindow.h | 3 + src/Dialog_Processing.cpp | 23 +- src/Encoder_FLAC.cpp | 1 - src/Filter_Resample.cpp | 112 ++++++++++ src/Filter_Resample.h | 37 ++++ src/Filter_ToneAdjust.cpp | 120 +++++++++++ src/Filter_ToneAdjust.h | 38 ++++ src/Model_Settings.cpp | 4 + src/Model_Settings.h | 2 + 22 files changed, 844 insertions(+), 115 deletions(-) create mode 100644 src/Filter_Resample.cpp create mode 100644 src/Filter_Resample.h create mode 100644 src/Filter_ToneAdjust.cpp create mode 100644 src/Filter_ToneAdjust.h diff --git a/LameXP.vcproj b/LameXP.vcproj index b7b2b413..fe89e732 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -414,6 +414,14 @@ RelativePath=".\src\Filter_Normalize.cpp" > + + + + @@ -1130,6 +1138,14 @@ RelativePath=".\src\Filter_Normalize.h" > + + + + diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 43cce1f6..b16004f2 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -107,6 +107,18 @@ Open and patent-free lossless audio compression technology. + + mpg123 - Fast Console MPEG Audio Player/Decoder + + + + FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder + + + + Released under the terms of the GNU General Public License. + + AC3Filter Tools - AC3/DTS Decoder @@ -151,6 +163,10 @@ By Mark James, released under the Creative Commons 'by' License. + + LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors. + + About Third-party Software @@ -461,6 +477,10 @@ MP3 Channel Mode: + + Sampling Rate (Hz): + + 16.000 @@ -485,10 +505,6 @@ 48.000 - - Sampling Rate (Hz): - - Nero AAC Options @@ -529,6 +545,18 @@ Peak Volume (dB): + + Tone Adjustment + + + + Adjust Treble (dB): + + + + Adjust Bass (dB): + + Reset Advanced Options diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index 64a281ee..8497515c 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -159,6 +159,22 @@ The True Audio - Lossless Audio Codec + + mpg123 - Fast Console MPEG Audio Player/Decoder + + + + FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder + + + + Released under the terms of the GNU General Public License. + Veröffentlicht unter den Bestimmungen der GNU General Public License. + + + LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors. + Das Urheberrecht an LameXP liegt beit LoRd_MuldeR. Das Urheberrecht an der eingesetzten Drittsoftware liegt bei den jeweiligen Authoren. + AudioFileModel @@ -1050,6 +1066,18 @@ Encode! Kodieren! + + Tone Adjustment + Klangregelung + + + Adjust Treble (dB): + Höhen-Regler (dB): + + + Adjust Bass (dB): + Bass-Regler (dB): + MetaInfo diff --git a/etc/Translation/LameXP_ES.ts b/etc/Translation/LameXP_ES.ts index 1b08e29c..92f309bf 100644 --- a/etc/Translation/LameXP_ES.ts +++ b/etc/Translation/LameXP_ES.ts @@ -160,6 +160,22 @@ The True Audio - Lossless Audio Codec True audio - Códec de audio sin pérdida + + mpg123 - Fast Console MPEG Audio Player/Decoder + + + + FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder + + + + Released under the terms of the GNU General Public License. + + + + LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors. + + AudioFileModel @@ -1050,6 +1066,18 @@ Encode! + + Tone Adjustment + + + + Adjust Treble (dB): + + + + Adjust Bass (dB): + + MetaInfo diff --git a/etc/Translation/LameXP_FR.ts b/etc/Translation/LameXP_FR.ts index d8525b5a..d6102858 100644 --- a/etc/Translation/LameXP_FR.ts +++ b/etc/Translation/LameXP_FR.ts @@ -162,6 +162,22 @@ The True Audio - Lossless Audio Codec + + mpg123 - Fast Console MPEG Audio Player/Decoder + + + + FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder + + + + Released under the terms of the GNU General Public License. + + + + LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors. + + AudioFileModel @@ -1054,6 +1070,18 @@ Votre dossier TEMP est situé ici: Encode! + + Tone Adjustment + + + + Adjust Treble (dB): + + + + Adjust Bass (dB): + + MetaInfo diff --git a/etc/Translation/LameXP_IT.ts b/etc/Translation/LameXP_IT.ts index afa5fc25..4a041b0e 100644 --- a/etc/Translation/LameXP_IT.ts +++ b/etc/Translation/LameXP_IT.ts @@ -159,6 +159,22 @@ The True Audio - Lossless Audio Codec + + mpg123 - Fast Console MPEG Audio Player/Decoder + + + + FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder + + + + Released under the terms of the GNU General Public License. + + + + LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors. + + AudioFileModel @@ -1050,6 +1066,18 @@ Encode! + + Tone Adjustment + + + + Adjust Treble (dB): + + + + Adjust Bass (dB): + + MetaInfo diff --git a/etc/Translation/update.lst b/etc/Translation/update.lst index 39f5f6f4..ca5199d6 100644 --- a/etc/Translation/update.lst +++ b/etc/Translation/update.lst @@ -36,6 +36,9 @@ ..\..\src\Encoder_Wave.cpp ..\..\src\Filter_Abstract.cpp ..\..\src\Filter_Downmix.cpp +..\..\src\Filter_Normalize.cpp +..\..\src\Filter_Resample.cpp +..\..\src\Filter_ToneAdjust.cpp ..\..\src\Genres.cpp ..\..\src\Global.cpp ..\..\src\LockedFile.cpp @@ -85,6 +88,9 @@ ..\..\src\Encoder_Wave.h ..\..\src\Filter_Abstract.h ..\..\src\Filter_Downmix.h +..\..\src\Filter_Normalize.h +..\..\src\Filter_Resample.h +..\..\src\Filter_ToneAdjust.h ..\..\src\Genres.h ..\..\src\Global.h ..\..\src\LockedFile.h diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui index 98941b0f..62c9af30 100644 --- a/gui/MainWindow.ui +++ b/gui/MainWindow.ui @@ -7,7 +7,7 @@ 0 0 667 - 446 + 449 @@ -986,7 +986,7 @@ 0 0 604 - 520 + 609 @@ -1271,9 +1271,9 @@ Channel Mode / Sampling Rate - - - + + + QComboBox::AdjustToContents @@ -1310,39 +1310,7 @@ - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - + MP3 Channel Mode: @@ -1352,68 +1320,17 @@ - - - - Qt::Vertical + + + + Sampling Rate (Hz): - - QSizePolicy::Fixed + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 20 - 8 - - - + - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 8 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + QComboBox::AdjustToContents @@ -1455,15 +1372,98 @@ + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + - - - Sampling Rate (Hz): + + + Qt::Horizontal - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + QSizePolicy::Expanding - + + + 40 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + @@ -1768,6 +1768,184 @@ + + + + + 50 + false + + + + Tone Adjustment + + + + + + + + + 120 + 0 + + + + -20.000000000000000 + + + 20.000000000000000 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 120 + 0 + + + + -20.000000000000000 + + + 20.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Adjust Treble (dB): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Adjust Bass (dB): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 20 + 20 + + + + + + + + :/icons/cross.png:/icons/cross.png + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 8 + + + + + + + + + @@ -2300,6 +2478,10 @@ + + + + diff --git a/res/Tools.qrc b/res/Tools.qrc index a29b991a..abcdf7bf 100644 --- a/res/Tools.qrc +++ b/res/Tools.qrc @@ -17,14 +17,12 @@ tools/oggenc2_i386.exe tools/oggenc2_sse2.exe tools/oggenc2_x64.exe - tools/selfdelete.exe tools/shorten.exe tools/sox.exe tools/speexdec.exe tools/takc.exe tools/ttaenc.exe tools/valdec.exe - tools/volumax.exe tools/wget.exe tools/wupdate.exe tools/wvunpack.exe diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 8eabf44358f7876c56426779cf3ef2fad312f282..b20e8c2a896df25c0367436bee53189c9e8fe85e 100644 GIT binary patch delta 3755 zcmZuzX;f5aw%t{AZ_R@WLcgAA|N;cD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e-US2#{d8T diff --git a/src/Config.h b/src/Config.h index c48f1b60..9bbe8e43 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,8 +25,8 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 0 -#define VER_LAMEXP_BUILD 264 -#define VER_LAMEXP_SUFFIX Beta-1 +#define VER_LAMEXP_BUILD 267 +#define VER_LAMEXP_SUFFIX Beta-2 /* * Tools versions diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp index 28283d11..869dcb72 100644 --- a/src/Dialog_About.cpp +++ b/src/Dialog_About.cpp @@ -241,7 +241,7 @@ void AboutDialog::showMoreAbout(void) QString moreAboutText; moreAboutText += QString("

%1

").arg(tr("The following third-party software is used in LameXP:")); - moreAboutText += "
    "; + moreAboutText += "
      "; moreAboutText += makeToolText ( @@ -280,12 +280,23 @@ void AboutDialog::showMoreAbout(void) "http://www.mpg123.de/" ); moreAboutText += makeToolText + ( + tr("FAAD - OpenSource MPEG-4 and MPEG-2 AAC Decoder"), + "faad.exe", "v?.?", + tr("Released under the terms of the GNU General Public License."), + "http://www.audiocoding.com/" + ); + moreAboutText += makeToolText ( tr("AC3Filter Tools - AC3/DTS Decoder"), "valdec.exe", "v?.??", tr("Released under the terms of the GNU Lesser General Public License."), "http://www.ac3filter.net/projects/tools" ); + moreAboutText += QString + ( + "
      " + ); moreAboutText += makeToolText ( tr("WavPack - Hybrid Lossless Compression"), @@ -335,6 +346,10 @@ void AboutDialog::showMoreAbout(void) tr("By Mark James, released under the Creative Commons 'by' License."), "http://www.famfamfam.com/lab/icons/silk/" ); + moreAboutText += QString("
     
    %1
    ").arg + ( + tr("LameXP as a whole is copyrighted by LoRd_MuldeR. The copyright of thrird-party software used in LameXP belongs to the individual authors.") + ); QMessageBox *moreAboutBox = new QMessageBox(this); moreAboutBox->setText(moreAboutText); diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index 0b55a0f2..3cb85540 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -218,6 +218,8 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRate()); spinBoxBitrateManagementMax->setValue(m_settings->bitrateManagementMaxRate()); spinBoxNormalizationFilter->setValue(static_cast(m_settings->normalizationFilterMaxVolume()) / 100.0); + spinBoxToneAdjustBass->setValue(static_cast(m_settings->toneAdjustBass()) / 100.0); + spinBoxToneAdjustTreble->setValue(static_cast(m_settings->toneAdjustTreble()) / 100.0); comboBoxMP3ChannelMode->setCurrentIndex(m_settings->lameChannelMode()); comboBoxSamplingRate->setCurrentIndex(m_settings->samplingRate()); comboBoxNeroAACProfile->setCurrentIndex(m_settings->neroAACProfile()); @@ -234,8 +236,13 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S connect(comboBoxNeroAACProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(neroAACProfileChanged(int))); connect(checkBoxNormalizationFilter, SIGNAL(clicked(bool)), this, SLOT(normalizationEnabledChanged(bool))); connect(spinBoxNormalizationFilter, SIGNAL(valueChanged(double)), this, SLOT(normalizationMaxVolumeChanged(double))); + connect(spinBoxToneAdjustBass, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustBassChanged(double))); + connect(spinBoxToneAdjustTreble, SIGNAL(valueChanged(double)), this, SLOT(toneAdjustTrebleChanged(double))); + connect(buttonToneAdjustReset, SIGNAL(clicked()), this, SLOT(toneAdjustTrebleReset())); connect(buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked())); updateLameAlgoQuality(sliderLameAlgoQuality->value()); + toneAdjustTrebleChanged(spinBoxToneAdjustTreble->value()); + toneAdjustBassChanged(spinBoxToneAdjustBass->value()); //Activate file menu actions connect(actionOpenFolder, SIGNAL(triggered()), this, SLOT(openFolderActionActivated())); @@ -1712,6 +1719,35 @@ void MainWindow::normalizationMaxVolumeChanged(double value) m_settings->normalizationFilterMaxVolume(static_cast(value * 100.0)); } +/* + * Tone adjustment has changed (Bass) + */ +void MainWindow::toneAdjustBassChanged(double value) +{ + m_settings->toneAdjustBass(static_cast(value * 100.0)); + spinBoxToneAdjustBass->setPrefix((value > 0) ? "+" : QString()); +} + +/* + * Tone adjustment has changed (Treble) + */ +void MainWindow::toneAdjustTrebleChanged(double value) +{ + m_settings->toneAdjustTreble(static_cast(value * 100.0)); + spinBoxToneAdjustTreble->setPrefix((value > 0) ? "+" : QString()); +} + +/* + * Tone adjustment has been reset + */ +void MainWindow::toneAdjustTrebleReset() +{ + spinBoxToneAdjustBass->setValue(m_settings->toneAdjustBassDefault()); + spinBoxToneAdjustTreble->setValue(m_settings->toneAdjustTrebleDefault()); + toneAdjustBassChanged(spinBoxToneAdjustBass->value()); + toneAdjustTrebleChanged(spinBoxToneAdjustTreble->value()); +} + /* * Reset all advanced options to their defaults */ @@ -1721,6 +1757,8 @@ void MainWindow::resetAdvancedOptionsButtonClicked() spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault()); spinBoxBitrateManagementMax->setValue(m_settings->bitrateManagementMaxRateDefault()); spinBoxNormalizationFilter->setValue(static_cast(m_settings->normalizationFilterMaxVolumeDefault()) / 100.0); + spinBoxToneAdjustBass->setValue(static_cast(m_settings->toneAdjustBassDefault()) / 100.0); + spinBoxToneAdjustTreble->setValue(static_cast(m_settings->toneAdjustTrebleDefault()) / 100.0); comboBoxMP3ChannelMode->setCurrentIndex(m_settings->lameChannelModeDefault()); comboBoxSamplingRate->setCurrentIndex(m_settings->samplingRateDefault()); comboBoxNeroAACProfile->setCurrentIndex(m_settings->neroAACProfileDefault()); diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index 3010cc25..669074cf 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -89,6 +89,9 @@ private slots: void neroAAC2PassChanged(bool checked); void normalizationEnabledChanged(bool checked); void normalizationMaxVolumeChanged(double volume); + void toneAdjustBassChanged(double value); + void toneAdjustTrebleChanged(double value); + void toneAdjustTrebleReset(); void resetAdvancedOptionsButtonClicked(); void sourceModelChanged(void); void metaTagsEnabledChanged(void); diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp index 12e32931..bb225d03 100644 --- a/src/Dialog_Processing.cpp +++ b/src/Dialog_Processing.cpp @@ -34,6 +34,8 @@ #include "Encoder_FLAC.h" #include "Encoder_Wave.h" #include "Filter_Normalize.h" +#include "Filter_Resample.h" +#include "Filter_ToneAdjust.h" #include "WinSevenTaskbar.h" #include @@ -428,6 +430,7 @@ void ProcessingDialog::startNextJob(void) m_currentFile++; AudioFileModel currentFile = updateMetaInfo(m_pendingJobs.takeFirst()); AbstractEncoder *encoder = NULL; + bool nativeResampling = false; switch(m_settings->compressionEncoder()) { @@ -441,7 +444,11 @@ void ProcessingDialog::startNextJob(void) { mp3Encoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate()); } - mp3Encoder->setSamplingRate(SettingsModel::samplingRates[m_settings->samplingRate()]); + if(m_settings->samplingRate() > 0) + { + mp3Encoder->setSamplingRate(SettingsModel::samplingRates[m_settings->samplingRate()]); + nativeResampling = true; + } mp3Encoder->setChannelMode(m_settings->lameChannelMode()); encoder = mp3Encoder; } @@ -455,7 +462,11 @@ void ProcessingDialog::startNextJob(void) { vorbisEncoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate()); } - vorbisEncoder->setSamplingRate(SettingsModel::samplingRates[m_settings->samplingRate()]); + if(m_settings->samplingRate() > 0) + { + vorbisEncoder->setSamplingRate(SettingsModel::samplingRates[m_settings->samplingRate()]); + nativeResampling = true; + } encoder = vorbisEncoder; } break; @@ -497,6 +508,14 @@ void ProcessingDialog::startNextJob(void) m_settings->prependRelativeSourcePath() ); + if((m_settings->samplingRate() > 0) && !nativeResampling) + { + thread->addFilter(new ResampleFilter(SettingsModel::samplingRates[m_settings->samplingRate()])); + } + if((m_settings->toneAdjustBass() != 0) || (m_settings->toneAdjustTreble() != 0)) + { + thread->addFilter(new ToneAdjustFilter(m_settings->toneAdjustBass(), m_settings->toneAdjustTreble())); + } if(m_settings->normalizationFilterEnabled()) { thread->addFilter(new NormalizeFilter(m_settings->normalizationFilterMaxVolume())); diff --git a/src/Encoder_FLAC.cpp b/src/Encoder_FLAC.cpp index f5db9a8b..fdfd4fc3 100644 --- a/src/Encoder_FLAC.cpp +++ b/src/Encoder_FLAC.cpp @@ -51,7 +51,6 @@ bool FLACEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn QStringList args; args << QString("-%1").arg(QString::number(max(0, min(8, m_configBitrate)))); - qWarning("Year: %u", metaInfo.fileYear()); if(!metaInfo.fileName().isEmpty()) args << "-T" << QString("title=%1").arg(metaInfo.fileName()); if(!metaInfo.fileArtist().isEmpty()) args << "-T" << QString("artist=%1").arg(metaInfo.fileArtist()); diff --git a/src/Filter_Resample.cpp b/src/Filter_Resample.cpp new file mode 100644 index 00000000..4caaecc9 --- /dev/null +++ b/src/Filter_Resample.cpp @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "Filter_Resample.h" + +#include "Global.h" + +#include +#include +#include + +ResampleFilter::ResampleFilter(int samplingRate) +: + m_binary(lamexp_lookup_tool("sox.exe")) +{ + if(m_binary.isEmpty()) + { + throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; + } + + m_samplingRate = min(192000, max(8000, samplingRate)); +} + +ResampleFilter::~ResampleFilter(void) +{ +} + +bool ResampleFilter::apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag) +{ + QProcess process; + QStringList args; + + process.setWorkingDirectory(lamexp_temp_folder()); + + args << "-V3"; + args << "--guard" << "--temp" << "."; + args << QDir::toNativeSeparators(sourceFile); + args << QDir::toNativeSeparators(outputFile); + args << "rate"; + args << "-h" << QString::number(m_samplingRate); + + if(!startProcess(process, m_binary, args)) + { + return false; + } + + bool bTimeout = false; + bool bAborted = false; + + while(process.state() != QProcess::NotRunning) + { + if(*abortFlag) + { + process.kill(); + bAborted = true; + emit messageLogged("\nABORTED BY USER !!!"); + break; + } + process.waitForReadyRead(); + if(!process.bytesAvailable() && process.state() == QProcess::Running) + { + process.kill(); + qWarning("SoX process timed out <-- killing!"); + bTimeout = true; + break; + } + while(process.bytesAvailable() > 0) + { + QByteArray line = process.readLine(); + QString text = QString::fromUtf8(line.constData()).simplified(); + if(!text.isEmpty()) + { + emit messageLogged(text); + } + } + } + + process.waitForFinished(); + if(process.state() != QProcess::NotRunning) + { + process.kill(); + process.waitForFinished(-1); + } + + emit statusUpdated(100); + emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode())); + + if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0) + { + return false; + } + + return true; +} diff --git a/src/Filter_Resample.h b/src/Filter_Resample.h new file mode 100644 index 00000000..d805fd37 --- /dev/null +++ b/src/Filter_Resample.h @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "Filter_Abstract.h" + +class ResampleFilter : public AbstractFilter +{ +public: + ResampleFilter(int samplingRate = 44100); + ~ResampleFilter(void); + + virtual bool apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag); + +private: + const QString m_binary; + int m_samplingRate; +}; diff --git a/src/Filter_ToneAdjust.cpp b/src/Filter_ToneAdjust.cpp new file mode 100644 index 00000000..6d125da3 --- /dev/null +++ b/src/Filter_ToneAdjust.cpp @@ -0,0 +1,120 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#include "Filter_ToneAdjust.h" + +#include "Global.h" + +#include +#include +#include + +ToneAdjustFilter::ToneAdjustFilter(int bass, int treble) +: + m_binary(lamexp_lookup_tool("sox.exe")) +{ + if(m_binary.isEmpty()) + { + throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!"; + } + + m_bass = max(-2000, min(2000, bass)); + m_treble = max(-2000, min(2000, treble)); +} + +ToneAdjustFilter::~ToneAdjustFilter(void) +{ +} + +bool ToneAdjustFilter::apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag) +{ + QProcess process; + QStringList args; + + process.setWorkingDirectory(lamexp_temp_folder()); + + args << "-V3"; + args << "--guard" << "--temp" << "."; + args << QDir::toNativeSeparators(sourceFile); + args << QDir::toNativeSeparators(outputFile); + + if(m_bass != 0) + { + args << "bass" << QString().sprintf("%s%.2f", ((m_bass < 0) ? "-" : "+"), static_cast(abs(m_bass)) / 100.0); + } + if(m_treble != 0) + { + args << "treble" << QString().sprintf("%s%.2f", ((m_treble < 0) ? "-" : "+"), static_cast(abs(m_treble)) / 100.0); + } + + if(!startProcess(process, m_binary, args)) + { + return false; + } + + bool bTimeout = false; + bool bAborted = false; + + while(process.state() != QProcess::NotRunning) + { + if(*abortFlag) + { + process.kill(); + bAborted = true; + emit messageLogged("\nABORTED BY USER !!!"); + break; + } + process.waitForReadyRead(); + if(!process.bytesAvailable() && process.state() == QProcess::Running) + { + process.kill(); + qWarning("SoX process timed out <-- killing!"); + bTimeout = true; + break; + } + while(process.bytesAvailable() > 0) + { + QByteArray line = process.readLine(); + QString text = QString::fromUtf8(line.constData()).simplified(); + if(!text.isEmpty()) + { + emit messageLogged(text); + } + } + } + + process.waitForFinished(); + if(process.state() != QProcess::NotRunning) + { + process.kill(); + process.waitForFinished(-1); + } + + emit statusUpdated(100); + emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", process.exitCode())); + + if(bTimeout || bAborted || process.exitStatus() != QProcess::NormalExit || QFileInfo(outputFile).size() == 0) + { + return false; + } + + return true; +} diff --git a/src/Filter_ToneAdjust.h b/src/Filter_ToneAdjust.h new file mode 100644 index 00000000..7236c7c5 --- /dev/null +++ b/src/Filter_ToneAdjust.h @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////// +// LameXP - Audio Encoder Front-End +// Copyright (C) 2004-2011 LoRd_MuldeR +// +// 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 +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +// +// http://www.gnu.org/licenses/gpl-2.0.txt +/////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "Filter_Abstract.h" + +class ToneAdjustFilter : public AbstractFilter +{ +public: + ToneAdjustFilter(int bass = 0, int treble = 0); + ~ToneAdjustFilter(void); + + virtual bool apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag); + +private: + const QString m_binary; + int m_bass; + int m_treble; +}; diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index db31b99b..d29b6114 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -61,6 +61,8 @@ static const char *g_settingsId_neroAACEnable2Pass = "AdvancedOptions/NeroAAC/En static const char *g_settingsId_neroAACProfile = "AdvancedOptions/NeroAAC/ForceProfile"; static const char *g_settingsId_normalizationFilterEnabled = "AdvancedOptions/VolumeNormalization/Enabled"; static const char *g_settingsId_normalizationFilterMaxVolume = "AdvancedOptions/VolumeNormalization/MaxVolume"; +static const char *g_settingsId_toneAdjustBass = "AdvancedOptions/ToneAdjustment/Bass"; +static const char *g_settingsId_toneAdjustTreble = "AdvancedOptions/ToneAdjustment/Treble"; //Macros #define MAKE_OPTION1(OPT,DEF) \ @@ -227,3 +229,5 @@ MAKE_OPTION3(neroAACEnable2Pass, true) MAKE_OPTION1(neroAACProfile, 0) MAKE_OPTION3(normalizationFilterEnabled, false) MAKE_OPTION1(normalizationFilterMaxVolume, -50) +MAKE_OPTION1(toneAdjustBass, 0) +MAKE_OPTION1(toneAdjustTreble, 0) diff --git a/src/Model_Settings.h b/src/Model_Settings.h index 8081f033..f395bad2 100644 --- a/src/Model_Settings.h +++ b/src/Model_Settings.h @@ -93,6 +93,8 @@ public: MAKE_OPTION_DEC1(neroAACProfile) MAKE_OPTION_DEC3(normalizationFilterEnabled) MAKE_OPTION_DEC1(normalizationFilterMaxVolume) + MAKE_OPTION_DEC1(toneAdjustBass) + MAKE_OPTION_DEC1(toneAdjustTreble) //Misc void validate(void);