From 82ebe772ea05956cf44bbb4d2a5e717a21b4a820 Mon Sep 17 00:00:00 2001 From: Be Date: Fri, 22 Oct 2021 14:40:05 -0500 Subject: [PATCH] fix setting of effect parameters programatically fixes https://bugs.launchpad.net/mixxx/+bug/1947570 --- src/effects/effectbuttonparameterslot.cpp | 5 ++--- src/effects/effectbuttonparameterslot.h | 4 +--- src/effects/effectknobparameterslot.cpp | 4 ++-- src/effects/effectknobparameterslot.h | 3 ++- src/effects/effectparameterslotbase.h | 3 ++- src/preferences/dialog/dlgprefeq.cpp | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/effects/effectbuttonparameterslot.cpp b/src/effects/effectbuttonparameterslot.cpp index 407c96f9f43..b10cd0b507c 100644 --- a/src/effects/effectbuttonparameterslot.cpp +++ b/src/effects/effectbuttonparameterslot.cpp @@ -77,7 +77,6 @@ void EffectButtonParameterSlot::clear() { emit updated(); } -void EffectButtonParameterSlot::slotParameterValueChanged(double value) { - //qDebug() << debugString() << "slotParameterValueChanged" << value.toDouble(); - m_pControlValue->set(value); +void EffectButtonParameterSlot::setParameter(double value) { + m_pControlValue->setParameterFrom(value, this); } diff --git a/src/effects/effectbuttonparameterslot.h b/src/effects/effectbuttonparameterslot.h index e55f6df2a1a..eed7d658da2 100644 --- a/src/effects/effectbuttonparameterslot.h +++ b/src/effects/effectbuttonparameterslot.h @@ -26,9 +26,7 @@ class EffectButtonParameterSlot : public EffectParameterSlotBase { void clear() override; - private slots: - // Solely for handling control changes - void slotParameterValueChanged(double value) override; + void setParameter(double value) override; private: QString debugString() const { diff --git a/src/effects/effectknobparameterslot.cpp b/src/effects/effectknobparameterslot.cpp index 273b8661ff3..e4f58d5114a 100644 --- a/src/effects/effectknobparameterslot.cpp +++ b/src/effects/effectknobparameterslot.cpp @@ -110,8 +110,8 @@ void EffectKnobParameterSlot::clear() { emit updated(); } -void EffectKnobParameterSlot::slotParameterValueChanged(double value) { - m_pControlValue->set(value); +void EffectKnobParameterSlot::setParameter(double value) { + m_pControlValue->setParameterFrom(value, this); } void EffectKnobParameterSlot::slotLinkTypeChanging(double v) { diff --git a/src/effects/effectknobparameterslot.h b/src/effects/effectknobparameterslot.h index 137b93aa300..d0038afa0ea 100644 --- a/src/effects/effectknobparameterslot.h +++ b/src/effects/effectknobparameterslot.h @@ -39,9 +39,10 @@ class EffectKnobParameterSlot : public EffectParameterSlotBase { // Clear the currently loaded effect void clear() override; + void setParameter(double value) override; + private slots: // Solely for handling control changes - void slotParameterValueChanged(double value) override; void slotLinkTypeChanging(double v); void slotLinkInverseChanged(double v); diff --git a/src/effects/effectparameterslotbase.h b/src/effects/effectparameterslotbase.h index f6890293569..0978cd6ffb0 100644 --- a/src/effects/effectparameterslotbase.h +++ b/src/effects/effectparameterslotbase.h @@ -50,6 +50,8 @@ class EffectParameterSlotBase : public QObject { return m_iParameterSlotNumber; } + virtual void setParameter(double value) = 0; + signals: // Signal that indicates that the EffectParameterSlotBase has been updated. void updated(); @@ -57,7 +59,6 @@ class EffectParameterSlotBase : public QObject { public slots: // Solely for handling control changes void slotValueChanged(double v); - virtual void slotParameterValueChanged(double value) = 0; protected: const unsigned int m_iParameterSlotNumber; diff --git a/src/preferences/dialog/dlgprefeq.cpp b/src/preferences/dialog/dlgprefeq.cpp index 10d10f09bc6..3d63787c51b 100644 --- a/src/preferences/dialog/dlgprefeq.cpp +++ b/src/preferences/dialog/dlgprefeq.cpp @@ -443,7 +443,7 @@ void DlgPrefEQ::slotUpdateMainEQParameter(int value) { if (pParameterSlot->isLoaded()) { double dValue = value / 100.0; - pParameterSlot->slotParameterValueChanged(dValue); + pParameterSlot->setParameter(dValue); QLabel* valueLabel = m_mainEQValues[index]; QString valueText = QString::number(dValue); valueLabel->setText(valueText); @@ -709,7 +709,7 @@ void DlgPrefEQ::setMainEQParameter(int i, double value) { EffectManifestParameter::ParameterType::Knob, i); if (pParameterSlot->isLoaded()) { - pParameterSlot->slotParameterValueChanged(value); + pParameterSlot->setParameter(value); m_mainEQSliders[i]->setValue(static_cast(value * 100)); QLabel* valueLabel = m_mainEQValues[i];