Skip to content

Commit

Permalink
Merge pull request #4471 from Be-ing/main_eq
Browse files Browse the repository at this point in the history
fix setting of effect parameters programatically
  • Loading branch information
daschuer authored Oct 24, 2021
2 parents 3a5fac3 + 82ebe77 commit 30bdf83
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/effects/effectbuttonparameterslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 1 addition & 3 deletions src/effects/effectbuttonparameterslot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/effects/effectknobparameterslot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/effects/effectknobparameterslot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/effects/effectparameterslotbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ 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();

public slots:
// Solely for handling control changes
void slotValueChanged(double v);
virtual void slotParameterValueChanged(double value) = 0;

protected:
const unsigned int m_iParameterSlotNumber;
Expand Down
4 changes: 2 additions & 2 deletions src/preferences/dialog/dlgprefeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<int>(value * 100));

QLabel* valueLabel = m_mainEQValues[i];
Expand Down

0 comments on commit 30bdf83

Please sign in to comment.