diff options
author | Be <be@mixxx.org> | 2021-03-12 14:21:03 -0600 |
---|---|---|
committer | Be <be@mixxx.org> | 2021-03-12 14:31:32 -0600 |
commit | 7b0a0d524db99e2b3511e1c196dd15a68ca92371 (patch) | |
tree | ab28fc16b600aca12e9110646d9f63a2c8abdcf7 | |
parent | 341f6e9fa2e72f6cb613c5abcba95ce28f76660b (diff) |
split EffectChain subclasses into separate files
21 files changed, 358 insertions, 324 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c5e935572b..310800de4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -494,7 +494,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/effects/effectslot.cpp src/effects/effectsmanager.cpp src/effects/effectsmessenger.cpp - src/effects/specialeffectchains.cpp src/effects/visibleeffectslist.cpp src/effects/backends/effectsbackend.cpp src/effects/backends/effectmanifest.cpp @@ -521,6 +520,11 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/effects/backends/builtin/tremoloeffect.cpp src/effects/backends/builtin/whitenoiseeffect.cpp src/effects/backends/effectsbackendmanager.cpp + src/effects/chains/equalizereffectchain.cpp + src/effects/chains/outputeffectchain.cpp + src/effects/chains/pergroupeffectchain.cpp + src/effects/chains/quickeffectchain.cpp + src/effects/chains/standardeffectchain.cpp src/effects/presets/effectchainpreset.cpp src/effects/presets/effectchainpresetmanager.cpp src/effects/presets/effectparameterpreset.cpp diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index a6bdd7f3da..4fc75948fb 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -2,7 +2,8 @@ #include "effects/defs.h" #include "effects/effectslot.h" -#include "effects/specialeffectchains.h" +#include "effects/chains/equalizereffectchain.h" +#include "effects/chains/standardeffectchain.h" #include "engine/controls/cuecontrol.h" #include "engine/controls/loopingcontrol.h" #include "mixer/playermanager.h" diff --git a/src/effects/chains/equalizereffectchain.cpp b/src/effects/chains/equalizereffectchain.cpp new file mode 100644 index 0000000000..4b5e7ce347 --- /dev/null +++ b/src/effects/chains/equalizereffectchain.cpp @@ -0,0 +1,77 @@ +#include "effects/chains/equalizereffectchain.h" + +#include "effects/effectslot.h" + +EqualizerEffectChain::EqualizerEffectChain(const QString& group, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger) + : PerGroupEffectChain(group, + formatEffectChainGroup(group), + SignalProcessingStage::Prefader, + pEffectsManager, + pEffectsMessenger), + m_pCOFilterWaveform( + new ControlObject(ConfigKey(group, "filterWaveformEnable"))) { + // Add a single effect slot + addEffectSlot(formatEffectSlotGroup(group)); + m_effectSlots[0]->setEnabled(true); + // DlgPrefEq loads the Effect with loadEffectToGroup + + setupLegacyAliasesForGroup(group); +} + +void EqualizerEffectChain::setFilterWaveform(bool state) { + m_pCOFilterWaveform->set(state); +} + +QString EqualizerEffectChain::formatEffectChainGroup(const QString& group) { + return QString("[EqualizerRack1_%1]").arg(group); +} + +QString EqualizerEffectChain::formatEffectSlotGroup(const QString& group) { + return QString("[EqualizerRack1_%1_Effect1]") + .arg(group); +} + +void EqualizerEffectChain::setupLegacyAliasesForGroup(const QString& group) { + // Create aliases for legacy EQ controls. + EffectSlotPointer pEffectSlot = getEffectSlot(0); + if (pEffectSlot) { + const QString& effectSlotGroup = pEffectSlot->getGroup(); + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLow"), + ConfigKey(effectSlotGroup, "parameter1")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMid"), + ConfigKey(effectSlotGroup, "parameter2")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHigh"), + ConfigKey(effectSlotGroup, "parameter3")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLowKill"), + ConfigKey(effectSlotGroup, "button_parameter1")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMidKill"), + ConfigKey(effectSlotGroup, "button_parameter2")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHighKill"), + ConfigKey(effectSlotGroup, "button_parameter3")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLow_loaded"), + ConfigKey(effectSlotGroup, "parameter1_loaded")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMid_loaded"), + ConfigKey(effectSlotGroup, "parameter2_loaded")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHigh_loaded"), + ConfigKey(effectSlotGroup, "parameter3_loaded")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLowKill_loaded"), + ConfigKey(effectSlotGroup, "button_parameter1_loaded")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMidKill_loaded"), + ConfigKey(effectSlotGroup, "button_parameter2_loaded")); + + ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHighKill_loaded"), + ConfigKey(effectSlotGroup, "button_parameter3_loaded")); + } +} diff --git a/src/effects/chains/equalizereffectchain.h b/src/effects/chains/equalizereffectchain.h new file mode 100644 index 0000000000..153ca1b864 --- /dev/null +++ b/src/effects/chains/equalizereffectchain.h @@ -0,0 +1,25 @@ +#pragma once + +#include "effects/chains/pergroupeffectchain.h" + +/// EqualizerEffectChain is specifically for the equalizers only. +/// It only has a single effect in the chain. The user can pick the +/// effect in the preferences. In the main GUI, only the parameters of +/// that single effect are presented, not the metaknob nor superknob. +/// EqualizerEffectChain is hardwired to one input channel, always +/// enabled, and has the mix knob fully enabled. +class EqualizerEffectChain : public PerGroupEffectChain { + public: + EqualizerEffectChain(const QString& group, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger); + + void setFilterWaveform(bool state); + + static QString formatEffectChainGroup(const QString& group); + static QString formatEffectSlotGroup(const QString& group); + + private: + void setupLegacyAliasesForGroup(const QString& group); + std::unique_ptr<ControlObject> m_pCOFilterWaveform; +}; diff --git a/src/effects/chains/outputeffectchain.cpp b/src/effects/chains/outputeffectchain.cpp new file mode 100644 index 0000000000..6a47f3ad25 --- /dev/null +++ b/src/effects/chains/outputeffectchain.cpp @@ -0,0 +1,37 @@ +#include "effects/chains/outputeffectchain.h" + +#include "effects/effectslot.h" + +OutputEffectChain::OutputEffectChain(EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger) + : EffectChain(formatEffectChainGroup("[Master]"), + pEffectsManager, + pEffectsMessenger, + SignalProcessingStage::Postfader) { + addEffectSlot("[OutputEffectRack_[Master]_Effect1]"); + m_effectSlots[0]->setEnabled(true); + + // Register the master channel + const ChannelHandleAndGroup* masterHandleAndGroup = nullptr; + + // TODO(Be): Remove this hideous hack to get the ChannelHandleAndGroup + const QSet<ChannelHandleAndGroup>& registeredChannels = + m_pEffectsManager->registeredInputChannels(); + for (const ChannelHandleAndGroup& handle_group : registeredChannels) { + if (handle_group.name() == "[MasterOutput]") { + masterHandleAndGroup = &handle_group; + break; + } + } + DEBUG_ASSERT(masterHandleAndGroup != nullptr); + + registerInputChannel(*masterHandleAndGroup); + enableForInputChannel(*masterHandleAndGroup); + m_pControlChainMix->set(1.0); + sendParameterUpdate(); +} + +QString OutputEffectChain::formatEffectChainGroup( + const QString& group) { + return QString("[OutputEffectRack_%1]").arg(group); +} diff --git a/src/effects/chains/outputeffectchain.h b/src/effects/chains/outputeffectchain.h new file mode 100644 index 0000000000..195594b8bd --- /dev/null +++ b/src/effects/chains/outputeffectchain.h @@ -0,0 +1,14 @@ +#pragma once + +#include "effects/effectchain.h" + +/// OutputEffectChain is hardwired to only one of Mixxx's outputs. +/// This is used for the main mix equalizer. +class OutputEffectChain : public EffectChain { + public: + OutputEffectChain(EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger); + + private: + static QString formatEffectChainGroup(const QString& group); +}; diff --git a/src/effects/chains/pergroupeffectchain.cpp b/src/effects/chains/pergroupeffectchain.cpp new file mode 100644 index 0000000000..2ec903bbb4 --- /dev/null +++ b/src/effects/chains/pergroupeffectchain.cpp @@ -0,0 +1,32 @@ +#include "effects/chains/pergroupeffectchain.h" + +#include "effects/effectsmanager.h" + +PerGroupEffectChain::PerGroupEffectChain(const QString& group, + const QString& chainSlotGroup, + SignalProcessingStage stage, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger) + : EffectChain(chainSlotGroup, + pEffectsManager, + pEffectsMessenger, + stage) { + // Set the chain to be fully wet. + m_pControlChainMix->set(1.0); + sendParameterUpdate(); + + // TODO(rryan): remove. + const ChannelHandleAndGroup* handleAndGroup = nullptr; + for (const ChannelHandleAndGroup& handle_group : + m_pEffectsManager->registeredInputChannels()) { + if (handle_group.name() == group) { + handleAndGroup = &handle_group; + break; + } + } + DEBUG_ASSERT(handleAndGroup != nullptr); + + // Register this channel alone with the chain slot. + registerInputChannel(*handleAndGroup); + enableForInputChannel(*handleAndGroup); +} diff --git a/src/effects/chains/pergroupeffectchain.h b/src/effects/chains/pergroupeffectchain.h new file mode 100644 index 0000000000..4517461052 --- /dev/null +++ b/src/effects/chains/pergroupeffectchain.h @@ -0,0 +1,14 @@ +#pragma once + +#include "effects/effectchain.h" + +/// PerGroupEffectChain is a base class hardwired for one input channel. +/// The routing switches are not presented to the user. +class PerGroupEffectChain : public EffectChain { + public: + PerGroupEffectChain(const QString& group, + const QString& chainSlotGroup, + SignalProcessingStage stage, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger); +}; diff --git a/src/effects/chains/quickeffectchain.cpp b/src/effects/chains/quickeffectchain.cpp new file mode 100644 index 0000000000..65b7653e2a --- /dev/null +++ b/src/effects/chains/quickeffectchain.cpp @@ -0,0 +1,58 @@ +#include "effects/chains/quickeffectchain.h" + +#include "effects/effectslot.h" +#include "effects/presets/effectchainpresetmanager.h" + +QuickEffectChain::QuickEffectChain(const QString& group, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger) + : PerGroupEffectChain(group, + formatEffectChainGroup(group), + SignalProcessingStage::Postfader, + pEffectsManager, + pEffectsMessenger) { + for (int i = 0; i < kNumEffectsPerUnit; ++i) { + addEffectSlot(formatEffectSlotGroup(group, i)); + m_effectSlots.at(i)->setEnabled(true); + } + disconnect(m_pChainPresetManager.data(), + &EffectChainPresetManager::effectChainPresetListUpdated, + this, + &QuickEffectChain::slotPresetListUpdated); + m_pControlNumPresetsAvailable->forceSet(m_pChainPresetManager->numQuickEffectPresets()); + connect(m_pChainPresetManager.data(), + &EffectChainPresetManager::quickEffectChainPresetListUpdated, + this, + &QuickEffectChain::slotPresetListUpdated); +} + +QString QuickEffectChain::formatEffectChainGroup(const QString& group) { + return QString("[QuickEffectRack1_%1]").arg(group); +} + +QString QuickEffectChain::formatEffectSlotGroup( + const QString& group, const int iEffectSlotNumber) { + return QString("[QuickEffectRack1_%1_Effect%2]") + .arg(group, + QString::number(iEffectSlotNumber + 1)); +} + +int QuickEffectChain::presetIndex() const { + return m_pChainPresetManager->quickEffectPresetIndex(m_presetName); +} + +EffectChainPresetPointer QuickEffectChain::presetAtIndex(int index) const { + return m_pChainPresetManager->quickEffectPresetAtIndex(index); +} + +void QuickEffectChain::loadChainPreset(EffectChainPresetPointer pPreset) { + EffectChain::loadChainPreset(pPreset); + setSuperParameter(pPreset->superKnob(), true); +} + +int QuickEffectChain::numPresets() const { + VERIFY_OR_DEBUG_ASSERT(m_pChainPresetManager) { + return 0; + } + return m_pChainPresetManager->numQuickEffectPresets(); +} diff --git a/src/effects/chains/quickeffectchain.h b/src/effects/chains/quickeffectchain.h new file mode 100644 index 0000000000..7f35486219 --- /dev/null +++ b/src/effects/chains/quickeffectchain.h @@ -0,0 +1,25 @@ +#pragma once + +#include "effects/chains/pergroupeffectchain.h" + +/// QuickEffectChain is a simplified interface for effect chains. +/// It only presents the superknob and chain enable switch to the user. +/// The user can design complex EffectChainPresets with a StandardEffectChain +/// then load it into QuickEffectChain. QuickEffectChain is hardwired to one +/// input channel with the mix knob fully enabled. +class QuickEffectChain : public PerGroupEffectChain { + public: + QuickEffectChain(const QString& group, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger); + + static QString formatEffectChainGroup(const QString& group); + static QString formatEffectSlotGroup(const QString& group, + const int iEffectSlotNumber = 0); + + int presetIndex() const override; + EffectChainPresetPointer presetAtIndex(int index) const override; + + void loadChainPreset(EffectChainPresetPointer pPreset) override; + int numPresets() const override; +}; diff --git a/src/effects/chains/standardeffectchain.cpp b/src/effects/chains/standardeffectchain.cpp new file mode 100644 index 0000000000..a2dc01d766 --- /dev/null +++ b/src/effects/chains/standardeffectchain.cpp @@ -0,0 +1,42 @@ +#include "effects/chains/standardeffectchain.h" + +#include "effects/effectsmanager.h" +#include "mixer/playermanager.h" + +StandardEffectChain::StandardEffectChain(unsigned int iChainNumber, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger) + : EffectChain(formatEffectChainGroup(iChainNumber), + pEffectsManager, + pEffectsMessenger, + SignalProcessingStage::Postfader) { + for (int i = 0; i < kNumEffectsPerUnit; ++i) { + addEffectSlot(formatEffectSlotGroup(iChainNumber, i)); + } + + const QSet<ChannelHandleAndGroup>& registeredChannels = + m_pEffectsManager->registeredInputChannels(); + for (const ChannelHandleAndGroup& handle_group : registeredChannels) { + int deckNumber; + if (PlayerManager::isDeckGroup(handle_group.name(), &deckNumber) && + (iChainNumber + 1) == (unsigned)deckNumber) { + registerInputChannel(handle_group, 1.0); + } else { + registerInputChannel(handle_group, 0.0); + } + } +} + +QString StandardEffectChain::formatEffectChainGroup(const int iChainNumber) { + // EffectRacks never did anything and there was never more than one of them, + // but it remains in the ControlObject group name for backwards compatibility. + return QString("[EffectRack1_EffectUnit%1]") + .arg(QString::number(iChainNumber + 1)); +} + +QString StandardEffectChain::formatEffectSlotGroup(const int iChainSlotNumber, + const int iEffectSlotNumber) { + return QString("[EffectRack1_EffectUnit%1_Effect%2]") + .arg(QString::number(iChainSlotNumber + 1), + QString::number(iEffectSlotNumber + 1)); +} diff --git a/src/effects/chains/standardeffectchain.h b/src/effects/chains/standardeffectchain.h new file mode 100644 index 0000000000..9a470e41f7 --- /dev/null +++ b/src/effects/chains/standardeffectchain.h @@ -0,0 +1,18 @@ +#pragma once + +#include "effects/effectchain.h" + +/// StandardEffectChain is a chain shown in the GUI with the +/// detail of the input routing switches, mix knob, superknob, +/// all effects, their parameters, enable switches, and metaknob +/// linkings. However, the chain enable switch is hidden because it +/// is redundant with the input routing switches and effect enable switches. +class StandardEffectChain : public EffectChain { + public: + StandardEffectChain(unsigned int iChainNumber, + EffectsManager* pEffectsManager, + EffectsMessengerPointer pEffectsMessenger); + static QString formatEffectChainGroup(const int iChainNumber); + static QString formatEffectSlotGroup(const int iChainSlotNumber, + const int iEffectSlotNumber); +}; diff --git a/src/effects/effectslot.cpp b/src/effects/effectslot.cpp index 88aaabdca5..1dd3d2798b 100644 --- a/src/effects/effectslot.cpp +++ b/src/effects/effectslot.cpp @@ -8,6 +8,7 @@ #include "control/controlpushbutton.h" #include "effects/defs.h" #include "effects/effectsmessenger.h" +#include "effects/effectchain.h" #include "effects/presets/effectpresetmanager.h" #include "effects/visibleeffectslist.h" #include "moc_effectslot.cpp" diff --git a/src/effects/effectsmanager.cpp b/src/effects/effectsmanager.cpp index a9638053c0..c3710de74a 100644 --- a/src/effects/effectsmanager.cpp +++ b/src/effects/effectsmanager.cpp @@ -6,6 +6,10 @@ #include "control/controlpotmeter.h" #include "effects/effectslot.h" #include "effects/effectsmessenger.h" +#include "effects/chains/standardeffectchain.h" +#include "effects/chains/quickeffectchain.h" +#include "effects/chains/outputeffectchain.h" +#include "effects/chains/equalizereffectchain.h" #include "effects/presets/effectpresetmanager.h" #include "effects/presets/effectxmlelements.h" #include "effects/visibleeffectslist.h" diff --git a/src/effects/effectsmanager.h b/src/effects/effectsmanager.h index f26d83ede3..0b41b3198d 100644 --- a/src/effects/effectsmanager.h +++ b/src/effects/effectsmanager.h @@ -7,7 +7,6 @@ #include "control/controlpotmeter.h" #include "effects/backends/effectsbackendmanager.h" #include "effects/presets/effectchainpresetmanager.h" -#include "effects/specialeffectchains.h" #include "engine/channelhandle.h" #include "preferences/usersettings.h" #include "util/class.h" diff --git a/src/effects/specialeffectchains.cpp b/src/effects/specialeffectchains.cpp deleted file mode 100644 index 978cee32b7..0000000000 --- a/src/effects/specialeffectchains.cpp +++ /dev/null @@ -1,232 +0,0 @@ -#include "effects/specialeffectchains.h" - -#include "mixer/playermanager.h" - -StandardEffectChain::StandardEffectChain(unsigned int iChainNumber, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger) - : EffectChain(formatEffectChainGroup(iChainNumber), - pEffectsManager, - pEffectsMessenger, - SignalProcessingStage::Postfader) { - for (int i = 0; i < kNumEffectsPerUnit; ++i) { - addEffectSlot(formatEffectSlotGroup(iChainNumber, i)); - } - - const QSet<ChannelHandleAndGroup>& registeredChannels = - m_pEffectsManager->registeredInputChannels(); - for (const ChannelHandleAndGroup& handle_group : registeredChannels) { - int deckNumber; - if (PlayerManager::isDeckGroup(handle_group.name(), &deckNumber) && - (iChainNumber + 1) == (unsigned)deckNumber) { - registerInputChannel(handle_group, 1.0); - } else { - registerInputChannel(handle_group, 0.0); - } - } -} - -QString StandardEffectChain::formatEffectChainGroup(const int iChainNumber) { - // EffectRacks never did anything and there was never more than one of them, - // but it remains in the ControlObject group name for backwards compatibility. - return QString("[EffectRack1_EffectUnit%1]") - .arg(QString::number(iChainNumber + 1)); -} - -QString StandardEffectChain::formatEffectSlotGroup(const int iChainSlotNumber, - const int iEffectSlotNumber) { - return QString("[EffectRack1_EffectUnit%1_Effect%2]") - .arg(QString::number(iChainSlotNumber + 1), - QString::number(iEffectSlotNumber + 1)); -} - -OutputEffectChain::OutputEffectChain(EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger) - : EffectChain(formatEffectChainGroup("[Master]"), - pEffectsManager, - pEffectsMessenger, - SignalProcessingStage::Postfader) { - addEffectSlot("[OutputEffectRack_[Master]_Effect1]"); - m_effectSlots[0]->setEnabled(true); - - // Register the master channel - const ChannelHandleAndGroup* masterHandleAndGroup = nullptr; - - // TODO(Be): Remove this hideous hack to get the ChannelHandleAndGroup - const QSet<ChannelHandleAndGroup>& registeredChannels = - m_pEffectsManager->registeredInputChannels(); - for (const ChannelHandleAndGroup& handle_group : registeredChannels) { - if (handle_group.name() == "[MasterOutput]") { - masterHandleAndGroup = &handle_group; - break; - } - } - DEBUG_ASSERT(masterHandleAndGroup != nullptr); - - registerInputChannel(*masterHandleAndGroup); - enableForInputChannel(*masterHandleAndGroup); - m_pControlChainMix->set(1.0); - sendParameterUpdate(); -} - -QString OutputEffectChain::formatEffectChainGroup( - const QString& group) { - return QString("[OutputEffectRack_%1]").arg(group); -} - -PerGroupEffectChain::PerGroupEffectChain(const QString& group, - const QString& chainSlotGroup, - SignalProcessingStage stage, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger) - : EffectChain(chainSlotGroup, - pEffectsManager, - pEffectsMessenger, - stage) { - // Set the chain to be fully wet. - m_pControlChainMix->set(1.0); - sendParameterUpdate(); - - // TODO(rryan): remove. - const ChannelHandleAndGroup* handleAndGroup = nullptr; - for (const ChannelHandleAndGroup& handle_group : - m_pEffectsManager->registeredInputChannels()) { - if (handle_group.name() == group) { - handleAndGroup = &handle_group; - break; - } - } - DEBUG_ASSERT(handleAndGroup != nullptr); - - // Register this channel alone with the chain slot. - registerInputChannel(*handleAndGroup); - enableForInputChannel(*handleAndGroup); -} - -QuickEffectChain::QuickEffectChain(const QString& group, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger) - : PerGroupEffectChain(group, - formatEffectChainGroup(group), - SignalProcessingStage::Postfader, - pEffectsManager, - pEffectsMessenger) { - for (int i = 0; i < kNumEffectsPerUnit; ++i) { - addEffectSlot(formatEffectSlotGroup(group, i)); - m_effectSlots.at(i)->setEnabled(true); - } - disconnect(m_pChainPresetManager.data(), - &EffectChainPresetManager::effectChainPresetListUpdated, - this, - &QuickEffectChain::slotPresetListUpdated); - m_pControlNumPresetsAvailable->forceSet(m_pChainPresetManager->numQuickEffectPresets()); - connect(m_pChainPresetManager.data(), - &EffectChainPresetManager::quickEffectChainPresetListUpdated, - this, - &QuickEffectChain::slotPresetListUpdated); -} - -QString QuickEffectChain::formatEffectChainGroup(const QString& group) { - return QString("[QuickEffectRack1_%1]").arg(group); -} - -QString QuickEffectChain::formatEffectSlotGroup( - const QString& group, const int iEffectSlotNumber) { - return QString("[QuickEffectRack1_%1_Effect%2]") - .arg(group, - QString::number(iEffectSlotNumber + 1)); -} - -int QuickEffectChain::presetIndex() const { - return m_pChainPresetManager->quickEffectPresetIndex(m_presetName); -} - -EffectChainPresetPointer QuickEffectChain::presetAtIndex(int index) const { - return m_pChainPresetManager->quickEffectPresetAtIndex(index); -} - -void QuickEffectChain::loadChainPreset(EffectChainPresetPointer pPreset) { - EffectChain::loadChainPreset(pPreset); - setSuperParameter(pPreset->superKnob(), true); -} - -int QuickEffectChain::numPresets() const { - VERIFY_OR_DEBUG_ASSERT(m_pChainPresetManager) { - return 0; - } - return m_pChainPresetManager->numQuickEffectPresets(); -} - -EqualizerEffectChain::EqualizerEffectChain(const QString& group, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger) - : PerGroupEffectChain(group, - formatEffectChainGroup(group), - SignalProcessingStage::Prefader, - pEffectsManager, - pEffectsMessenger), - m_pCOFilterWaveform( - new ControlObject(ConfigKey(group, "filterWaveformEnable"))) { - // Add a single effect slot - addEffectSlot(formatEffectSlotGroup(group)); - m_effectSlots[0]->setEnabled(true); - // DlgPrefEq loads the Effect with loadEffectToGroup - - setupLegacyAliasesForGroup(group); -} - -void EqualizerEffectChain::setFilterWaveform(bool state) { - m_pCOFilterWaveform->set(state); -} - -QString EqualizerEffectChain::formatEffectChainGroup(const QString& group) { - return QString("[EqualizerRack1_%1]").arg(group); -} - -QString EqualizerEffectChain::formatEffectSlotGroup(const QString& group) { - return QString("[EqualizerRack1_%1_Effect1]") - .arg(group); -} - -void EqualizerEffectChain::setupLegacyAliasesForGroup(const QString& group) { - // Create aliases for legacy EQ controls. - EffectSlotPointer pEffectSlot = getEffectSlot(0); - if (pEffectSlot) { - const QString& effectSlotGroup = pEffectSlot->getGroup(); - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLow"), - ConfigKey(effectSlotGroup, "parameter1")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMid"), - ConfigKey(effectSlotGroup, "parameter2")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHigh"), - ConfigKey(effectSlotGroup, "parameter3")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLowKill"), - ConfigKey(effectSlotGroup, "button_parameter1")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMidKill"), - ConfigKey(effectSlotGroup, "button_parameter2")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHighKill"), - ConfigKey(effectSlotGroup, "button_parameter3")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLow_loaded"), - ConfigKey(effectSlotGroup, "parameter1_loaded")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMid_loaded"), - ConfigKey(effectSlotGroup, "parameter2_loaded")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHigh_loaded"), - ConfigKey(effectSlotGroup, "parameter3_loaded")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterLowKill_loaded"), - ConfigKey(effectSlotGroup, "button_parameter1_loaded")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterMidKill_loaded"), - ConfigKey(effectSlotGroup, "button_parameter2_loaded")); - - ControlDoublePrivate::insertAlias(ConfigKey(group, "filterHighKill_loaded"), - ConfigKey(effectSlotGroup, "button_parameter3_loaded")); - } -} diff --git a/src/effects/specialeffectchains.h b/src/effects/specialeffectchains.h deleted file mode 100644 index 6954875100..0000000000 --- a/src/effects/specialeffectchains.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include "effects/defs.h" -#include "effects/effectchain.h" -#include "effects/effectslot.h" -#include "effects/effectsmanager.h" -#include "util/memory.h" - -/// StandardEffectChain is a chain shown in the GUI with the -/// detail of the input routing switches, mix knob, superknob, -/// all effects, their parameters, enable switches, and metaknob -/// linkings. However, the chain enable switch is hidden because it -/// is redundant with the input routing switches and effect enable switches. -class StandardEffectChain : public EffectChain { - public: - StandardEffectChain(unsigned int iChainNumber, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger); - static QString formatEffectChainGroup(const int iChainNumber); - static QString formatEffectSlotGroup(const int iChainSlotNumber, - const int iEffectSlotNumber); -}; - -/// OutputEffectChain is hardwired to only one of Mixxx's outputs. -/// This is used for the main mix equalizer. -class OutputEffectChain : public EffectChain { - public: - OutputEffectChain(EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger); - - private: - static QString formatEffectChainGroup(const QString& group); -}; - -/// PerGroupEffectChain is a base class hardwired for one input channel. -/// The routing switches are not presented to the user. -class PerGroupEffectChain : public EffectChain { - public: - PerGroupEffectChain(const QString& group, - const QString& chainSlotGroup, - SignalProcessingStage stage, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger); -}; - -/// QuickEffectChain is a simplified interface for effect chains. -/// It only presents the superknob and chain enable switch to the user. -/// The user can design complex EffectChainPresets with a StandardEffectChain -/// then load it into QuickEffectChain. QuickEffectChain is hardwired to one -/// input channel with the mix knob fully enabled. -class QuickEffectChain : public PerGroupEffectChain { - public: - QuickEffectChain(const QString& group, - EffectsManager* pEffectsManager, - EffectsMessengerPointer pEffectsMessenger); - - static QString formatEffectChainGroup(const QString& group); - static QString formatEffectSlotGroup(const QString& group, - const int iEffectSlotNumber = 0); - - int presetIndex() const override; - EffectChainPresetPointer presetAtIndex(int index) const override; - - void loadChainPreset(EffectChainPresetPointer pPreset) override; - int numPresets() const override; -}; - -/// EqualizerEffectChain is specifically for the equalizers only. -/// It only has a single effect in the chain. The user can pick the -/// effect in the preferences. In the main GUI, only the parameters of |