Skip to content

Commit

Permalink
refactor(enginemixer): Remove unnecessary [Master],num_mics_configured
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Sep 13, 2023
1 parent 6bcf52e commit 4692347
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/engine/enginemixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]")),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -218,7 +218,6 @@ EngineMixer::~EngineMixer() {
delete m_pHeadDelay;
delete m_pBoothDelay;
delete m_pLatencyCompensationDelay;
delete m_pNumMicsConfigured;

delete m_pXFaderReverse;
delete m_pXFaderCalibration;
Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/engine/enginemixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <QObject>
#include <QVarLengthArray>
#include <atomic>

#include "audio/types.h"
#include "control/controlobject.h"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -336,6 +336,7 @@ class EngineMixer : public QObject, public AudioSource {
CSAMPLE_GAIN m_headphoneGainOld;
CSAMPLE_GAIN m_balleftOld;
CSAMPLE_GAIN m_balrightOld;
std::atomic<unsigned int> m_numMicsConfigured;
const ChannelHandleAndGroup m_mainHandle;
const ChannelHandleAndGroup m_headphoneHandle;
const ChannelHandleAndGroup m_mainOutputHandle;
Expand Down

0 comments on commit 4692347

Please sign in to comment.