Make sampling rate option work with Vorbis encoder.

This commit is contained in:
LoRd_MuldeR 2011-01-23 23:03:44 +01:00
parent 7e44c69c03
commit dcf4181974
7 changed files with 75 additions and 4 deletions

View File

@ -980,7 +980,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>604</width> <width>604</width>
<height>399</height> <height>431</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_22"> <layout class="QGridLayout" name="gridLayout_22">
@ -1619,7 +1619,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0"> <item row="6" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -1635,6 +1635,46 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="buttonResetAdvancedOptions">
<property name="minimumSize">
<size>
<width>175</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Reset Advanced Options </string>
</property>
<property name="icon">
<iconset resource="../res/Icons.qrc">
<normaloff>:/icons/bomb.png</normaloff>:/icons/bomb.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_24">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -2087,6 +2127,7 @@
<include location="../res/Icons.qrc"/> <include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/> <include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/> <include location="../res/Icons.qrc"/>
<include location="../res/Icons.qrc"/>
</resources> </resources>
<connections> <connections>
<connection> <connection>

View File

@ -25,7 +25,7 @@
#define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MAJOR 4
#define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_HI 0
#define VER_LAMEXP_MINOR_LO 0 #define VER_LAMEXP_MINOR_LO 0
#define VER_LAMEXP_BUILD 251 #define VER_LAMEXP_BUILD 252
#define VER_LAMEXP_SUFFIX Beta-1 #define VER_LAMEXP_SUFFIX Beta-1
/* /*

View File

@ -229,6 +229,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
connect(comboBoxSamplingRate, SIGNAL(currentIndexChanged(int)), this, SLOT(samplingRateChanged(int))); connect(comboBoxSamplingRate, SIGNAL(currentIndexChanged(int)), this, SLOT(samplingRateChanged(int)));
connect(checkBoxNeroAAC2PassMode, SIGNAL(clicked(bool)), this, SLOT(neroAAC2PassChanged(bool))); connect(checkBoxNeroAAC2PassMode, SIGNAL(clicked(bool)), this, SLOT(neroAAC2PassChanged(bool)));
connect(comboBoxNeroAACProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(neroAACProfileChanged(int))); connect(comboBoxNeroAACProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(neroAACProfileChanged(int)));
connect(buttonResetAdvancedOptions, SIGNAL(clicked()), this, SLOT(resetAdvancedOptionsButtonClicked()));
updateLameAlgoQuality(sliderLameAlgoQuality->value()); updateLameAlgoQuality(sliderLameAlgoQuality->value());
//Activate file menu actions //Activate file menu actions
@ -1688,6 +1689,21 @@ void MainWindow::neroAACProfileChanged(int value)
if(value >= 0) m_settings->neroAACProfile(value); if(value >= 0) m_settings->neroAACProfile(value);
} }
/*
* Reset all advanced options to their defaults
*/
void MainWindow::resetAdvancedOptionsButtonClicked()
{
sliderLameAlgoQuality->setValue(m_settings->lameAlgoQualityDefault());
spinBoxBitrateManagementMin->setValue(m_settings->bitrateManagementMinRateDefault());
spinBoxBitrateManagementMax->setValue(m_settings->bitrateManagementMaxRateDefault());
comboBoxMP3ChannelMode->setCurrentIndex(m_settings->lameChannelModeDefault());
comboBoxSamplingRate->setCurrentIndex(m_settings->samplingRateDefault());
comboBoxNeroAACProfile->setCurrentIndex(m_settings->neroAACProfileDefault());
while(checkBoxBitrateManagement->isChecked() != m_settings->bitrateManagementEnabledDefault()) checkBoxBitrateManagement->click();
while(checkBoxNeroAAC2PassMode->isChecked() != m_settings->neroAACEnable2PassDefault()) checkBoxNeroAAC2PassMode->click();
}
/* /*
* Model reset * Model reset
*/ */

View File

@ -87,6 +87,7 @@ private slots:
void channelModeChanged(int value); void channelModeChanged(int value);
void neroAACProfileChanged(int value); void neroAACProfileChanged(int value);
void neroAAC2PassChanged(bool checked); void neroAAC2PassChanged(bool checked);
void resetAdvancedOptionsButtonClicked();
void sourceModelChanged(void); void sourceModelChanged(void);
void metaTagsEnabledChanged(void); void metaTagsEnabledChanged(void);
void playlistEnabledChanged(void); void playlistEnabledChanged(void);

View File

@ -454,6 +454,7 @@ void ProcessingDialog::startNextJob(void)
{ {
vorbisEncoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate()); vorbisEncoder->setBitrateLimits(m_settings->bitrateManagementMinRate(), m_settings->bitrateManagementMaxRate());
} }
vorbisEncoder->setSamplingRate(SettingsModel::samplingRates[m_settings->samplingRate()]);
encoder = vorbisEncoder; encoder = vorbisEncoder;
} }
break; break;

View File

@ -44,6 +44,7 @@ VorbisEncoder::VorbisEncoder(void)
m_configBitrateMaximum = 0; m_configBitrateMaximum = 0;
m_configBitrateMinimum = 0; m_configBitrateMinimum = 0;
m_configSamplingRate = 0;
} }
VorbisEncoder::~VorbisEncoder(void) VorbisEncoder::~VorbisEncoder(void)
@ -77,6 +78,11 @@ bool VorbisEncoder::encode(const QString &sourceFile, const AudioFileModel &meta
args << "--max-bitrate" << QString::number(min(max(m_configBitrateMaximum, 32), 500)); args << "--max-bitrate" << QString::number(min(max(m_configBitrateMaximum, 32), 500));
} }
if(m_configSamplingRate > 0)
{
args << "--resample" << QString::number(m_configSamplingRate) << "--converter" << QString::number(0);
}
if(!metaInfo.fileName().isEmpty()) args << "-t" << metaInfo.fileName(); if(!metaInfo.fileName().isEmpty()) args << "-t" << metaInfo.fileName();
if(!metaInfo.fileArtist().isEmpty()) args << "-a" << metaInfo.fileArtist(); if(!metaInfo.fileArtist().isEmpty()) args << "-a" << metaInfo.fileArtist();
if(!metaInfo.fileAlbum().isEmpty()) args << "-l" << metaInfo.fileAlbum(); if(!metaInfo.fileAlbum().isEmpty()) args << "-l" << metaInfo.fileAlbum();
@ -182,3 +188,8 @@ void VorbisEncoder::setBitrateLimits(int minimumBitrate, int maximumBitrate)
m_configBitrateMinimum = minimumBitrate; m_configBitrateMinimum = minimumBitrate;
m_configBitrateMaximum = maximumBitrate; m_configBitrateMaximum = maximumBitrate;
} }
void VorbisEncoder::setSamplingRate(int value)
{
m_configSamplingRate = value;
}

View File

@ -37,6 +37,7 @@ public:
virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion); virtual bool isFormatSupported(const QString &containerType, const QString &containerProfile, const QString &formatType, const QString &formatProfile, const QString &formatVersion);
virtual QString extension(void); virtual QString extension(void);
virtual void setBitrateLimits(int minimumBitrate, int maximumBitrate); virtual void setBitrateLimits(int minimumBitrate, int maximumBitrate);
virtual void setSamplingRate(int value);
private: private:
const QString m_binary_i386; const QString m_binary_i386;
@ -44,5 +45,5 @@ private:
const QString m_binary_x64; const QString m_binary_x64;
int m_configBitrateMaximum; int m_configBitrateMaximum;
int m_configBitrateMinimum; int m_configBitrateMinimum;
int m_configSamplingRate;
}; };