diff --git a/LameXP.vcproj b/LameXP.vcproj
index 37fe6f69..c6214ec0 100644
--- a/LameXP.vcproj
+++ b/LameXP.vcproj
@@ -310,6 +310,10 @@
RelativePath=".\src\Decoder_Vorbis.cpp"
>
+
+
@@ -370,6 +374,14 @@
RelativePath=".\src\Encoder_Wave.cpp"
>
+
+
+
+
@@ -502,6 +514,10 @@
RelativePath=".\src\Decoder_Vorbis.h"
>
+
+
@@ -951,6 +967,40 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -982,6 +1032,10 @@
/>
+
+
@@ -1394,6 +1448,10 @@
RelativePath=".\tmp\MOC_Encoder_Wave.cpp"
>
+
+
diff --git a/etc/NSIS/setup.nsi b/etc/NSIS/setup.nsi
index b175ac68..0efd4c8f 100644
--- a/etc/NSIS/setup.nsi
+++ b/etc/NSIS/setup.nsi
@@ -54,6 +54,7 @@
;--------------------------------
!include `MUI2.nsh`
+!include `WinVer.nsh`
!include `UAC.nsh`
!include `parameters.nsh`
@@ -223,6 +224,7 @@ LangString LAMEXP_LANG_LOCKEDLIST_NOPROG ${LANG_ENGLISH} "No programs that hav
LangString LAMEXP_LANG_LOCKEDLIST_SEARCH ${LANG_ENGLISH} "Searching, please wait..."
LangString LAMEXP_LANG_LOCKEDLIST_COLHDR1 ${LANG_ENGLISH} "Application"
LangString LAMEXP_LANG_LOCKEDLIST_COLHDR2 ${LANG_ENGLISH} "Process"
+LangString LAMEXP_LANG_UNINST_PERSONAL ${LANG_ENGLISH} "Do you want your personal settings to be deleted too?"
;German
LangString LAMEXP_LANG_STATUS_CLOSING ${LANG_GERMAN} "Schließe laufende Instanz, bitte warten..."
@@ -238,6 +240,7 @@ LangString LAMEXP_LANG_LOCKEDLIST_NOPROG ${LANG_GERMAN} "Es m
LangString LAMEXP_LANG_LOCKEDLIST_SEARCH ${LANG_GERMAN} "Suche, bitte warten..."
LangString LAMEXP_LANG_LOCKEDLIST_COLHDR1 ${LANG_GERMAN} "Anwendung"
LangString LAMEXP_LANG_LOCKEDLIST_COLHDR2 ${LANG_GERMAN} "Prozess"
+LangString LAMEXP_LANG_UNINST_PERSONAL ${LANG_GERMAN} "Sollen Ihre persönlichen Einstellungen ebenfalls gelöscht werden?"
;--------------------------------
@@ -254,6 +257,19 @@ Function .onInit
MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
Quit
${EndIf}
+
+ ${If} ${IsNT}
+ Goto OS_Windows_NT
+ ${Else}
+ MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, the Windows 9x series (including ME) is not supported by this application!"
+ Quit
+ ${EndIf}
+
+ OS_Windows_NT:
+ ${If} ${AtMostWinNT4}
+ MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, Windows NT 4.0 (and older) is not supported by this application!"
+ Quit
+ ${EndIf}
FunctionEnd
Function un.onInit
@@ -430,6 +446,9 @@ Section "Uninstall"
DeleteRegValue HKLM "${MyRegPath}" "StartmenuFolder"
DeleteRegValue HKLM "${MyRegPath}" "SetupLanguage"
+ MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +2
+ Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
+
!insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
SectionEnd
diff --git a/res/Tools.qrc b/res/Tools.qrc
index 99526788..623cd39d 100644
--- a/res/Tools.qrc
+++ b/res/Tools.qrc
@@ -19,6 +19,7 @@
tools/oggenc2_x64.exe
tools/selfdelete.exe
tools/shorten.exe
+ tools/sox.exe
tools/speexdec.exe
tools/takc.exe
tools/ttaenc.exe
diff --git a/res/tools/sox.exe b/res/tools/sox.exe
new file mode 100644
index 00000000..f5162879
Binary files /dev/null and b/res/tools/sox.exe differ
diff --git a/src/Config.h b/src/Config.h
index ebe616c2..5fa117f8 100644
--- a/src/Config.h
+++ b/src/Config.h
@@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0
-#define VER_LAMEXP_BUILD 163
+#define VER_LAMEXP_BUILD 167
#define VER_LAMEXP_SUFFIX TechPreview
/*
diff --git a/src/Decoder_Wave.cpp b/src/Decoder_Wave.cpp
new file mode 100644
index 00000000..8a38f134
--- /dev/null
+++ b/src/Decoder_Wave.cpp
@@ -0,0 +1,88 @@
+///////////////////////////////////////////////////////////////////////////////
+// LameXP - Audio Encoder Front-End
+// Copyright (C) 2004-2010 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 "Decoder_Wave.h"
+
+#include "Global.h"
+
+#include
+#include
+#include
+#include
+
+#define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; }
+
+WaveDecoder::WaveDecoder(void)
+{
+}
+
+WaveDecoder::~WaveDecoder(void)
+{
+}
+
+bool WaveDecoder::decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag)
+{
+ emit messageLogged(QString("Copy file \"%1\" to \"%2\"").arg(sourceFile, outputFile));
+
+ SHFILEOPSTRUCTW fileOperation;
+ memset(&fileOperation, 0, sizeof(SHFILEOPSTRUCTW));
+ fileOperation.wFunc = FO_COPY;
+ fileOperation.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_FILESONLY;
+
+ size_t srcLen = wcslen(reinterpret_cast(sourceFile.utf16())) + 3;
+ wchar_t *srcBuffer = new wchar_t[srcLen];
+ memset(srcBuffer, 0, srcLen * sizeof(wchar_t));
+ wcscpy_s(srcBuffer, srcLen, reinterpret_cast(sourceFile.utf16()));
+ FIX_SEPARATORS (srcBuffer);
+ fileOperation.pFrom = srcBuffer;
+
+ size_t outLen = wcslen(reinterpret_cast(outputFile.utf16())) + 3;
+ wchar_t *outBuffer = new wchar_t[outLen];
+ memset(outBuffer, 0, outLen * sizeof(wchar_t));
+ wcscpy_s(outBuffer, outLen, reinterpret_cast(outputFile.utf16()));
+ FIX_SEPARATORS (outBuffer);
+ fileOperation.pTo = outBuffer;
+
+ emit statusUpdated(0);
+ int result = SHFileOperation(&fileOperation);
+ emit statusUpdated(100);
+
+ emit messageLogged(QString().sprintf("\nExited with code: 0x%04X", result));
+
+ delete [] srcBuffer;
+ delete [] outBuffer;
+
+ return (result == 0 && fileOperation.fAnyOperationsAborted == false);
+}
+
+bool WaveDecoder::isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion)
+{
+ if(containerType.compare("Wave", Qt::CaseInsensitive) == 0)
+ {
+ if(formatType.compare("PCM", Qt::CaseInsensitive) == 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
diff --git a/src/Decoder_Wave.h b/src/Decoder_Wave.h
new file mode 100644
index 00000000..53cfc893
--- /dev/null
+++ b/src/Decoder_Wave.h
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+// LameXP - Audio Encoder Front-End
+// Copyright (C) 2004-2010 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 "Decoder_Abstract.h"
+
+class WaveDecoder : public AbstractDecoder
+{
+public:
+ WaveDecoder(void);
+ ~WaveDecoder(void);
+
+ virtual bool decode(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
+ static bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
+};
diff --git a/src/Dialog_About.cpp b/src/Dialog_About.cpp
index b6195797..6f812d0b 100644
--- a/src/Dialog_About.cpp
+++ b/src/Dialog_About.cpp
@@ -244,11 +244,16 @@ void AboutDialog::showMoreAbout(void)
moreAboutText += LINK("http://flac.sourceforge.net/");
moreAboutText += "
";
- moreAboutText += VSTR("MediaInfo - Media File Analysis Tool (%1)
", "mediainfo_i386.exe", "v?.?.??");
+ moreAboutText += VSTR("MediaInfo - Media File Analysis Tool (%1)
", "mediainfo_i386.exe", "v?.?.?");
moreAboutText += "Released under the terms of the GNU Leser General Public License.
";
moreAboutText += LINK("http://mediainfo.sourceforge.net/");
moreAboutText += "
";
+ moreAboutText += VSTR("SoX - Sound eXchange (%1)
", "sox.exe", "v??.?.?");
+ moreAboutText += "Released under the terms of the GNU Leser General Public License.
";
+ moreAboutText += LINK("http://sox.sourceforge.net/");
+ moreAboutText += "
";
+
moreAboutText += "Silk Icons - Over 700 icons in PNG format (v1.3)
";
moreAboutText += "By Mark James, released under the Creative Commons 'by' License.
";
moreAboutText += LINK("http://www.famfamfam.com/lab/icons/silk/");
diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp
index 59c5d824..12ab4572 100644
--- a/src/Dialog_MainWindow.cpp
+++ b/src/Dialog_MainWindow.cpp
@@ -584,6 +584,9 @@ void MainWindow::aboutButtonClicked(void)
*/
void MainWindow::encodeButtonClicked(void)
{
+ static const __int64 oneGigabyte = 1073741824;
+ static const __int64 minimumFreeDiskspaceMultiplier = 222;
+
ABORT_IF_BUSY;
if(m_fileListModel->rowCount() < 1)
@@ -593,6 +596,16 @@ void MainWindow::encodeButtonClicked(void)
return;
}
+ if(lamexp_free_diskspace(lamexp_temp_folder()) < (oneGigabyte * minimumFreeDiskspaceMultiplier))
+ {
+ QDir tempFolder(lamexp_temp_folder());
+ tempFolder.cdUp();
+ if(QMessageBox::warning(this, "Low Diskspace Warning", QString("Warning: There are less than %1 GB of free diskspace available on your system's TEMP folder!
Your TEMP folder is located at:
%2").arg(QString::number(minimumFreeDiskspaceMultiplier), tempFolder.path()), "Abort Process (Recommended)", "Ignore") != 1)
+ {
+ return;
+ }
+ }
+
switch(m_settings->compressionEncoder())
{
case SettingsModel::MP3Encoder:
diff --git a/src/Dialog_Processing.cpp b/src/Dialog_Processing.cpp
index dacfe1aa..d70873b9 100644
--- a/src/Dialog_Processing.cpp
+++ b/src/Dialog_Processing.cpp
@@ -339,7 +339,7 @@ void ProcessingDialog::doneEncoding(void)
}
else
{
- CHANGE_BACKGROUND_COLOR(frame_header, QColor("#D1FFD5"));
+ CHANGE_BACKGROUND_COLOR(frame_header, QColor("#E0FFE2"));
WinSevenTaskbar::setTaskbarState(this, WinSevenTaskbar::WinSevenTaskbarNormalState);
WinSevenTaskbar::setOverlayIcon(this, &QIcon(":/icons/accept.png"));
SET_PROGRESS_TEXT("Alle files completed successfully.");
diff --git a/src/Encoder_Abstract.cpp b/src/Encoder_Abstract.cpp
index e8aabd8c..5963edc3 100644
--- a/src/Encoder_Abstract.cpp
+++ b/src/Encoder_Abstract.cpp
@@ -39,3 +39,11 @@ AbstractEncoder::~AbstractEncoder(void)
void AbstractEncoder::setBitrate(int bitrate) { m_configBitrate = max(0, bitrate); }
void AbstractEncoder::setRCMode(int mode) { m_configRCMode = max(0, mode); }
+
+/*
+ * Default implementation
+ */
+bool AbstractEncoder::requiresDownmix(void)
+{
+ return false;
+}
diff --git a/src/Encoder_Abstract.h b/src/Encoder_Abstract.h
index 98e72882..1c829dd9 100644
--- a/src/Encoder_Abstract.h
+++ b/src/Encoder_Abstract.h
@@ -40,6 +40,7 @@ public:
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag) = 0;
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion) = 0;
virtual QString extension(void) = 0;
+ virtual bool requiresDownmix(void);
//Common setter methods
void setBitrate(int bitrate);
diff --git a/src/Encoder_MP3.cpp b/src/Encoder_MP3.cpp
index 39c297e9..7fe3cc1f 100644
--- a/src/Encoder_MP3.cpp
+++ b/src/Encoder_MP3.cpp
@@ -173,3 +173,8 @@ bool MP3Encoder::isFormatSupported(const QString &containerType, const QString &
return false;
}
+
+bool MP3Encoder::requiresDownmix(void)
+{
+ return true;
+}
diff --git a/src/Encoder_MP3.h b/src/Encoder_MP3.h
index 860cc8ad..4140c852 100644
--- a/src/Encoder_MP3.h
+++ b/src/Encoder_MP3.h
@@ -36,6 +36,7 @@ public:
virtual bool encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag);
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
virtual QString extension(void);
+ virtual bool requiresDownmix(void);
private:
const QString m_binary;
diff --git a/src/Filter_Abstract.cpp b/src/Filter_Abstract.cpp
new file mode 100644
index 00000000..c32bd742
--- /dev/null
+++ b/src/Filter_Abstract.cpp
@@ -0,0 +1,30 @@
+///////////////////////////////////////////////////////////////////////////////
+// LameXP - Audio Encoder Front-End
+// Copyright (C) 2004-2010 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_Abstract.h"
+
+AbstractFilter::AbstractFilter(void)
+{
+}
+
+AbstractFilter::~AbstractFilter(void)
+{
+}
diff --git a/src/Filter_Abstract.h b/src/Filter_Abstract.h
new file mode 100644
index 00000000..f03332f2
--- /dev/null
+++ b/src/Filter_Abstract.h
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////
+// LameXP - Audio Encoder Front-End
+// Copyright (C) 2004-2010 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 "Tool_Abstract.h"
+
+class AbstractFilter : public AbstractTool
+{
+ Q_OBJECT
+
+public:
+ AbstractFilter(void);
+ ~AbstractFilter(void);
+
+ //Internal decoder API
+ virtual bool apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag) = 0;
+};
+
diff --git a/src/Filter_Downmix.cpp b/src/Filter_Downmix.cpp
new file mode 100644
index 00000000..6c404221
--- /dev/null
+++ b/src/Filter_Downmix.cpp
@@ -0,0 +1,106 @@
+///////////////////////////////////////////////////////////////////////////////
+// LameXP - Audio Encoder Front-End
+// Copyright (C) 2004-2010 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_Downmix.h"
+
+#include "Global.h"
+
+#include
+#include
+#include
+
+DownmixFilter::DownmixFilter(void)
+:
+ m_binary(lamexp_lookup_tool("sox.exe"))
+{
+ if(m_binary.isEmpty())
+ {
+ throw "Error initializing SoX filter. Tool 'sox.exe' is not registred!";
+ }
+}
+
+DownmixFilter::~DownmixFilter(void)
+{
+}
+
+bool DownmixFilter::apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag)
+{
+ QProcess process;
+ QStringList args;
+
+ args << "-V3";
+ args << QDir::toNativeSeparators(sourceFile);
+ args << "-c2";
+ args << QDir::toNativeSeparators(outputFile);
+
+ 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_Downmix.h b/src/Filter_Downmix.h
new file mode 100644
index 00000000..7acef522
--- /dev/null
+++ b/src/Filter_Downmix.h
@@ -0,0 +1,36 @@
+///////////////////////////////////////////////////////////////////////////////
+// LameXP - Audio Encoder Front-End
+// Copyright (C) 2004-2010 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 DownmixFilter : public AbstractFilter
+{
+public:
+ DownmixFilter(void);
+ ~DownmixFilter(void);
+
+ virtual bool apply(const QString &sourceFile, const QString &outputFile, volatile bool *abortFlag);
+
+private:
+ const QString m_binary;
+};
diff --git a/src/Global.cpp b/src/Global.cpp
index 194e241d..efcefc75 100644
--- a/src/Global.cpp
+++ b/src/Global.cpp
@@ -907,6 +907,23 @@ QString lamexp_known_folder(lamexp_known_folder_t folder_id)
return folder;
}
+
+/*
+ * Get number private bytes [debug only]
+ */
+__int64 lamexp_free_diskspace(const QString &path)
+{
+ ULARGE_INTEGER freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes;
+ if(GetDiskFreeSpaceExW(reinterpret_cast(QDir::toNativeSeparators(path).utf16()), &freeBytesAvailable, &totalNumberOfBytes, &totalNumberOfFreeBytes))
+ {
+ return freeBytesAvailable.QuadPart;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
/*
* Get number private bytes [debug only]
*/
diff --git a/src/Global.h b/src/Global.h
index aa706ffe..6241bebf 100644
--- a/src/Global.h
+++ b/src/Global.h
@@ -94,6 +94,7 @@ lamexp_cpu_t lamexp_detect_cpu_features(void);
bool lamexp_clean_folder(const QString folderPath);
const QString lamexp_version2string(const QString &pattern, unsigned int version);
QString lamexp_known_folder(lamexp_known_folder_t folder_id);
+__int64 lamexp_free_diskspace(const QString &path);
//Debug-only functions
SIZE_T lamexp_dbg_private_bytes(void);
diff --git a/src/Registry_Decoder.cpp b/src/Registry_Decoder.cpp
index 9b99568e..c42ba328 100644
--- a/src/Registry_Decoder.cpp
+++ b/src/Registry_Decoder.cpp
@@ -26,6 +26,7 @@
#include "Decoder_Vorbis.h"
#include "Decoder_FLAC.h"
#include "Decoder_WMA.h"
+#include "Decoder_Wave.h"
#include
@@ -38,6 +39,7 @@ AbstractDecoder *DecoderRegistry::lookup(const QString &containerType, const QSt
PROBE_DECODER(AACDecoder);
PROBE_DECODER(FLACDecoder);
PROBE_DECODER(WMADecoder);
+ PROBE_DECODER(WaveDecoder);
return NULL;
}
diff --git a/src/Thread_Initialization.cpp b/src/Thread_Initialization.cpp
index b3ab1e29..03175c23 100644
--- a/src/Thread_Initialization.cpp
+++ b/src/Thread_Initialization.cpp
@@ -64,6 +64,7 @@ static const struct lamexp_tool_t g_lamexp_tools[] =
{"a8c50872e544a55495a824426e9378984f2ae01d", "oggenc2_x64.exe", 287},
{"cd95369051f96b9ca3a997658771c5ea52bc874d", "selfdelete.exe", UINT_MAX},
{"ffeaa70bd6321185eafcb067ab2dc441650038bf", "shorten.exe", UINT_MAX},
+ {"831f898daaba8d9787c5c02b5f4f8ace9e77de99", "sox.exe", 1431},
{"346ce516281c97e92e1b8957ddeca52edcf2d056", "speexdec.exe", UINT_MAX},
{"8a74b767cfe88bf88c068fdae0de02d65589d25e", "takc.exe", UINT_MAX},
{"1c5cedb56358a0e8c4590a863a97c94d7d7e98b2", "ttaenc.exe", UINT_MAX},
diff --git a/src/Thread_Process.cpp b/src/Thread_Process.cpp
index c7aace93..1dfab9a0 100644
--- a/src/Thread_Process.cpp
+++ b/src/Thread_Process.cpp
@@ -26,6 +26,8 @@
#include "Model_Progress.h"
#include "Encoder_Abstract.h"
#include "Decoder_Abstract.h"
+#include "Filter_Abstract.h"
+#include "Filter_Downmix.h"
#include "Registry_Decoder.h"
#include "Model_Settings.h"
@@ -94,7 +96,7 @@ void ProcessThread::processFile()
{
m_aborted = false;
bool bSuccess = true;
-
+
qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData());
emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), "Starting...", ProgressModel::JobRunning);
@@ -107,10 +109,18 @@ void ProcessThread::processFile()
return;
}
+ QList filters;
+
+ //Do we need Stereo downmix?
+ if(m_audioFile.formatAudioChannels() > 2 && m_encoder->requiresDownmix())
+ {
+ filters.prepend(new DownmixFilter());
+ }
+
QString sourceFile = m_audioFile.filePath();
//Decode source file
- if(!m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()))
+ if(!filters.isEmpty() || !m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()))
{
m_currentStep = DecodingStep;
AbstractDecoder *decoder = DecoderRegistry::lookup(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion());
@@ -139,6 +149,30 @@ void ProcessThread::processFile()
}
}
+ //Apply all filters
+ while(!filters.isEmpty())
+ {
+ QString tempFile = generateTempFileName();
+ AbstractFilter *poFilter = filters.takeFirst();
+
+ if(bSuccess)
+ {
+ connect(poFilter, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
+ connect(poFilter, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection);
+
+ m_currentStep = FilteringStep;
+ bSuccess = poFilter->apply(sourceFile, tempFile, &m_aborted);
+
+ if(bSuccess)
+ {
+ sourceFile = tempFile;
+ handleMessage("\n-------------------------------\n");
+ }
+ }
+
+ delete poFilter;
+ }
+
//Encode audio file
if(bSuccess)
{
@@ -171,6 +205,9 @@ void ProcessThread::handleUpdate(int progress)
case EncodingStep:
emit processStateChanged(m_jobId, QString("Encoding (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning);
break;
+ case FilteringStep:
+ emit processStateChanged(m_jobId, QString("Filtering (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning);
+ break;
case DecodingStep:
emit processStateChanged(m_jobId, QString("Decoding (%1%)").arg(QString::number(progress)), ProgressModel::JobRunning);
break;