diff --git a/src/effects/chains/quickeffectchain.cpp b/src/effects/chains/quickeffectchain.cpp index 870cba73f7b..21a3c239401 100644 --- a/src/effects/chains/quickeffectchain.cpp +++ b/src/effects/chains/quickeffectchain.cpp @@ -21,7 +21,7 @@ QuickEffectChain::QuickEffectChain(const QString& group, &EffectChainPresetManager::effectChainPresetListUpdated, this, &QuickEffectChain::slotPresetListUpdated); - m_pControlNumPresetsAvailable->forceSet(m_pChainPresetManager->numQuickEffectPresets()); + m_pControlNumChainPresets->forceSet(m_pChainPresetManager->numQuickEffectPresets()); connect(m_pChainPresetManager.data(), &EffectChainPresetManager::quickEffectChainPresetListUpdated, this, diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 1009ace3acb..607724b57e0 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -41,22 +41,15 @@ EffectChain::EffectChain(const QString& group, ConfigKey(m_group, "num_effectslots")); m_pControlNumEffectSlots->setReadOnly(); - m_pControlNumPresetsAvailable = std::make_unique( - ConfigKey(m_group, "num_presetsavailable")); - m_pControlNumPresetsAvailable->set(m_pChainPresetManager->numPresets()); - m_pControlNumPresetsAvailable->setReadOnly(); + m_pControlNumChainPresets = std::make_unique( + ConfigKey(m_group, "num_chain_presets")); + m_pControlNumChainPresets->set(m_pChainPresetManager->numPresets()); + m_pControlNumChainPresets->setReadOnly(); connect(m_pChainPresetManager.data(), &EffectChainPresetManager::effectChainPresetListUpdated, this, &EffectChain::slotPresetListUpdated); - m_pControlChainLoaded = - std::make_unique(ConfigKey(m_group, "loaded")); - m_pControlChainLoaded->setReadOnly(); - if (group != QString()) { - m_pControlChainLoaded->forceSet(1.0); - } - m_pControlChainEnabled = std::make_unique(ConfigKey(m_group, "enabled")); m_pControlChainEnabled->setButtonMode(ControlPushButton::POWERWINDOW); @@ -101,24 +94,25 @@ EffectChain::EffectChain(const QString& group, this, &EffectChain::sendParameterUpdate); - m_pControlLoadedPreset = std::make_unique( - ConfigKey(m_group, "loaded_preset"), false); - m_pControlLoadedPreset->connectValueChangeRequest( - this, &EffectChain::slotControlLoadedChainPresetRequest); + m_pControlLoadedChainPreset = std::make_unique( + ConfigKey(m_group, "loaded_chain_preset"), false); + m_pControlLoadedChainPreset->connectValueChangeRequest( + this, + &EffectChain::slotControlLoadedChainPresetRequest); - m_pControlChainNextPreset = std::make_unique( + m_pControlNextChainPreset = std::make_unique( ConfigKey(m_group, "next_chain")); - connect(m_pControlChainNextPreset.get(), + connect(m_pControlNextChainPreset.get(), &ControlObject::valueChanged, this, - &EffectChain::slotControlChainNextPreset); + &EffectChain::slotControlNextChainPreset); - m_pControlChainPrevPreset = std::make_unique( + m_pControlPrevChainPreset = std::make_unique( ConfigKey(m_group, "prev_chain")); - connect(m_pControlChainPrevPreset.get(), + connect(m_pControlPrevChainPreset.get(), &ControlObject::valueChanged, this, - &EffectChain::slotControlChainPrevPreset); + &EffectChain::slotControlPrevChainPreset); // Ignoring no-ops is important since this is for +/- tickers. m_pControlChainSelector = std::make_unique( @@ -205,11 +199,6 @@ void EffectChain::loadChainPreset(EffectChainPresetPointer pPreset) { int effectSlotIndex = 0; for (const auto& pEffectPreset : pPreset->effectPresets()) { EffectSlotPointer pEffectSlot = m_effectSlots.at(effectSlotIndex); - if (pEffectPreset->isEmpty()) { - pEffectSlot->loadEffectFromPreset(nullptr); - effectSlotIndex++; - continue; - } pEffectSlot->loadEffectFromPreset(pEffectPreset); effectSlotIndex++; } @@ -221,7 +210,6 @@ void EffectChain::loadChainPreset(EffectChainPresetPointer pPreset) { emit presetNameChanged(m_presetName); setControlLoadedPresetIndex(presetIndex()); - m_pControlLoadedPreset->setAndConfirm(presetIndex() + 1); } void EffectChain::sendParameterUpdate() { @@ -332,7 +320,7 @@ void EffectChain::slotControlChainSelector(double value) { int index = presetIndex(); if (value > 0) { index++; - } else { + } else if (value < 0) { index--; } loadChainPreset(presetAtIndex(index)); @@ -350,16 +338,16 @@ void EffectChain::slotControlLoadedChainPresetRequest(double value) { void EffectChain::setControlLoadedPresetIndex(uint index) { // add 1 to make the ControlObject 1-indexed like other ControlObjects - m_pControlLoadedPreset->setAndConfirm(index + 1); + m_pControlLoadedChainPreset->setAndConfirm(index + 1); } -void EffectChain::slotControlChainNextPreset(double value) { +void EffectChain::slotControlNextChainPreset(double value) { if (value > 0) { loadChainPreset(presetAtIndex(presetIndex() + 1)); } } -void EffectChain::slotControlChainPrevPreset(double value) { +void EffectChain::slotControlPrevChainPreset(double value) { if (value > 0) { loadChainPreset(presetAtIndex(presetIndex() - 1)); } @@ -376,7 +364,7 @@ void EffectChain::slotChannelStatusChanged( void EffectChain::slotPresetListUpdated() { setControlLoadedPresetIndex(presetIndex()); - m_pControlNumPresetsAvailable->forceSet(numPresets()); + m_pControlNumChainPresets->forceSet(numPresets()); } void EffectChain::enableForInputChannel(const ChannelHandleAndGroup& handleGroup) { diff --git a/src/effects/effectchain.h b/src/effects/effectchain.h index a053819ac4f..8e0c9e6a7b8 100644 --- a/src/effects/effectchain.h +++ b/src/effects/effectchain.h @@ -108,7 +108,7 @@ class EffectChain : public QObject { EffectsMessengerPointer m_pMessenger; std::unique_ptr m_pControlChainMix; std::unique_ptr m_pControlChainSuperParameter; - std::unique_ptr m_pControlNumPresetsAvailable; + std::unique_ptr m_pControlNumChainPresets; QList m_effectSlots; protected slots: @@ -117,8 +117,8 @@ class EffectChain : public QObject { private slots: void slotControlLoadedChainPresetRequest(double value); void slotControlChainSelector(double value); - void slotControlChainNextPreset(double value); - void slotControlChainPrevPreset(double value); + void slotControlNextChainPreset(double value); + void slotControlPrevChainPreset(double value); void slotChannelStatusChanged(double value, const ChannelHandleAndGroup& handleGroup); private: @@ -133,13 +133,12 @@ class EffectChain : public QObject { std::unique_ptr m_pControlClear; std::unique_ptr m_pControlNumEffectSlots; - std::unique_ptr m_pControlChainLoaded; std::unique_ptr m_pControlChainEnabled; std::unique_ptr m_pControlChainMixMode; - std::unique_ptr m_pControlLoadedPreset; + std::unique_ptr m_pControlLoadedChainPreset; std::unique_ptr m_pControlChainSelector; - std::unique_ptr m_pControlChainNextPreset; - std::unique_ptr m_pControlChainPrevPreset; + std::unique_ptr m_pControlNextChainPreset; + std::unique_ptr m_pControlPrevChainPreset; void setControlLoadedPresetIndex(uint index); diff --git a/src/effects/effectslot.cpp b/src/effects/effectslot.cpp index ec2a00a5716..dcae47f6e48 100644 --- a/src/effects/effectslot.cpp +++ b/src/effects/effectslot.cpp @@ -257,7 +257,7 @@ EffectParameterSlotBasePointer EffectSlot::getEffectParameterSlot( } void EffectSlot::loadEffectFromPreset(const EffectPresetPointer pPreset) { - if (!pPreset) { + if (!pPreset || pPreset->isEmpty()) { loadEffectInner(nullptr, nullptr, true); return; }