From a086ce30cc8b8e5aa566b3249c29b52df4680632 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 23:18:44 +0200 Subject: [PATCH] refactor(enginemixer): Remove unnecessary `[Master],num_mics_configured` --- src/engine/enginemixer.cpp | 13 ++++++------- src/engine/enginemixer.h | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/enginemixer.cpp b/src/engine/enginemixer.cpp index b3485c7caf2..12fcccd1687 100644 --- a/src/engine/enginemixer.cpp +++ b/src/engine/enginemixer.cpp @@ -46,6 +46,7 @@ EngineMixer::EngineMixer( m_headphoneGainOld(1.0), m_balleftOld(1.0), m_balrightOld(1.0), + m_numMicsConfigured(0), m_mainHandle(registerChannelGroup(group)), m_headphoneHandle(registerChannelGroup("[Headphone]")), m_mainOutputHandle(registerChannelGroup("[MasterOutput]")), @@ -116,7 +117,6 @@ EngineMixer::EngineMixer( m_pBoothDelay = new EngineDelay(group, ConfigKey(group, "boothDelay")); m_pLatencyCompensationDelay = new EngineDelay(group, ConfigKey(group, "microphoneLatencyCompensation")); - m_pNumMicsConfigured = new ControlObject(ConfigKey(group, "num_mics_configured")); // Headphone volume m_pHeadGain = new ControlAudioTaperPot(ConfigKey(group, "headGain"), -14, 14, 0.5); @@ -218,7 +218,6 @@ EngineMixer::~EngineMixer() { delete m_pHeadDelay; delete m_pBoothDelay; delete m_pLatencyCompensationDelay; - delete m_pNumMicsConfigured; delete m_pXFaderReverse; delete m_pXFaderCalibration; @@ -621,7 +620,7 @@ void EngineMixer::process(const int iBufferSize) { } // Mix talkover into main mix - if (m_pNumMicsConfigured->get() > 0) { + if (m_numMicsConfigured > 0) { SampleUtil::add(m_pMain, m_pTalkover, iBufferSize); } @@ -648,7 +647,7 @@ void EngineMixer::process(const int iBufferSize) { } // Mix talkover with main - if (m_pNumMicsConfigured->get() > 0) { + if (m_numMicsConfigured > 0) { SampleUtil::add(m_pMain, m_pTalkover, iBufferSize); } @@ -716,7 +715,7 @@ void EngineMixer::process(const int iBufferSize) { if (sidechainMixRequired()) { SampleUtil::copy(m_pSidechainMix, m_pMain, iBufferSize); - if (m_pNumMicsConfigured->get() > 0) { + if (m_numMicsConfigured > 0) { // The talkover signal Mixxx receives is delayed by the round trip latency. // There is an output latency between the time Mixxx processes the audio // and the user hears it. So if the microphone user plays on beat with @@ -1025,7 +1024,7 @@ void EngineMixer::onOutputDisconnected(const AudioOutput& output) { void EngineMixer::onInputConnected(const AudioInput& input) { switch (input.getType()) { case AudioPathType::Microphone: - m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() + 1); + m_numMicsConfigured++; break; case AudioPathType::Auxiliary: // We don't track enabled auxiliary inputs. @@ -1044,7 +1043,7 @@ void EngineMixer::onInputConnected(const AudioInput& input) { void EngineMixer::onInputDisconnected(const AudioInput& input) { switch (input.getType()) { case AudioPathType::Microphone: - m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() - 1); + m_numMicsConfigured--; break; case AudioPathType::Auxiliary: // We don't track enabled auxiliary inputs. diff --git a/src/engine/enginemixer.h b/src/engine/enginemixer.h index 1d02a5aaec1..feff02e8b24 100644 --- a/src/engine/enginemixer.h +++ b/src/engine/enginemixer.h @@ -2,6 +2,7 @@ #include #include +#include #include "audio/types.h" #include "control/controlobject.h" @@ -305,7 +306,6 @@ class EngineMixer : public QObject, public AudioSource { ControlObject* m_pMainSampleRate; ControlObject* m_pMainLatency; ControlObject* m_pAudioLatencyOverloadCount; - ControlObject* m_pNumMicsConfigured; ControlPotmeter* m_pAudioLatencyUsage; ControlPotmeter* m_pAudioLatencyOverload; EngineTalkoverDucking* m_pTalkoverDucking; @@ -336,6 +336,7 @@ class EngineMixer : public QObject, public AudioSource { CSAMPLE_GAIN m_headphoneGainOld; CSAMPLE_GAIN m_balleftOld; CSAMPLE_GAIN m_balrightOld; + std::atomic m_numMicsConfigured; const ChannelHandleAndGroup m_mainHandle; const ChannelHandleAndGroup m_headphoneHandle; const ChannelHandleAndGroup m_mainOutputHandle;