summaryrefslogtreecommitdiffstats
path: root/src/engine/enginevumeter.cpp
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2014-04-12 16:33:06 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2014-04-12 16:33:06 +0200
commit5b5a29b473b253eaa080f97f32a25325da7939d7 (patch)
tree0315a7ee759aa21313be5245654c482505edfa1c /src/engine/enginevumeter.cpp
parent1a4b7e438d4b3fc67fc14a429e9ae689d4e03067 (diff)
moved PeakIndicator CO to EngineVuMeter and removed clamping from input engines
Diffstat (limited to 'src/engine/enginevumeter.cpp')
-rw-r--r--src/engine/enginevumeter.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/engine/enginevumeter.cpp b/src/engine/enginevumeter.cpp
index f125fe4a62..a121e9a95e 100644
--- a/src/engine/enginevumeter.cpp
+++ b/src/engine/enginevumeter.cpp
@@ -31,6 +31,11 @@ EngineVuMeter::EngineVuMeter(const char* group) {
// right channel VU meter
m_ctrlVuMeterR = new ControlPotmeter(ConfigKey(group, "VuMeterR"), 0., 1.);
+ //Used controlpotmeter as the example used it :/ perhaps someone with more knowledge could use something more suitable...
+ m_ctrlClipping = new ControlPotmeter(ConfigKey(group, "PeakIndicator"), 0., 1.);
+ m_ctrlClipping->set(0);
+ m_duration = 0;
+
// Initialize the calculation:
reset();
}
@@ -40,11 +45,12 @@ EngineVuMeter::~EngineVuMeter()
delete m_ctrlVuMeter;
delete m_ctrlVuMeterL;
delete m_ctrlVuMeterR;
+ delete m_ctrlClipping;
}
void EngineVuMeter::process(const CSAMPLE* pIn, CSAMPLE*, const int iBufferSize) {
CSAMPLE fVolSumL, fVolSumR;
- SampleUtil::sumAbsPerChannel(&fVolSumL, &fVolSumR, pIn, iBufferSize);
+ bool clipped = SampleUtil::sumAbsPerChannel(&fVolSumL, &fVolSumR, pIn, iBufferSize);
m_fRMSvolumeSumL += fVolSumL;
m_fRMSvolumeSumR += fVolSumR;
@@ -75,6 +81,22 @@ void EngineVuMeter::process(const CSAMPLE* pIn, CSAMPLE*, const int iBufferSize)
m_fRMSvolumeSumL = 0;
m_fRMSvolumeSumR = 0;
}
+
+ if (clipped) {
+ if (m_ctrlClipping->get() != 1.) {
+ m_ctrlClipping->set(1.);
+ }
+ m_duration = 20;
+ }
+
+ if (m_duration == 0) {
+ if (m_ctrlClipping->get() == 1.) {
+ m_ctrlClipping->set(0.);
+ }
+ }
+ else {
+ m_duration--;
+ }
}
void EngineVuMeter::collectFeatures(GroupFeatureState* pGroupFeatures) const {