Support for Wave (PCM) output.
This commit is contained in:
parent
a8554a2d5c
commit
e189eb08c2
@ -366,6 +366,10 @@
|
||||
RelativePath=".\src\Encoder_Vorbis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Encoder_Wave.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Genres.cpp"
|
||||
>
|
||||
@ -944,6 +948,40 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Encoder_Wave.h"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="MOC "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)""
|
||||
Outputs=""$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="MOC "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)""
|
||||
Outputs=""$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release_Static|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="MOC "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
CommandLine=""$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\MOC_$(SafeInputName).cpp" "$(InputPath)""
|
||||
Outputs=""$(SolutionDir)tmp\MOC_$(SafeInputName).cpp""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Genres.h"
|
||||
>
|
||||
@ -1352,6 +1390,10 @@
|
||||
RelativePath=".\tmp\MOC_Encoder_Vorbis.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\tmp\MOC_Encoder_Wave.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\tmp\MOC_Model_FileList.cpp"
|
||||
>
|
||||
|
@ -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 157
|
||||
#define VER_LAMEXP_BUILD 161
|
||||
#define VER_LAMEXP_SUFFIX TechPreview
|
||||
|
||||
/*
|
||||
|
@ -599,9 +599,10 @@ void MainWindow::encodeButtonClicked(void)
|
||||
case SettingsModel::VorbisEncoder:
|
||||
case SettingsModel::AACEncoder:
|
||||
case SettingsModel::FLACEncoder:
|
||||
case SettingsModel::PCMEncoder:
|
||||
break;
|
||||
default:
|
||||
QMessageBox::warning(this, "LameXP", "Sorry, only MP3, Vorbis, AAC and FLAC encoding is supported at the moment.<br>Support for more encoders to be added in later versions!");
|
||||
QMessageBox::warning(this, "LameXP", "Sorry, an unsupported encoder has been chosen!");
|
||||
tabWidget->setCurrentIndex(3);
|
||||
return;
|
||||
}
|
||||
@ -815,6 +816,10 @@ void MainWindow::styleActionActivated(QAction *action)
|
||||
*/
|
||||
void MainWindow::outputFolderViewClicked(const QModelIndex &index)
|
||||
{
|
||||
if(outputFolderView->currentIndex() != index)
|
||||
{
|
||||
outputFolderView->setCurrentIndex(index);
|
||||
}
|
||||
QString selectedDir = m_fileSystemModel->filePath(index);
|
||||
if(selectedDir.length() < 3) selectedDir.append(QDir::separator());
|
||||
outputFolderLabel->setText(selectedDir);
|
||||
@ -1288,7 +1293,10 @@ void MainWindow::restoreCursor(void)
|
||||
*/
|
||||
void MainWindow::sourceFilesContextMenu(const QPoint &pos)
|
||||
{
|
||||
m_sourceFilesContextMenu->popup(sourceFileView->mapToGlobal(pos));
|
||||
if(pos.x() <= sourceFileView->width() && pos.y() <= sourceFileView->height() && pos.x() >= 0 && pos.y() >= 0)
|
||||
{
|
||||
m_sourceFilesContextMenu->popup(sourceFileView->mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1366,7 +1374,11 @@ void MainWindow::findFileContextActionTriggered(void)
|
||||
*/
|
||||
void MainWindow::outputFolderContextMenu(const QPoint &pos)
|
||||
{
|
||||
m_outputFolderContextMenu->popup(outputFolderView->mapToGlobal(pos));
|
||||
|
||||
if(pos.x() <= outputFolderView->width() && pos.y() <= outputFolderView->height() && pos.x() >= 0 && pos.y() >= 0)
|
||||
{
|
||||
m_outputFolderContextMenu->popup(outputFolderView->mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "Encoder_Vorbis.h"
|
||||
#include "Encoder_AAC.h"
|
||||
#include "Encoder_FLAC.h"
|
||||
#include "Encoder_Wave.h"
|
||||
#include "WinSevenTaskbar.h"
|
||||
|
||||
#include <QApplication>
|
||||
@ -455,6 +456,14 @@ void ProcessingDialog::startNextJob(void)
|
||||
encoder = flacEncoder;
|
||||
}
|
||||
break;
|
||||
case SettingsModel::PCMEncoder:
|
||||
{
|
||||
WaveEncoder *waveEncoder = new WaveEncoder();
|
||||
waveEncoder->setBitrate(m_settings->compressionBitrate());
|
||||
waveEncoder->setRCMode(m_settings->compressionRCMode());
|
||||
encoder = waveEncoder;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw "Unsupported encoder!";
|
||||
}
|
||||
|
93
src/Encoder_Wave.cpp
Normal file
93
src/Encoder_Wave.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2010 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
|
||||
// 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 "Encoder_Wave.h"
|
||||
|
||||
#include "Global.h"
|
||||
#include "Model_Settings.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <Shellapi.h>
|
||||
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData()))
|
||||
#define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; }
|
||||
|
||||
WaveEncoder::WaveEncoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
WaveEncoder::~WaveEncoder(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaInfo, const QString &outputFile, volatile bool *abortFlag)
|
||||
{
|
||||
emit messageLogged(QString("Moving file \"%1\" to \"%2\"").arg(sourceFile, outputFile));
|
||||
|
||||
SHFILEOPSTRUCTW fileOperation;
|
||||
memset(&fileOperation, 0, sizeof(SHFILEOPSTRUCTW));
|
||||
fileOperation.wFunc = FO_MOVE;
|
||||
fileOperation.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_FILESONLY;
|
||||
|
||||
size_t srcLen = wcslen(reinterpret_cast<const wchar_t*>(sourceFile.utf16())) + 3;
|
||||
wchar_t *srcBuffer = new wchar_t[srcLen];
|
||||
memset(srcBuffer, 0, srcLen * sizeof(wchar_t));
|
||||
wcscpy_s(srcBuffer, srcLen, reinterpret_cast<const wchar_t*>(sourceFile.utf16()));
|
||||
FIX_SEPARATORS (srcBuffer);
|
||||
fileOperation.pFrom = srcBuffer;
|
||||
|
||||
size_t outLen = wcslen(reinterpret_cast<const wchar_t*>(outputFile.utf16())) + 3;
|
||||
wchar_t *outBuffer = new wchar_t[outLen];
|
||||
memset(outBuffer, 0, outLen * sizeof(wchar_t));
|
||||
wcscpy_s(outBuffer, outLen, reinterpret_cast<const wchar_t*>(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);
|
||||
}
|
||||
|
||||
QString WaveEncoder::extension(void)
|
||||
{
|
||||
return "wav";
|
||||
}
|
||||
|
||||
bool WaveEncoder::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;
|
||||
}
|
39
src/Encoder_Wave.h
Normal file
39
src/Encoder_Wave.h
Normal file
@ -0,0 +1,39 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2010 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
|
||||
// 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 "Encoder_Abstract.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class WaveEncoder : public AbstractEncoder
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WaveEncoder(void);
|
||||
~WaveEncoder(void);
|
||||
|
||||
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);
|
||||
};
|
Loading…
Reference in New Issue
Block a user