Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/effects/chains/quickeffectchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "control/controlobject.h"
#include "effects/effectslot.h"
#include "effects/effectsmanager.h"
#include "effects/presets/effectchainpreset.h"
#include "effects/presets/effectchainpresetmanager.h"
#include "moc_quickeffectchain.cpp"
Expand Down Expand Up @@ -54,8 +55,16 @@ EffectChainPresetPointer QuickEffectChain::presetAtIndex(int index) const {
}

void QuickEffectChain::loadChainPreset(EffectChainPresetPointer pPreset) {
// Loading a chain preset sets the super knob's value to the value it was at
// when the chain preset was saved. It may be desirable to keep the knob's
// value as is, for instance when changing between multiple presets that
// contain a filter and an additional additional effect.
const double old_super_knob_value = getSuperParameter();

EffectChain::loadChainPreset(pPreset);
if (pPreset) {
if (m_pEffectsManager->isAdoptSuperknobSettingEnabled()) {
setSuperParameter(old_super_knob_value, true);
} else if (pPreset) {
setSuperParameter(pPreset->superKnob(), true);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/effects/effectsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ bool EffectsManager::isAdoptMetaknobSettingEnabled() const {
return m_pConfig->getValue(ConfigKey("[Effects]", "AdoptMetaknobValue"), true);
}

bool EffectsManager::isAdoptSuperknobSettingEnabled() const {
return m_pConfig->getValue(ConfigKey("[Effects]", "AdoptSuperknobValue"), false);
Copy link
Copy Markdown
Member

@acolombier acolombier Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have recently adopted a strict snake_case as the standard for config key

Suggested change
return m_pConfig->getValue(ConfigKey("[Effects]", "AdoptSuperknobValue"), false);
return m_pConfig->getValue(ConfigKey("[Effects]", "adopt_superknob_value"), false);

}

void EffectsManager::readEffectsXml() {
QDir settingsPath(m_pConfig->getSettingsPath());
QFile file(settingsPath.absoluteFilePath(kEffectsXmlFile));
Expand Down
1 change: 1 addition & 0 deletions src/effects/effectsmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class EffectsManager {
}

bool isAdoptMetaknobSettingEnabled() const;
bool isAdoptSuperknobSettingEnabled() const;

private:
void addStandardEffectChains();
Expand Down
10 changes: 9 additions & 1 deletion src/preferences/dialog/dlgprefeffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,12 @@ void DlgPrefEffects::slotUpdate() {

loadChainPresetLists();

bool effectAdoptMetaknobValue = m_pConfig->getValue(
const bool effectAdoptSuperknobValue = m_pConfig->getValue(
ConfigKey("[Effects]", "AdoptSuperknobValue"), false);
radioButtonKeepSuperknobPosition->setChecked(effectAdoptSuperknobValue);
radioButtonSuperknobLoadDefault->setChecked(!effectAdoptSuperknobValue);

const bool effectAdoptMetaknobValue = m_pConfig->getValue(
ConfigKey("[Effects]", "AdoptMetaknobValue"), true);
radioButtonKeepMetaknobPosition->setChecked(effectAdoptMetaknobValue);
radioButtonMetaknobLoadDefault->setChecked(!effectAdoptMetaknobValue);
Expand All @@ -128,6 +133,8 @@ void DlgPrefEffects::slotApply() {
m_pVisibleEffectsList->setList(m_pVisibleEffectsModel->getList());
saveChainPresetLists();

m_pConfig->set(ConfigKey("[Effects]", "AdoptSuperknobValue"),
ConfigValue(radioButtonKeepSuperknobPosition->isChecked()));
m_pConfig->set(ConfigKey("[Effects]", "AdoptMetaknobValue"),
ConfigValue(radioButtonKeepMetaknobPosition->isChecked()));
}
Expand All @@ -141,6 +148,7 @@ void DlgPrefEffects::saveChainPresetLists() {
}

void DlgPrefEffects::slotResetToDefaults() {
radioButtonSuperknobLoadDefault->setChecked(true);
radioButtonKeepMetaknobPosition->setChecked(true);
m_pChainPresetManager->resetToDefaults();

Expand Down
31 changes: 27 additions & 4 deletions src/preferences/dialog/dlgprefeffectsdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,32 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupMetaKnobOption">
<widget class="QGroupBox" name="groupEffectKnobOptions">
<property name="title">
<string>Effect load behavior</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayoutMetaKnob">
<item>
<layout class="QGridLayout" name="verticalLayoutEffectKnobOptions">
<item row="0" column="0">
<widget class="QRadioButton" name="radioButtonKeepSuperknobPosition">
<property name="text">
<string>Keep superknob position</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupSuperKnob</string>
</attribute>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="radioButtonSuperknobLoadDefault">
<property name="text">
<string>Reset superknob to preset default</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroupSuperKnob</string>
</attribute>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radioButtonKeepMetaknobPosition">
<property name="text">
<string>Keep metaknob position</string>
Expand All @@ -485,7 +505,7 @@
</attribute>
</widget>
</item>
<item>
<item row="1" column="1">
<widget class="QRadioButton" name="radioButtonMetaknobLoadDefault">
<property name="text">
<string>Reset metaknob to effect default</string>
Expand All @@ -509,11 +529,14 @@
<tabstop>chainPresetExportButton</tabstop>
<tabstop>chainPresetRenameButton</tabstop>
<tabstop>chainPresetDeleteButton</tabstop>
<tabstop>radioButtonKeepSuperknobPosition</tabstop>
<tabstop>radioButtonSuperknobLoadDefault</tabstop>
<tabstop>radioButtonKeepMetaknobPosition</tabstop>
<tabstop>radioButtonMetaknobLoadDefault</tabstop>
</tabstops>
<resources/>
<buttongroups>
<buttongroup name="buttonGroupSuperKnob"/>
<buttongroup name="buttonGroupMetaKnob"/>
<buttongroup name="buttonGroupPresetActions"/>
</buttongroups>
Expand Down