summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-04-06 16:56:39 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-04-06 17:00:48 +0200
commit0c4bd3a9c4258f222c9cfda65efff0353496263c (patch)
tree137161a295590574294512a47d80214168971013 /rbutil/rbutilqt
parentfe756b65deed38a82de2d6097a2bd4798f7cd0eb (diff)
downloadrockbox-0c4bd3a9c4258f222c9cfda65efff0353496263c.tar.gz
rockbox-0c4bd3a9c4258f222c9cfda65efff0353496263c.zip
libmp3lame encoder: don't retrieve settings for each run.
Retrieve the encoder settings only when creating the object or when saving. Avoids unnecessary overhead by accessing the settings object on each encoder call, which also clutters the system trace log. Change-Id: If64e5d1d5ac8f1d4b0afd1bc4851e455fc7e64c2
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/base/encoderlame.cpp13
-rw-r--r--rbutil/rbutilqt/base/encoderlame.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/rbutil/rbutilqt/base/encoderlame.cpp b/rbutil/rbutilqt/base/encoderlame.cpp
index 9550eb5681..6cc93ff742 100644
--- a/rbutil/rbutilqt/base/encoderlame.cpp
+++ b/rbutil/rbutilqt/base/encoderlame.cpp
@@ -51,6 +51,9 @@ EncoderLame::EncoderLame(QObject *parent) : EncoderBase(parent)
SYMBOLRESOLVE(lame_close, int (*)(lame_global_flags*));
qDebug() << "[EncoderLame] libmp3lame loaded:" << lib->isLoaded();
+
+ m_encoderVolume = RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble();
+ m_encoderQuality = RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble();
m_symbolsResolved = true;
}
@@ -87,6 +90,10 @@ void EncoderLame::saveSettings()
getSetting(VOLUME)->current().toDouble());
RbSettings::setSubValue("lame", RbSettings::EncoderQuality,
getSetting(QUALITY)->current().toDouble());
+ m_encoderVolume =
+ RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble();
+ m_encoderQuality =
+ RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble();
}
}
@@ -128,13 +135,11 @@ bool EncoderLame::encode(QString input,QString output)
gfp = m_lame_init();
m_lame_set_out_samplerate(gfp, 12000); // resample to 12kHz
// scale input volume
- m_lame_set_scale(gfp,
- RbSettings::subValue("lame", RbSettings::EncoderVolume).toDouble());
+ m_lame_set_scale(gfp, m_encoderVolume);
m_lame_set_mode(gfp, MONO); // mono output mode
m_lame_set_VBR(gfp, vbr_default); // enable default VBR mode
// VBR quality
- m_lame_set_VBR_quality(gfp,
- RbSettings::subValue("lame", RbSettings::EncoderQuality).toDouble());
+ m_lame_set_VBR_quality(gfp, m_encoderQuality);
m_lame_set_VBR_max_bitrate_kbps(gfp, 64); // maximum bitrate 64kbps
m_lame_set_bWriteVbrTag(gfp, 0); // disable LAME tag.
diff --git a/rbutil/rbutilqt/base/encoderlame.h b/rbutil/rbutilqt/base/encoderlame.h
index 8b9444589a..a8651f0cda 100644
--- a/rbutil/rbutilqt/base/encoderlame.h
+++ b/rbutil/rbutilqt/base/encoderlame.h
@@ -64,6 +64,8 @@ class EncoderLame : public EncoderBase
int (*m_lame_close)(lame_global_flags*);
bool m_symbolsResolved;
+ double m_encoderVolume;
+ double m_encoderQuality;
};
#endif