Skip to content

Commit

Permalink
refactor(engine): Rename EngineMaster to EngineMixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Sep 11, 2023
1 parent 082c75f commit 28c2f2c
Show file tree
Hide file tree
Showing 47 changed files with 266 additions and 260 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/engine/effects/engineeffectsmanager.cpp
src/engine/enginebuffer.cpp
src/engine/enginedelay.cpp
src/engine/enginemaster.cpp
src/engine/enginemixer.cpp
src/engine/engineobject.cpp
src/engine/enginepregain.cpp
src/engine/enginesidechaincompressor.cpp
Expand Down Expand Up @@ -1856,7 +1856,7 @@ add_executable(mixxx-test
src/test/enginebuffertest.cpp
src/test/engineeffectsdelay_test.cpp
src/test/enginefilterbiquadtest.cpp
src/test/enginemastertest.cpp
src/test/enginemixertest.cpp
src/test/enginemicrophonetest.cpp
src/test/enginesynctest.cpp
src/test/fileinfo_test.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/broadcast/broadcastmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "broadcast/broadcastmanager.h"
#include "broadcast/defs_broadcast.h"
#include "engine/enginemaster.h"
#include "engine/enginemixer.h"
#include "engine/sidechain/enginenetworkstream.h"
#include "engine/sidechain/enginesidechain.h"
#include "moc_broadcastmanager.cpp"
Expand Down
8 changes: 4 additions & 4 deletions src/coreservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "controllers/keyboard/keyboardeventfilter.h"
#include "database/mixxxdb.h"
#include "effects/effectsmanager.h"
#include "engine/enginemaster.h"
#include "engine/enginemixer.h"
#include "library/coverartcache.h"
#include "library/library.h"
#include "library/library_prefs.h"
Expand Down Expand Up @@ -258,7 +258,7 @@ void CoreServices::initialize(QApplication* pApp) {
emit initializationProgressUpdate(20, tr("effects"));
m_pEffectsManager = std::make_shared<EffectsManager>(pConfig, pChannelHandleFactory);

m_pEngine = std::make_shared<EngineMaster>(
m_pEngine = std::make_shared<EngineMixer>(
pConfig,
"[Master]",
m_pEffectsManager.get(),
Expand Down Expand Up @@ -615,8 +615,8 @@ void CoreServices::finalize() {
CLEAR_AND_CHECK_DELETED(m_pBroadcastManager);
#endif

// EngineMaster depends on Config and m_pEffectsManager.
qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting EngineMaster";
// EngineMixer depends on Config and m_pEffectsManager.
qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting EngineMixer";
CLEAR_AND_CHECK_DELETED(m_pEngine);

qDebug() << t.elapsed(false).debugMillisWithUnit() << "deleting EffectsManager";
Expand Down
4 changes: 2 additions & 2 deletions src/coreservices.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class QApplication;
class CmdlineArgs;
class KeyboardEventFilter;
class EffectsManager;
class EngineMaster;
class EngineMixer;
class SoundManager;
class PlayerManager;
class RecordingManager;
Expand Down Expand Up @@ -130,7 +130,7 @@ class CoreServices : public QObject {
std::shared_ptr<EffectsManager> m_pEffectsManager;
// owned by EffectsManager
LV2Backend* m_pLV2Backend;
std::shared_ptr<EngineMaster> m_pEngine;
std::shared_ptr<EngineMixer> m_pEngine;
std::shared_ptr<SoundManager> m_pSoundManager;
std::shared_ptr<PlayerManager> m_pPlayerManager;
std::shared_ptr<RecordingManager> m_pRecordingManager;
Expand Down
2 changes: 1 addition & 1 deletion src/effects/backends/effectprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
///
/// Each EffectState instance tracks the state for one combination of input signal
/// and output signal. Input signals can be any EngineChannel, but output channels
/// are hardcoded in EngineMaster as the postfader processing for the main mix
/// are hardcoded in EngineMixer as the postfader processing for the main mix
/// and prefader processing for headphones. There can be many EffectStates for one
/// EffectProcessorImpl, allowing a single EffectProcessorImpl to maintain
/// independent state for each combination of input and output signal. This allows
Expand Down
4 changes: 2 additions & 2 deletions src/engine/channelhandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ inline qhash_seed_t qHash(
return qHash(handleGroup.handle(), seed);
}

// A helper class used by EngineMaster to assign ChannelHandles to channel group
// A helper class used by EngineMixer to assign ChannelHandles to channel group
// strings. Warning: ChannelHandles produced by different ChannelHandleFactory
// objects are not compatible and will produce incorrect results when compared,
// stored in the same container, etc. In practice we only use one instance in
// EngineMaster.
// EngineMixer.
class ChannelHandleFactory {
public:
ChannelHandleFactory() : m_iNextHandle(0) {
Expand Down
20 changes: 10 additions & 10 deletions src/engine/channelmixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include "util/timer.h"

// static
void ChannelMixer::applyEffectsAndMixChannels(const EngineMaster::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMaster::ChannelInfo*, kPreallocatedChannels>& activeChannels,
QVarLengthArray<EngineMaster::GainCache, kPreallocatedChannels>* channelGainCache,
void ChannelMixer::applyEffectsAndMixChannels(const EngineMixer::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMixer::ChannelInfo*, kPreallocatedChannels>& activeChannels,
QVarLengthArray<EngineMixer::GainCache, kPreallocatedChannels>* channelGainCache,
CSAMPLE* pOutput,
const ChannelHandle& outputHandle,
unsigned int iBufferSize,
Expand All @@ -22,9 +22,9 @@ void ChannelMixer::applyEffectsAndMixChannels(const EngineMaster::GainCalculator
// D) Mixes the temporary buffer into pOutput
// The original channel input buffers are not modified.
SampleUtil::clear(pOutput, iBufferSize);
ScopedTimer t("EngineMaster::applyEffectsAndMixChannels");
ScopedTimer t("EngineMixer::applyEffectsAndMixChannels");
for (auto* pChannelInfo : activeChannels) {
EngineMaster::GainCache& gainCache = (*channelGainCache)[pChannelInfo->m_index];
EngineMixer::GainCache& gainCache = (*channelGainCache)[pChannelInfo->m_index];
CSAMPLE_GAIN oldGain = gainCache.m_gain;
CSAMPLE_GAIN newGain;
bool fadeout = gainCache.m_fadeout ||
Expand All @@ -51,10 +51,10 @@ void ChannelMixer::applyEffectsAndMixChannels(const EngineMaster::GainCalculator
}

void ChannelMixer::applyEffectsInPlaceAndMixChannels(
const EngineMaster::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMaster::ChannelInfo*, kPreallocatedChannels>&
const EngineMixer::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMixer::ChannelInfo*, kPreallocatedChannels>&
activeChannels,
QVarLengthArray<EngineMaster::GainCache, kPreallocatedChannels>*
QVarLengthArray<EngineMixer::GainCache, kPreallocatedChannels>*
channelGainCache,
CSAMPLE* pOutput,
const ChannelHandle& outputHandle,
Expand All @@ -67,10 +67,10 @@ void ChannelMixer::applyEffectsInPlaceAndMixChannels(
// A) Applies the calculated gain to the channel buffer, modifying the original input buffer
// B) Applies effects to the buffer, modifying the original input buffer
// 4. Mix the channel buffers together to make pOutput, overwriting the pOutput buffer from the last engine callback
ScopedTimer t("EngineMaster::applyEffectsInPlaceAndMixChannels");
ScopedTimer t("EngineMixer::applyEffectsInPlaceAndMixChannels");
SampleUtil::clear(pOutput, iBufferSize);
for (auto* pChannelInfo : activeChannels) {
EngineMaster::GainCache& gainCache = (*channelGainCache)[pChannelInfo->m_index];
EngineMixer::GainCache& gainCache = (*channelGainCache)[pChannelInfo->m_index];
CSAMPLE_GAIN oldGain = gainCache.m_gain;
CSAMPLE_GAIN newGain;
bool fadeout = gainCache.m_fadeout ||
Expand Down
16 changes: 8 additions & 8 deletions src/engine/channelmixer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

#include <QVarLengthArray>

#include "util/types.h"
#include "engine/enginemaster.h"
#include "effects/engineeffectsmanager.h"
#include "engine/enginemixer.h"
#include "util/types.h"

class ChannelMixer {
public:
// This does not modify the input channel buffers. All manipulation of the input
// channel buffers is done after copying to a temporary buffer, then they are mixed
// to make the output buffer.
static void applyEffectsAndMixChannels(
const EngineMaster::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMaster::ChannelInfo*,
const EngineMixer::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMixer::ChannelInfo*,
kPreallocatedChannels>& activeChannels,
QVarLengthArray<EngineMaster::GainCache, kPreallocatedChannels>*
QVarLengthArray<EngineMixer::GainCache, kPreallocatedChannels>*
channelGainCache,
CSAMPLE* pOutput,
const ChannelHandle& outputHandle,
Expand All @@ -24,10 +24,10 @@ class ChannelMixer {
EngineEffectsManager* pEngineEffectsManager);
// This does modify the input channel buffers, then mixes them to make the output buffer.
static void applyEffectsInPlaceAndMixChannels(
const EngineMaster::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMaster::ChannelInfo*,
const EngineMixer::GainCalculator& gainCalculator,
const QVarLengthArray<EngineMixer::ChannelInfo*,
kPreallocatedChannels>& activeChannels,
QVarLengthArray<EngineMaster::GainCache, kPreallocatedChannels>*
QVarLengthArray<EngineMixer::GainCache, kPreallocatedChannels>*
channelGainCache,
CSAMPLE* pOutput,
const ChannelHandle& outputHandle,
Expand Down
4 changes: 2 additions & 2 deletions src/engine/channels/engineaux.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class EngineAux : public EngineChannel, public AudioDestination {

ActiveState updateActiveState() override;

/// Called by EngineMaster whenever is requesting a new buffer of audio.
/// Called by EngineMixer whenever is requesting a new buffer of audio.
void process(CSAMPLE* pOutput, const int iBufferSize) override;
void collectFeatures(GroupFeatureState* pGroupFeatures) const override;
void postProcess(const int iBufferSize) override {
Expand All @@ -31,7 +31,7 @@ class EngineAux : public EngineChannel, public AudioDestination {
/// configured input to be processed. This is run in the callback thread of
/// the soundcard this AudioDestination was registered for! Beware, in the
/// case of multiple soundcards, this method is not re-entrant but it may be
/// concurrent with EngineMaster processing.
/// concurrent with EngineMixer processing.
void receiveBuffer(const AudioInput& input,
const CSAMPLE* pBuffer,
unsigned int nFrames) override;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/channels/enginedeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
EngineDeck::EngineDeck(
const ChannelHandleAndGroup& handleGroup,
UserSettingsPointer pConfig,
EngineMaster* pMixingEngine,
EngineMixer* pMixingEngine,
EffectsManager* pEffectsManager,
EngineChannel::ChannelOrientation defaultOrientation,
bool primaryDeck)
Expand Down
6 changes: 3 additions & 3 deletions src/engine/channels/enginedeck.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class EngineBuffer;
class EnginePregain;
class EngineBuffer;
class EngineMaster;
class EngineMixer;
class EngineVuMeter;
class EngineEffectsManager;
class ControlPushButton;
Expand All @@ -24,7 +24,7 @@ class EngineDeck : public EngineChannel, public AudioDestination {
EngineDeck(
const ChannelHandleAndGroup& handleGroup,
UserSettingsPointer pConfig,
EngineMaster* pMixingEngine,
EngineMixer* pMixingEngine,
EffectsManager* pEffectsManager,
EngineChannel::ChannelOrientation defaultOrientation,
bool primaryDeck);
Expand All @@ -43,7 +43,7 @@ class EngineDeck : public EngineChannel, public AudioDestination {
// configured input to be processed. This is run in the callback thread of
// the soundcard this AudioDestination was registered for! Beware, in the
// case of multiple soundcards, this method is not re-entrant but it may be
// concurrent with EngineMaster processing.
// concurrent with EngineMixer processing.
void receiveBuffer(const AudioInput& input,
const CSAMPLE* pBuffer,
unsigned int nFrames) override;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/channels/enginemicrophone.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class EngineMicrophone : public EngineChannel, public AudioDestination {

ActiveState updateActiveState() override;

// Called by EngineMaster whenever is requesting a new buffer of audio.
// Called by EngineMixer whenever is requesting a new buffer of audio.
void process(CSAMPLE* pOutput, const int iBufferSize) override;
void collectFeatures(GroupFeatureState* pGroupFeatures) const override;
void postProcess(const int iBufferSize) override {
Expand All @@ -34,7 +34,7 @@ class EngineMicrophone : public EngineChannel, public AudioDestination {
// configured input to be processed. This is run in the callback thread of
// the soundcard this AudioDestination was registered for! Beware, in the
// case of multiple soundcards, this method is not re-entrant but it may be
// concurrent with EngineMaster processing.
// concurrent with EngineMixer processing.
void receiveBuffer(const AudioInput& input,
const CSAMPLE* pBuffer,
unsigned int iNumSamples) override;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/controls/bpmcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "control/controlpushbutton.h"
#include "engine/channels/enginechannel.h"
#include "engine/enginebuffer.h"
#include "engine/enginemaster.h"
#include "engine/enginemixer.h"
#include "moc_bpmcontrol.cpp"
#include "track/beatutils.h"
#include "track/track.h"
Expand Down
20 changes: 10 additions & 10 deletions src/engine/controls/enginecontrol.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "engine/controls/enginecontrol.h"

#include "engine/enginebuffer.h"
#include "engine/enginemaster.h"
#include "engine/enginemixer.h"
#include "engine/sync/enginesync.h"
#include "mixer/playermanager.h"
#include "moc_enginecontrol.cpp"
Expand All @@ -10,7 +10,7 @@ EngineControl::EngineControl(const QString& group,
UserSettingsPointer pConfig)
: m_group(group),
m_pConfig(pConfig),
m_pEngineMaster(nullptr),
m_pEngineMixer(nullptr),
m_pEngineBuffer(nullptr) {
setFrameInfo(mixxx::audio::kStartFramePos,
mixxx::audio::kInvalidFramePos,
Expand Down Expand Up @@ -39,8 +39,8 @@ void EngineControl::trackBeatsUpdated(mixxx::BeatsPointer pBeats) {
void EngineControl::hintReader(gsl::not_null<HintVector*>) {
}

void EngineControl::setEngineMaster(EngineMaster* pEngineMaster) {
m_pEngineMaster = pEngineMaster;
void EngineControl::setEngineMixer(EngineMixer* pEngineMixer) {
m_pEngineMixer = pEngineMixer;
}

void EngineControl::setEngineBuffer(EngineBuffer* pEngineBuffer) {
Expand All @@ -61,8 +61,8 @@ UserSettingsPointer EngineControl::getConfig() {
return m_pConfig;
}

EngineMaster* EngineControl::getEngineMaster() {
return m_pEngineMaster;
EngineMixer* EngineControl::getEngineMixer() {
return m_pEngineMixer;
}

EngineBuffer* EngineControl::getEngineBuffer() {
Expand Down Expand Up @@ -102,17 +102,17 @@ void EngineControl::seek(double fractionalPosition) {
}

EngineBuffer* EngineControl::pickSyncTarget() {
EngineMaster* pMaster = getEngineMaster();
if (!pMaster) {
EngineMixer* pEngineMixer = getEngineMixer();
if (!pEngineMixer) {
return nullptr;
}

EngineSync* pEngineSync = pMaster->getEngineSync();
EngineSync* pEngineSync = pEngineMixer->getEngineSync();
if (!pEngineSync) {
return nullptr;
}

EngineChannel* pThisChannel = pMaster->getChannel(getGroup());
EngineChannel* pThisChannel = pEngineMixer->getChannel(getGroup());
Syncable* pSyncable = pEngineSync->pickNonSyncSyncTarget(pThisChannel);
// pickNonSyncSyncTarget can return nullptr, but if it doesn't the Syncable
// definitely has an EngineChannel.
Expand Down
8 changes: 4 additions & 4 deletions src/engine/controls/enginecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "track/beats.h"
#include "track/track_decl.h"

class EngineMaster;
class EngineMixer;
class EngineBuffer;

constexpr int kNoTrigger = -1;
Expand Down Expand Up @@ -56,7 +56,7 @@ class EngineControl : public QObject {
// target.
virtual void hintReader(gsl::not_null<HintVector*> pHintList);

virtual void setEngineMaster(EngineMaster* pEngineMaster);
virtual void setEngineMixer(EngineMixer* pEngineMixer);
void setEngineBuffer(EngineBuffer* pEngineBuffer);
virtual void setFrameInfo(mixxx::audio::FramePos currentPosition,
mixxx::audio::FramePos trackEndPosition,
Expand Down Expand Up @@ -104,15 +104,15 @@ class EngineControl : public QObject {
EngineBuffer* pickSyncTarget();

UserSettingsPointer getConfig();
EngineMaster* getEngineMaster();
EngineMixer* getEngineMixer();
EngineBuffer* getEngineBuffer();

const QString m_group;
UserSettingsPointer m_pConfig;

private:
ControlValueAtomic<FrameInfo> m_frameInfo;
EngineMaster* m_pEngineMaster;
EngineMixer* m_pEngineMixer;
EngineBuffer* m_pEngineBuffer;

friend class CueControlTest;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/effects/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct EffectsRequest {
ADD_EFFECT_TO_CHAIN,
REMOVE_EFFECT_FROM_CHAIN,
// Effects cannot currently be toggled for output channels;
// the outputs that effects are applied to are hardwired in EngineMaster
// the outputs that effects are applied to are hardwired in EngineMixer
ENABLE_EFFECT_CHAIN_FOR_INPUT_CHANNEL,
DISABLE_EFFECT_CHAIN_FOR_INPUT_CHANNEL,

Expand Down
Loading

0 comments on commit 28c2f2c

Please sign in to comment.