diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-01-29 15:36:06 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-01-29 22:55:18 +0100 |
commit | 933a67489111ed8372f29cc213e2399465592c19 (patch) | |
tree | 91e281367688f2bd4be8eba8892f20c55d0d1746 /rbutil/rbutilqt/base/encoderlame.cpp | |
parent | a489a6be8a483aa206cfb6b7d6b1edac1be93291 (diff) |
libmp3lame: add quality and volume settings.
Change-Id: I220526f071dadc69791e5bf6d23cfce2bf9ba045
Diffstat (limited to 'rbutil/rbutilqt/base/encoderlame.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/encoderlame.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/rbutil/rbutilqt/base/encoderlame.cpp b/rbutil/rbutilqt/base/encoderlame.cpp index 52937e9109..75289481fb 100644 --- a/rbutil/rbutilqt/base/encoderlame.cpp +++ b/rbutil/rbutilqt/base/encoderlame.cpp @@ -59,11 +59,23 @@ void EncoderLame::generateSettings() // no settings for now. // show lame version. if(m_symbolsResolved) { - insertSetting(eVOLUME, new EncTtsSetting(this, EncTtsSetting::eREADONLYSTRING, + double quality = RbSettings::subValue("lame", + RbSettings::EncoderQuality).toDouble(); + // default quality is 0.999. + if(quality < 0) { + quality = 0.99; + } + insertSetting(LAMEVERSION, new EncTtsSetting(this, EncTtsSetting::eREADONLYSTRING, tr("LAME"), QString(m_get_lame_short_version()))); + insertSetting(VOLUME, new EncTtsSetting(this, EncTtsSetting::eDOUBLE, + tr("Volume"), + RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble(), + 0.0, 1.0)); + insertSetting(QUALITY, new EncTtsSetting(this, EncTtsSetting::eDOUBLE, + tr("Quality"), quality, 0.0, 1.0)); } else { - insertSetting(eVOLUME, new EncTtsSetting(this, EncTtsSetting::eREADONLYSTRING, + insertSetting(LAMEVERSION, new EncTtsSetting(this, EncTtsSetting::eREADONLYSTRING, tr("LAME"), tr("Could not find libmp3lame!"))); } } @@ -71,6 +83,10 @@ void EncoderLame::generateSettings() void EncoderLame::saveSettings() { // no user settings right now. + RbSettings::setSubValue("lame", RbSettings::EncoderVolume, + getSetting(VOLUME)->current().toDouble()); + RbSettings::setSubValue("lame", RbSettings::EncoderQuality, + getSetting(QUALITY)->current().toDouble()); } bool EncoderLame::start() @@ -110,10 +126,14 @@ bool EncoderLame::encode(QString input,QString output) gfp = m_lame_init(); m_lame_set_out_samplerate(gfp, 12000); // resample to 12kHz - m_lame_set_scale(gfp, 1.0); // scale input volume + // scale input volume + m_lame_set_scale(gfp, + RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble()); m_lame_set_mode(gfp, MONO); // mono output mode m_lame_set_VBR(gfp, vbr_default); // enable default VBR mode - m_lame_set_VBR_quality(gfp, 9.999f); // VBR quality + // VBR quality + m_lame_set_VBR_quality(gfp, + RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble()); m_lame_set_VBR_max_bitrate_kbps(gfp, 64); // maximum bitrate 64kbps m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag. |