summaryrefslogtreecommitdiffstats
path: root/src/engine/enginepregain.cpp
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2014-04-24 22:03:54 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2014-04-24 22:03:54 +0200
commit3dd0f2583ab0bfe3176b3d9ad95e8d84c0390d1f (patch)
tree0157cdcf698f5901424541b66f84ab4cea9a4421 /src/engine/enginepregain.cpp
parent6afa96dbcdb16789b5bde53e77b7645879ffa746 (diff)
clean up replayGain a bit and remove pow() call from process
Diffstat (limited to 'src/engine/enginepregain.cpp')
-rw-r--r--src/engine/enginepregain.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/engine/enginepregain.cpp b/src/engine/enginepregain.cpp
index 0d38e434d1..66b3e0d2d3 100644
--- a/src/engine/enginepregain.cpp
+++ b/src/engine/enginepregain.cpp
@@ -40,7 +40,7 @@ EnginePregain::EnginePregain(const char* group)
m_pPassthroughEnabled = ControlObject::getControl(ConfigKey(group, "passthrough"));
if (s_pReplayGainBoost == NULL) {
- s_pReplayGainBoost = new ControlPotmeter(ConfigKey("[ReplayGain]", "InitialReplayGainBoost"),0., 15.);
+ s_pReplayGainBoost = new ControlPotmeter(ConfigKey("[ReplayGain]", "ReplayGainBoost"), 1, 6);
s_pEnableReplayGain = new ControlObject(ConfigKey("[ReplayGain]", "ReplayGainEnabled"));
}
m_bSmoothFade = false;
@@ -63,10 +63,10 @@ EnginePregain::~EnginePregain()
void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
float fEnableReplayGain = s_pEnableReplayGain->get();
- float fReplayGainBoost = s_pReplayGainBoost->get();
+ const float fReplayGainBoost = s_pReplayGainBoost->get();
float fGain = potmeterPregain->get();
float fReplayGain = m_pControlReplayGain->get();
- float fReplayGainCorrection=1;
+ float fReplayGainCorrection = 1;
float fPassing = m_pPassthroughEnabled->get();
// TODO(XXX) Why do we do this? Removing it results in clipping at unity
// gain so I think it was trying to compensate for some issue when we added
@@ -76,13 +76,13 @@ void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
// Override replaygain value if passing through
if (fPassing > 0) {
fReplayGain = 1.0;
- } else if (fReplayGain*fEnableReplayGain != 0) {
+ } else if (fReplayGain * fEnableReplayGain != 0) {
// Here is the point, when ReplayGain Analyser takes its action, suggested gain changes from 0 to a nonzero value
// We want to smoothly fade to this last.
// Anyway we have some the problem that code cannot block the full process for one second.
// So we need to alter gain each time ::process is called.
- const float fullReplayGainBoost = fReplayGain*pow(10, fReplayGainBoost/20);
+ const float fullReplayGainBoost = fReplayGain * fReplayGainBoost;
// This means that a ReplayGain value has been calculated after the track has been loaded
const double kFadeSeconds = 1.0;
@@ -92,7 +92,7 @@ void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
if (seconds < kFadeSeconds) {
// Fade smoothly
double fadeFrac = seconds / kFadeSeconds;
- fReplayGainCorrection=(1.0-fadeFrac)+fadeFrac*fullReplayGainBoost;
+ fReplayGainCorrection = (1.0 - fadeFrac) + fadeFrac * fullReplayGainBoost;
} else {
m_bSmoothFade = false;
fReplayGainCorrection = fullReplayGainBoost;