diff options
author | Be <be@mixxx.org> | 2020-05-07 07:43:33 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2020-05-07 07:43:33 -0500 |
commit | 0786536f309e2542451ba3b00bf5eb675b8d6160 (patch) | |
tree | 5405590a8030a540bde7ea3332dc9e7a4021783d /src | |
parent | bcf0dcbe9f57bf825326285c34cfe818578e81dc (diff) | |
parent | b25d0ed9d570a91de8b200a123290461f7f1e763 (diff) |
Merge remote-tracking branch 'upstream/2.2'
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/enginemaster.cpp | 17 | ||||
-rw-r--r-- | src/engine/enginesidechaincompressor.cpp | 5 | ||||
-rw-r--r-- | src/engine/enginesidechaincompressor.h | 6 | ||||
-rw-r--r-- | src/engine/enginetalkoverducking.cpp | 12 |
4 files changed, 24 insertions, 16 deletions
diff --git a/src/engine/enginemaster.cpp b/src/engine/enginemaster.cpp index cfbf89bf05..071a510549 100644 --- a/src/engine/enginemaster.cpp +++ b/src/engine/enginemaster.cpp @@ -469,11 +469,20 @@ void EngineMaster::process(const int iBufferSize) { m_pTalkover, m_iBufferSize, m_iSampleRate, busFeatures); - - // Clear talkover compressor for the next round of gain calculation. - m_pTalkoverDucking->clearKeys(); - if (m_pTalkoverDucking->getMode() != EngineTalkoverDucking::OFF) { + switch (m_pTalkoverDucking->getMode()) { + case EngineTalkoverDucking::OFF: + m_pTalkoverDucking->setAboveThreshold(false); + break; + case EngineTalkoverDucking::AUTO: m_pTalkoverDucking->processKey(m_pTalkover, m_iBufferSize); + break; + case EngineTalkoverDucking::MANUAL: + m_pTalkoverDucking->setAboveThreshold(m_activeTalkoverChannels.size()); + break; + default: + DEBUG_ASSERT("!Unknown Ducking mode"); + m_pTalkoverDucking->setAboveThreshold(false); + break; } // Calculate the crossfader gains for left and right side of the crossfader diff --git a/src/engine/enginesidechaincompressor.cpp b/src/engine/enginesidechaincompressor.cpp index 7ef6793994..e2bf54f2d6 100644 --- a/src/engine/enginesidechaincompressor.cpp +++ b/src/engine/enginesidechaincompressor.cpp @@ -38,11 +38,12 @@ void EngineSideChainCompressor::calculateRates() { << "decay per frame: " << m_decayPerFrame; } -void EngineSideChainCompressor::clearKeys() { - m_bAboveThreshold = false; +void EngineSideChainCompressor::setAboveThreshold(bool value) { + m_bAboveThreshold = value; } void EngineSideChainCompressor::processKey(const CSAMPLE* pIn, const int iBufferSize) { + m_bAboveThreshold = false; for (int i = 0; i + 1 < iBufferSize; i += 2) { CSAMPLE val = (pIn[i] + pIn[i + 1]) / 2; if (val > m_threshold) { diff --git a/src/engine/enginesidechaincompressor.h b/src/engine/enginesidechaincompressor.h index c2ac57db95..e7b043f267 100644 --- a/src/engine/enginesidechaincompressor.h +++ b/src/engine/enginesidechaincompressor.h @@ -40,10 +40,8 @@ class EngineSideChainCompressor { calculateRates(); } - - // Before calling processKey on multiple channels, first call clearKeys to - // clear state from the last round of compressor gain calculation. - void clearKeys(); + /// Forces the above threshold flag to the given value without calculations + void setAboveThreshold(bool value); // Every loop, before calling process, first call processKey to feed // the compressor the input key signal. It is safe to call this function diff --git a/src/engine/enginetalkoverducking.cpp b/src/engine/enginetalkoverducking.cpp index 457c43e7a3..02e9830e9c 100644 --- a/src/engine/enginetalkoverducking.cpp +++ b/src/engine/enginetalkoverducking.cpp @@ -67,13 +67,13 @@ void EngineTalkoverDucking::slotDuckModeChanged(double mode) { CSAMPLE EngineTalkoverDucking::getGain(int numFrames) { // Apply microphone ducking. switch (getMode()) { - case EngineTalkoverDucking::OFF: + case EngineTalkoverDucking::OFF: return 1.0; - case EngineTalkoverDucking::AUTO: + case EngineTalkoverDucking::AUTO: + case EngineTalkoverDucking::MANUAL: return calculateCompressedGain(numFrames); - case EngineTalkoverDucking::MANUAL: - return m_pDuckStrength->get(); + default: + DEBUG_ASSERT("!Unknown Ducking mode"); + return 1.0; } - qWarning() << "Invalid ducking mode, returning 1.0"; - return 1.0; } |