From 8d8074f0999d0b2177175e34427b4d26d56e15cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 15 Oct 2021 23:46:09 +0200 Subject: [PATCH 01/10] Rename [EffectRack1_EffectUnit1],loaded_preset to [EffectRack1_EffectUnit1],loaded_chain, to match other COs like next_chain and prev_chain --- src/effects/effectchain.cpp | 13 +++++++------ src/effects/effectchain.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 1009ace3acb..dbbd7dc02cb 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -101,10 +101,11 @@ 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"), false); + m_pControlLoadedChainPreset->connectValueChangeRequest( + this, + &EffectChain::slotControlLoadedChainPresetRequest); m_pControlChainNextPreset = std::make_unique( ConfigKey(m_group, "next_chain")); @@ -221,7 +222,7 @@ void EffectChain::loadChainPreset(EffectChainPresetPointer pPreset) { emit presetNameChanged(m_presetName); setControlLoadedPresetIndex(presetIndex()); - m_pControlLoadedPreset->setAndConfirm(presetIndex() + 1); + m_pControlLoadedChainPreset->setAndConfirm(presetIndex() + 1); } void EffectChain::sendParameterUpdate() { @@ -350,7 +351,7 @@ 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) { diff --git a/src/effects/effectchain.h b/src/effects/effectchain.h index a053819ac4f..41bfaa4df6a 100644 --- a/src/effects/effectchain.h +++ b/src/effects/effectchain.h @@ -136,7 +136,7 @@ class EffectChain : public QObject { 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; From 2f986c4945ee63d9f46bdee2e88e875c5ee4bdef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 15 Oct 2021 23:50:58 +0200 Subject: [PATCH 02/10] Make next/prev_chain variables matching the corresponding CO names --- src/effects/effectchain.cpp | 16 ++++++++-------- src/effects/effectchain.h | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index dbbd7dc02cb..103d35ef51e 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -107,19 +107,19 @@ EffectChain::EffectChain(const QString& group, 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( @@ -354,13 +354,13 @@ void EffectChain::setControlLoadedPresetIndex(uint index) { 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)); } diff --git a/src/effects/effectchain.h b/src/effects/effectchain.h index 41bfaa4df6a..fe02adcda7e 100644 --- a/src/effects/effectchain.h +++ b/src/effects/effectchain.h @@ -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: @@ -138,8 +138,8 @@ class EffectChain : public QObject { std::unique_ptr m_pControlChainMixMode; 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); From 77cac9d218e3f3ce1b9fbaff696cfa5f86662d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 16 Oct 2021 00:14:54 +0200 Subject: [PATCH 03/10] Ignore 0 in EffectChain::slotControlChainSelector to match the behavior in EffectSlot::slotEffectSelector --- src/effects/effectchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 103d35ef51e..8f7be08bfac 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -333,7 +333,7 @@ void EffectChain::slotControlChainSelector(double value) { int index = presetIndex(); if (value > 0) { index++; - } else { + } else if (value < 0) { index--; } loadChainPreset(presetAtIndex(index)); From 2b96252fe7fccceddab644b6b1426d9c989e3a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 16 Oct 2021 00:27:16 +0200 Subject: [PATCH 04/10] Simplify control flow in loadChainPreset --- src/effects/effectchain.cpp | 5 ----- src/effects/effectslot.cpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 8f7be08bfac..6a0cc23b6a9 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -206,11 +206,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++; } 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; } From a3902f43fce4f29ae7035e29a202dc0c0293c7a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 16 Oct 2021 00:30:28 +0200 Subject: [PATCH 05/10] Remove redundant setting of m_pControlLoadedChainPreset --- src/effects/effectchain.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 6a0cc23b6a9..b169af8eceb 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -217,7 +217,6 @@ void EffectChain::loadChainPreset(EffectChainPresetPointer pPreset) { emit presetNameChanged(m_presetName); setControlLoadedPresetIndex(presetIndex()); - m_pControlLoadedChainPreset->setAndConfirm(presetIndex() + 1); } void EffectChain::sendParameterUpdate() { From e3322ce67f8912f2110731c350191d13a1f733f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 16 Oct 2021 01:14:32 +0200 Subject: [PATCH 06/10] Added a TODO for the unused [EffectRack1_EffectUnit1],loaded --- src/effects/effectchain.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index b169af8eceb..d0b3270e38e 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -50,6 +50,9 @@ EffectChain::EffectChain(const QString& group, this, &EffectChain::slotPresetListUpdated); + // TODO: This [EffectRackn_EffectUnitn],loaded is always 1.0 + // Implement a check if Effects in the unit are matching a + // chain preset m_pControlChainLoaded = std::make_unique(ConfigKey(m_group, "loaded")); m_pControlChainLoaded->setReadOnly(); From e5fda817db28d7b9f8499da42dfdd133705d68d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 16 Oct 2021 01:16:44 +0200 Subject: [PATCH 07/10] Remove pointless check if group is empty. --- src/effects/effectchain.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index d0b3270e38e..1c7742ec7bb 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -56,9 +56,7 @@ EffectChain::EffectChain(const QString& group, m_pControlChainLoaded = std::make_unique(ConfigKey(m_group, "loaded")); m_pControlChainLoaded->setReadOnly(); - if (group != QString()) { - m_pControlChainLoaded->forceSet(1.0); - } + m_pControlChainLoaded->forceSet(1.0); m_pControlChainEnabled = std::make_unique(ConfigKey(m_group, "enabled")); From f175f9ef809440ce72dc04c5b10c9d6043b0ed6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 16 Oct 2021 01:27:38 +0200 Subject: [PATCH 08/10] Rename num_presetsavalable to num_chain_presets for a consistent naming with the other COs --- src/effects/chains/quickeffectchain.cpp | 2 +- src/effects/effectchain.cpp | 10 +++++----- src/effects/effectchain.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) 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 1c7742ec7bb..b7bee10c518 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -41,10 +41,10 @@ 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, @@ -372,7 +372,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 fe02adcda7e..4b54fa155c7 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: From 3883a28c031bc0450bf1126639a17254d9cca6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 18 Oct 2021 12:39:57 +0200 Subject: [PATCH 09/10] rename loaded_chain to loaded_chain_preset --- src/effects/effectchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index b7bee10c518..8de16c0d612 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -103,7 +103,7 @@ EffectChain::EffectChain(const QString& group, &EffectChain::sendParameterUpdate); m_pControlLoadedChainPreset = std::make_unique( - ConfigKey(m_group, "loaded_chain"), false); + ConfigKey(m_group, "loaded_chain_preset"), false); m_pControlLoadedChainPreset->connectValueChangeRequest( this, &EffectChain::slotControlLoadedChainPresetRequest); From 9cb902e8e78dae2b35445ad71f295d2fe80565cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 18 Oct 2021 15:51:00 +0200 Subject: [PATCH 10/10] Remove unused [EffectRackn_EffectUnitn],loaded CO --- src/effects/effectchain.cpp | 8 -------- src/effects/effectchain.h | 1 - 2 files changed, 9 deletions(-) diff --git a/src/effects/effectchain.cpp b/src/effects/effectchain.cpp index 8de16c0d612..607724b57e0 100644 --- a/src/effects/effectchain.cpp +++ b/src/effects/effectchain.cpp @@ -50,14 +50,6 @@ EffectChain::EffectChain(const QString& group, this, &EffectChain::slotPresetListUpdated); - // TODO: This [EffectRackn_EffectUnitn],loaded is always 1.0 - // Implement a check if Effects in the unit are matching a - // chain preset - m_pControlChainLoaded = - std::make_unique(ConfigKey(m_group, "loaded")); - m_pControlChainLoaded->setReadOnly(); - m_pControlChainLoaded->forceSet(1.0); - m_pControlChainEnabled = std::make_unique(ConfigKey(m_group, "enabled")); m_pControlChainEnabled->setButtonMode(ControlPushButton::POWERWINDOW); diff --git a/src/effects/effectchain.h b/src/effects/effectchain.h index 4b54fa155c7..8e0c9e6a7b8 100644 --- a/src/effects/effectchain.h +++ b/src/effects/effectchain.h @@ -133,7 +133,6 @@ 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_pControlLoadedChainPreset;