diff --git a/src/Config.h b/src/Config.h index b47df68f..979700c9 100644 --- a/src/Config.h +++ b/src/Config.h @@ -34,7 +34,7 @@ #define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_PATCH 1 -#define VER_LAMEXP_BUILD 1345 +#define VER_LAMEXP_BUILD 1346 #define VER_LAMEXP_CONFG 1338 /////////////////////////////////////////////////////////////////////////////// diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index d513b8f8..0c047fb4 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -164,7 +164,6 @@ while(0) #define FSLINK(PATH) QString("%2").arg(PATH).arg(QString(PATH).replace("-", "−")) //#define USE_NATIVE_FILE_DIALOG (lamexp_themes_enabled() || ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) < QSysInfo::WV_XP)) #define CENTER_CURRENT_OUTPUT_FOLDER_DELAYED QTimer::singleShot(125, this, SLOT(centerOutputFolderModel())) -#define RESET_SETTING(OBJ,NAME) (OBJ)->NAME((OBJ)->NAME##Default()) static const DWORD IDM_ABOUTBOX = 0xEFF0; @@ -3447,25 +3446,7 @@ void MainWindow::compressionTabEventOccurred(QWidget *sender, QEvent *event) PlaySound(MAKEINTRESOURCE(IDR_WAVE_BLAST), GetModuleHandle(NULL), SND_RESOURCE | SND_ASYNC); } - RESET_SETTING(m_settings, compressionBitrateAacEnc); - RESET_SETTING(m_settings, compressionBitrateAften); - RESET_SETTING(m_settings, compressionBitrateDcaEnc); - RESET_SETTING(m_settings, compressionBitrateLAME); - RESET_SETTING(m_settings, compressionBitrateOggEnc); - RESET_SETTING(m_settings, compressionBitrateOpusEnc); - - RESET_SETTING(m_settings, compressionRCModeAacEnc); - RESET_SETTING(m_settings, compressionRCModeAften); - RESET_SETTING(m_settings, compressionRCModeLAME); - RESET_SETTING(m_settings, compressionRCModeOggEnc); - RESET_SETTING(m_settings, compressionRCModeOpusEnc); - - RESET_SETTING(m_settings, compressionVbrLevelAacEnc); - RESET_SETTING(m_settings, compressionVbrLevelAften); - RESET_SETTING(m_settings, compressionVbrLevelFLAC); - RESET_SETTING(m_settings, compressionVbrLevelLAME); - RESET_SETTING(m_settings, compressionVbrLevelOggEnc); - + EncoderRegistry::resetAllEncoders(m_settings); m_settings->compressionEncoder(SettingsModel::MP3Encoder); ui->radioButtonEncoderMP3->setChecked(true); QTimer::singleShot(0, this, SLOT(updateEncoder())); diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index 8e33c4ee..ac960c46 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -178,14 +178,22 @@ LAMEXP_MAKE_ID(autoUpdateLastCheck, "AutoUpdate/LastCheck"); LAMEXP_MAKE_ID(bitrateManagementEnabled, "AdvancedOptions/BitrateManagement/Enabled"); LAMEXP_MAKE_ID(bitrateManagementMaxRate, "AdvancedOptions/BitrateManagement/MaxRate"); LAMEXP_MAKE_ID(bitrateManagementMinRate, "AdvancedOptions/BitrateManagement/MinRate"); -LAMEXP_MAKE_ID(compressionBitrateAacEnc, "Compression/Bitrate/AacEnc"); -LAMEXP_MAKE_ID(compressionBitrateAften, "Compression/Bitrate/Aften"); -LAMEXP_MAKE_ID(compressionBitrateDcaEnc, "Compression/Bitrate/DcaEnc"); -LAMEXP_MAKE_ID(compressionBitrateFLAC, "Compression/Bitrate/FLAC"); -LAMEXP_MAKE_ID(compressionBitrateLAME, "Compression/Bitrate/LAME"); -LAMEXP_MAKE_ID(compressionBitrateOggEnc, "Compression/Bitrate/OggEnc"); -LAMEXP_MAKE_ID(compressionBitrateOpusEnc, "Compression/Bitrate/OpusEnc"); -LAMEXP_MAKE_ID(compressionBitrateWave, "Compression/Bitrate/Wave"); +LAMEXP_MAKE_ID(compressionAbrBitrateAacEnc, "Compression/AbrTaretBitrate/AacEnc"); +LAMEXP_MAKE_ID(compressionAbrBitrateAften, "Compression/AbrTaretBitrate/Aften"); +LAMEXP_MAKE_ID(compressionAbrBitrateDcaEnc, "Compression/AbrTaretBitrate/DcaEnc"); +LAMEXP_MAKE_ID(compressionAbrBitrateFLAC, "Compression/AbrTaretBitrate/FLAC"); +LAMEXP_MAKE_ID(compressionAbrBitrateLAME, "Compression/AbrTaretBitrate/LAME"); +LAMEXP_MAKE_ID(compressionAbrBitrateOggEnc, "Compression/AbrTaretBitrate/OggEnc"); +LAMEXP_MAKE_ID(compressionAbrBitrateOpusEnc, "Compression/AbrTaretBitrate/OpusEnc"); +LAMEXP_MAKE_ID(compressionAbrBitrateWave, "Compression/AbrTaretBitrate/Wave"); +LAMEXP_MAKE_ID(compressionCbrBitrateAacEnc, "Compression/CbrTaretBitrate/AacEnc"); +LAMEXP_MAKE_ID(compressionCbrBitrateAften, "Compression/CbrTaretBitrate/Aften"); +LAMEXP_MAKE_ID(compressionCbrBitrateDcaEnc, "Compression/CbrTaretBitrate/DcaEnc"); +LAMEXP_MAKE_ID(compressionCbrBitrateFLAC, "Compression/CbrTaretBitrate/FLAC"); +LAMEXP_MAKE_ID(compressionCbrBitrateLAME, "Compression/CbrTaretBitrate/LAME"); +LAMEXP_MAKE_ID(compressionCbrBitrateOggEnc, "Compression/CbrTaretBitrate/OggEnc"); +LAMEXP_MAKE_ID(compressionCbrBitrateOpusEnc, "Compression/CbrTaretBitrate/OpusEnc"); +LAMEXP_MAKE_ID(compressionCbrBitrateWave, "Compression/CbrTaretBitrate/Wave"); LAMEXP_MAKE_ID(compressionEncoder, "Compression/Encoder"); LAMEXP_MAKE_ID(compressionRCModeAacEnc, "Compression/RCMode/AacEnc"); LAMEXP_MAKE_ID(compressionRCModeAften, "Compression/RCMode/Aften"); @@ -195,14 +203,14 @@ LAMEXP_MAKE_ID(compressionRCModeLAME, "Compression/RCMode/LAME"); LAMEXP_MAKE_ID(compressionRCModeOggEnc, "Compression/RCMode/OggEnc"); LAMEXP_MAKE_ID(compressionRCModeOpusEnc, "Compression/RCMode/OpusEnc"); LAMEXP_MAKE_ID(compressionRCModeWave, "Compression/RCMode/Wave"); -LAMEXP_MAKE_ID(compressionVbrLevelAacEnc, "Compression/VbrLevel/AacEnc"); -LAMEXP_MAKE_ID(compressionVbrLevelAften, "Compression/VbrLevel/Aften"); -LAMEXP_MAKE_ID(compressionVbrLevelDcaEnc, "Compression/VbrLevel/DcaEnc"); -LAMEXP_MAKE_ID(compressionVbrLevelFLAC, "Compression/VbrLevel/FLAC"); -LAMEXP_MAKE_ID(compressionVbrLevelLAME, "Compression/VbrLevel/LAME"); -LAMEXP_MAKE_ID(compressionVbrLevelOggEnc, "Compression/VbrLevel/OggEnc"); -LAMEXP_MAKE_ID(compressionVbrLevelOpusEnc, "Compression/VbrLevel/OpusEnc"); -LAMEXP_MAKE_ID(compressionVbrLevelWave, "Compression/VbrLevel/Wave"); +LAMEXP_MAKE_ID(compressionVbrQualityAacEnc, "Compression/VbrQualityLevel/AacEnc"); +LAMEXP_MAKE_ID(compressionVbrQualityAften, "Compression/VbrQualityLevel/Aften"); +LAMEXP_MAKE_ID(compressionVbrQualityDcaEnc, "Compression/VbrQualityLevel/DcaEnc"); +LAMEXP_MAKE_ID(compressionVbrQualityFLAC, "Compression/VbrQualityLevel/FLAC"); +LAMEXP_MAKE_ID(compressionVbrQualityLAME, "Compression/VbrQualityLevel/LAME"); +LAMEXP_MAKE_ID(compressionVbrQualityOggEnc, "Compression/VbrQualityLevel/OggEnc"); +LAMEXP_MAKE_ID(compressionVbrQualityOpusEnc, "Compression/VbrQualityLevel/OpusEnc"); +LAMEXP_MAKE_ID(compressionVbrQualityWave, "Compression/VbrQualityLevel/Wave"); LAMEXP_MAKE_ID(createPlaylist, "Flags/AutoCreatePlaylist"); LAMEXP_MAKE_ID(currentLanguage, "Localization/Language"); LAMEXP_MAKE_ID(currentLanguageFile, "Localization/UseQMFile"); @@ -553,14 +561,22 @@ LAMEXP_MAKE_OPTION_S(autoUpdateLastCheck, "Never") LAMEXP_MAKE_OPTION_B(bitrateManagementEnabled, false) LAMEXP_MAKE_OPTION_I(bitrateManagementMaxRate, 500) LAMEXP_MAKE_OPTION_I(bitrateManagementMinRate, 32) -LAMEXP_MAKE_OPTION_I(compressionBitrateAacEnc, 20) -LAMEXP_MAKE_OPTION_I(compressionBitrateAften, 15) -LAMEXP_MAKE_OPTION_I(compressionBitrateDcaEnc, 47) -LAMEXP_MAKE_OPTION_I(compressionBitrateFLAC, 0) -LAMEXP_MAKE_OPTION_I(compressionBitrateLAME, 10) -LAMEXP_MAKE_OPTION_I(compressionBitrateOggEnc, 20) -LAMEXP_MAKE_OPTION_I(compressionBitrateOpusEnc, 16) -LAMEXP_MAKE_OPTION_I(compressionBitrateWave, 0) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateAacEnc, 20) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateAften, 15) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateDcaEnc, 47) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateFLAC, 0) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateLAME, 10) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateOggEnc, 20) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateOpusEnc, 16) +LAMEXP_MAKE_OPTION_I(compressionAbrBitrateWave, 0) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateAacEnc, 20) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateAften, 15) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateDcaEnc, 47) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateFLAC, 0) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateLAME, 10) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateOggEnc, 20) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateOpusEnc, 16) +LAMEXP_MAKE_OPTION_I(compressionCbrBitrateWave, 0) LAMEXP_MAKE_OPTION_I(compressionEncoder, 0) LAMEXP_MAKE_OPTION_I(compressionRCModeAacEnc, 0) LAMEXP_MAKE_OPTION_I(compressionRCModeAften, 0) @@ -570,14 +586,14 @@ LAMEXP_MAKE_OPTION_I(compressionRCModeLAME, 0) LAMEXP_MAKE_OPTION_I(compressionRCModeOggEnc, 0) LAMEXP_MAKE_OPTION_I(compressionRCModeOpusEnc, 0) LAMEXP_MAKE_OPTION_I(compressionRCModeWave, 0) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelAacEnc, 10) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelAften, 8) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelDcaEnc, 0) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelFLAC, 8) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelLAME, 7) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelOggEnc, 5) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelOpusEnc, 0) -LAMEXP_MAKE_OPTION_I(compressionVbrLevelWave, 0) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityAacEnc, 10) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityAften, 8) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityDcaEnc, 0) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityFLAC, 8) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityLAME, 7) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityOggEnc, 5) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityOpusEnc, 0) +LAMEXP_MAKE_OPTION_I(compressionVbrQualityWave, 0) LAMEXP_MAKE_OPTION_B(createPlaylist, true) LAMEXP_MAKE_OPTION_S(currentLanguage, defaultLanguage()) LAMEXP_MAKE_OPTION_S(currentLanguageFile, QString()) diff --git a/src/Model_Settings.h b/src/Model_Settings.h index d312d72e..a71bc063 100644 --- a/src/Model_Settings.h +++ b/src/Model_Settings.h @@ -107,14 +107,22 @@ public: LAMEXP_MAKE_OPTION_B(bitrateManagementEnabled) LAMEXP_MAKE_OPTION_I(bitrateManagementMaxRate) LAMEXP_MAKE_OPTION_I(bitrateManagementMinRate) - LAMEXP_MAKE_OPTION_I(compressionBitrateAacEnc) - LAMEXP_MAKE_OPTION_I(compressionBitrateAften) - LAMEXP_MAKE_OPTION_I(compressionBitrateDcaEnc) - LAMEXP_MAKE_OPTION_I(compressionBitrateFLAC) - LAMEXP_MAKE_OPTION_I(compressionBitrateLAME) - LAMEXP_MAKE_OPTION_I(compressionBitrateOggEnc) - LAMEXP_MAKE_OPTION_I(compressionBitrateOpusEnc) - LAMEXP_MAKE_OPTION_I(compressionBitrateWave) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateAacEnc) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateAften) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateDcaEnc) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateFLAC) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateLAME) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateOggEnc) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateOpusEnc) + LAMEXP_MAKE_OPTION_I(compressionAbrBitrateWave) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateAacEnc) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateAften) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateDcaEnc) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateFLAC) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateLAME) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateOggEnc) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateOpusEnc) + LAMEXP_MAKE_OPTION_I(compressionCbrBitrateWave) LAMEXP_MAKE_OPTION_I(compressionEncoder) LAMEXP_MAKE_OPTION_I(compressionRCModeAacEnc) LAMEXP_MAKE_OPTION_I(compressionRCModeAften) @@ -124,14 +132,14 @@ public: LAMEXP_MAKE_OPTION_I(compressionRCModeOggEnc) LAMEXP_MAKE_OPTION_I(compressionRCModeOpusEnc) LAMEXP_MAKE_OPTION_I(compressionRCModeWave) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelAacEnc) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelAften) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelDcaEnc) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelFLAC) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelLAME) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelOggEnc) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelOpusEnc) - LAMEXP_MAKE_OPTION_I(compressionVbrLevelWave) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityAacEnc) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityAften) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityDcaEnc) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityFLAC) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityLAME) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityOggEnc) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityOpusEnc) + LAMEXP_MAKE_OPTION_I(compressionVbrQualityWave) LAMEXP_MAKE_OPTION_B(createPlaylist) LAMEXP_MAKE_OPTION_S(currentLanguage) LAMEXP_MAKE_OPTION_S(currentLanguageFile) diff --git a/src/Registry_Encoder.cpp b/src/Registry_Encoder.cpp index b38989dc..72114cc0 100644 --- a/src/Registry_Encoder.cpp +++ b/src/Registry_Encoder.cpp @@ -35,6 +35,8 @@ #include "Encoder_Wave.h" #define IS_VBR(RC_MODE) ((RC_MODE) == SettingsModel::VBRMode) +#define IS_ABR(RC_MODE) ((RC_MODE) == SettingsModel::ABRMode) +#define IS_CBR(RC_MODE) ((RC_MODE) == SettingsModel::CBRMode) //////////////////////////////////////////////////////////// // Create encoder instance @@ -60,7 +62,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { MP3Encoder *mp3Encoder = new MP3Encoder(); mp3Encoder->setRCMode(rcMode = settings->compressionRCModeLAME()); - mp3Encoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrLevelLAME() : settings->compressionBitrateLAME()); + mp3Encoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrQualityLAME() : settings->compressionAbrBitrateLAME()); mp3Encoder->setAlgoQuality(settings->lameAlgoQuality()); if(settings->bitrateManagementEnabled()) { @@ -81,7 +83,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { VorbisEncoder *vorbisEncoder = new VorbisEncoder(); vorbisEncoder->setRCMode(rcMode = settings->compressionRCModeOggEnc()); - vorbisEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrLevelOggEnc() : settings->compressionBitrateOggEnc()); + vorbisEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrQualityOggEnc() : settings->compressionAbrBitrateOggEnc()); if(settings->bitrateManagementEnabled()) { vorbisEncoder->setBitrateLimits(settings->bitrateManagementMinRate(), settings->bitrateManagementMaxRate()); @@ -104,7 +106,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { QAACEncoder *aacEncoder = new QAACEncoder(); aacEncoder->setRCMode(rcMode = settings->compressionRCModeAacEnc()); - aacEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrLevelAacEnc() : settings->compressionBitrateAacEnc()); + aacEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrQualityAacEnc() : settings->compressionAbrBitrateAacEnc()); aacEncoder->setProfile(settings->aacEncProfile()); aacEncoder->setCustomParams(settings->customParametersAacEnc()); encoder = aacEncoder; @@ -114,7 +116,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { FHGAACEncoder *aacEncoder = new FHGAACEncoder(); aacEncoder->setRCMode(rcMode = settings->compressionRCModeAacEnc()); - aacEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrLevelAacEnc() : settings->compressionBitrateAacEnc()); + aacEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrQualityAacEnc() : settings->compressionAbrBitrateAacEnc()); aacEncoder->setProfile(settings->aacEncProfile()); aacEncoder->setCustomParams(settings->customParametersAacEnc()); encoder = aacEncoder; @@ -124,7 +126,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { AACEncoder *aacEncoder = new AACEncoder(); aacEncoder->setRCMode(rcMode = settings->compressionRCModeAacEnc()); - aacEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrLevelAacEnc() : settings->compressionBitrateAacEnc()); + aacEncoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrQualityAacEnc() : settings->compressionAbrBitrateAacEnc()); aacEncoder->setEnable2Pass(settings->neroAACEnable2Pass()); aacEncoder->setProfile(settings->aacEncProfile()); aacEncoder->setCustomParams(settings->customParametersAacEnc()); @@ -142,7 +144,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { AC3Encoder *ac3Encoder = new AC3Encoder(); ac3Encoder->setRCMode(rcMode = settings->compressionRCModeAften()); - ac3Encoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrLevelAften() : settings->compressionBitrateAften()); + ac3Encoder->setBitrate(IS_VBR(rcMode) ? settings->compressionVbrQualityAften() : settings->compressionAbrBitrateAften()); ac3Encoder->setCustomParams(settings->customParametersAften()); ac3Encoder->setAudioCodingMode(settings->aftenAudioCodingMode()); ac3Encoder->setDynamicRangeCompression(settings->aftenDynamicRangeCompression()); @@ -155,7 +157,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett case SettingsModel::FLACEncoder: { FLACEncoder *flacEncoder = new FLACEncoder(); - flacEncoder->setBitrate(settings->compressionVbrLevelFLAC()); + flacEncoder->setBitrate(settings->compressionVbrQualityFLAC()); flacEncoder->setRCMode(SettingsModel::VBRMode); flacEncoder->setCustomParams(settings->customParametersFLAC()); encoder = flacEncoder; @@ -166,7 +168,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { OpusEncoder *opusEncoder = new OpusEncoder(); opusEncoder->setRCMode(rcMode = settings->compressionRCModeOpusEnc()); - opusEncoder->setBitrate(settings->compressionBitrateOpusEnc()); /*Opus always uses bitrate*/ + opusEncoder->setBitrate(settings->compressionAbrBitrateOpusEnc()); /*Opus always uses bitrate*/ opusEncoder->setOptimizeFor(settings->opusOptimizeFor()); opusEncoder->setEncodeComplexity(settings->opusComplexity()); opusEncoder->setFrameSize(settings->opusFramesize()); @@ -179,7 +181,7 @@ AbstractEncoder *EncoderRegistry::createInstance(const int encoderId, const Sett { DCAEncoder *dcaEncoder = new DCAEncoder(); dcaEncoder->setRCMode(SettingsModel::CBRMode); - dcaEncoder->setBitrate(IS_VBR(rcMode) ? 0 : settings->compressionBitrateDcaEnc()); + dcaEncoder->setBitrate(IS_VBR(rcMode) ? 0 : settings->compressionAbrBitrateDcaEnc()); encoder = dcaEncoder; } break; @@ -310,27 +312,17 @@ int EncoderRegistry::loadEncoderMode(SettingsModel *settings, const int encoderI #define STORE_VALUE(ENCODER_ID, RC_MODE, VALUE) do \ { \ - if(IS_VBR(RC_MODE)) \ - { \ - settings->compressionVbrLevel##ENCODER_ID(VALUE); \ - } \ - else \ - { \ - settings->compressionBitrate##ENCODER_ID(VALUE); \ - } \ + if(IS_VBR(RC_MODE)) settings->compressionVbrQuality##ENCODER_ID(VALUE); \ + if(IS_ABR(RC_MODE)) settings->compressionAbrBitrate##ENCODER_ID(VALUE); \ + if(IS_CBR(RC_MODE)) settings->compressionCbrBitrate##ENCODER_ID(VALUE); \ } \ while(0) #define LOAD_VALUE(VALUE, ENCODER_ID, RC_MODE) do \ { \ - if(IS_VBR(RC_MODE)) \ - { \ - (VALUE) = settings->compressionVbrLevel##ENCODER_ID(); \ - } \ - else \ - { \ - (VALUE) = settings->compressionBitrate##ENCODER_ID(); \ - } \ + if(IS_VBR(RC_MODE)) (VALUE) = settings->compressionVbrQuality##ENCODER_ID(); \ + if(IS_ABR(RC_MODE)) (VALUE) = settings->compressionAbrBitrate##ENCODER_ID(); \ + if(IS_CBR(RC_MODE)) (VALUE) = settings->compressionCbrBitrate##ENCODER_ID(); \ } \ while(0) @@ -384,6 +376,55 @@ int EncoderRegistry::loadEncoderValue(const SettingsModel *settings, const int e return value; } +//////////////////////////////////////////////////////////// +// Reset encoder settings +//////////////////////////////////////////////////////////// + +#define RESET_SETTING(OBJ,NAME) do \ +{ \ + (OBJ)->NAME((OBJ)->NAME##Default()); \ +} \ +while(0) + +void EncoderRegistry::resetAllEncoders(SettingsModel *settings) +{ + RESET_SETTING(settings, compressionAbrBitrateAacEnc); + RESET_SETTING(settings, compressionAbrBitrateAften); + RESET_SETTING(settings, compressionAbrBitrateDcaEnc); + RESET_SETTING(settings, compressionAbrBitrateFLAC); + RESET_SETTING(settings, compressionAbrBitrateLAME); + RESET_SETTING(settings, compressionAbrBitrateOggEnc); + RESET_SETTING(settings, compressionAbrBitrateOpusEnc); + RESET_SETTING(settings, compressionAbrBitrateWave); + + RESET_SETTING(settings, compressionCbrBitrateAacEnc); + RESET_SETTING(settings, compressionCbrBitrateAften); + RESET_SETTING(settings, compressionCbrBitrateDcaEnc); + RESET_SETTING(settings, compressionCbrBitrateFLAC); + RESET_SETTING(settings, compressionCbrBitrateLAME); + RESET_SETTING(settings, compressionCbrBitrateOggEnc); + RESET_SETTING(settings, compressionCbrBitrateOpusEnc); + RESET_SETTING(settings, compressionCbrBitrateWave); + + RESET_SETTING(settings, compressionRCModeAacEnc); + RESET_SETTING(settings, compressionRCModeAften); + RESET_SETTING(settings, compressionRCModeDcaEnc); + RESET_SETTING(settings, compressionRCModeFLAC); + RESET_SETTING(settings, compressionRCModeLAME); + RESET_SETTING(settings, compressionRCModeOggEnc); + RESET_SETTING(settings, compressionRCModeOpusEnc); + RESET_SETTING(settings, compressionRCModeWave); + + RESET_SETTING(settings, compressionVbrQualityAacEnc); + RESET_SETTING(settings, compressionVbrQualityAften); + RESET_SETTING(settings, compressionVbrQualityDcaEnc); + RESET_SETTING(settings, compressionVbrQualityFLAC); + RESET_SETTING(settings, compressionVbrQualityLAME); + RESET_SETTING(settings, compressionVbrQualityOggEnc); + RESET_SETTING(settings, compressionVbrQualityOpusEnc); + RESET_SETTING(settings, compressionVbrQualityWave); +} + //////////////////////////////////////////////////////////// // Static Functions //////////////////////////////////////////////////////////// diff --git a/src/Registry_Encoder.h b/src/Registry_Encoder.h index abbb1c36..00c8500e 100644 --- a/src/Registry_Encoder.h +++ b/src/Registry_Encoder.h @@ -41,5 +41,6 @@ public: static void saveEncoderValue(SettingsModel *settings, const int encoderId, const int rcMode, const int value); static int loadEncoderValue(const SettingsModel *settings, const int encoderId, const int rcMode); + static void resetAllEncoders(SettingsModel *settings); static int getAacEncoder(void); };