Skip to content

Commit 5bad7b0

Browse files
committed
Fixed knob state save logic
1 parent 82570c7 commit 5bad7b0

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

plugins/SmartAmp/Source/PluginEditor.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ WaveNetVaAudioProcessorEditor::WaveNetVaAudioProcessorEditor (WaveNetVaAudioProc
119119
ampLeadTrebleKnob.setLookAndFeel(&ampSilverKnobLAF);
120120
ampLeadTrebleKnob.addListener(this);
121121
ampLeadTrebleKnob.setRange(-8.0, 8.0);
122-
ampLeadTrebleKnob.setValue(processor.ampCleanTrebleKnobState);
122+
ampLeadTrebleKnob.setValue(processor.ampLeadTrebleKnobState);
123123
ampLeadTrebleKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
124124
ampLeadTrebleKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20);
125125
ampLeadTrebleKnob.setNumDecimalPlacesToDisplay(1);
@@ -284,10 +284,18 @@ void WaveNetVaAudioProcessorEditor::sliderValueChanged(Slider* slider)
284284
else if (slider == &ampCleanBassKnob || slider == &ampCleanMidKnob || slider == &ampCleanTrebleKnob) {
285285
if (processor.amp_lead == 1)
286286
processor.set_ampEQ(ampCleanBassKnob.getValue(), ampCleanMidKnob.getValue(), ampCleanTrebleKnob.getValue(), ampPresenceKnob.getValue());
287+
// Set knob states for saving positions when closing/reopening GUI
288+
processor.ampCleanBassKnobState = ampCleanBassKnob.getValue();
289+
processor.ampCleanMidKnobState = ampCleanMidKnob.getValue();
290+
processor.ampCleanTrebleKnobState = ampCleanTrebleKnob.getValue();
287291
}
288292
else if (slider == &ampLeadBassKnob || slider == &ampLeadMidKnob || slider == &ampLeadTrebleKnob) {
289293
if (processor.amp_lead == 0)
290294
processor.set_ampEQ(ampLeadBassKnob.getValue(), ampLeadMidKnob.getValue(), ampLeadTrebleKnob.getValue(), ampPresenceKnob.getValue());
295+
// Set knob states for saving positions when closing/reopening GUI
296+
processor.ampLeadBassKnobState = ampLeadBassKnob.getValue();
297+
processor.ampLeadMidKnobState = ampLeadMidKnob.getValue();
298+
processor.ampLeadTrebleKnobState = ampLeadTrebleKnob.getValue();
291299
}
292300
else if (slider == &ampPresenceKnob) {
293301
if (processor.amp_lead == 1)

plugins/SmartAmp/Source/PluginProcessor.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,6 @@ void WaveNetVaAudioProcessor::set_ampEQ(float bass_slider, float mid_slider, flo
261261
{
262262
eq4band.setParameters(bass_slider, mid_slider, treble_slider, presence_slider);
263263

264-
// Set knob states for saving positions when closing/reopening GUI
265-
if ( amp_lead == 1 ) {
266-
ampCleanBassKnobState = bass_slider;
267-
ampCleanMidKnobState = mid_slider;
268-
ampCleanTrebleKnobState = treble_slider;
269-
} else {
270-
ampLeadBassKnobState = bass_slider;
271-
ampLeadMidKnobState = mid_slider;
272-
ampLeadTrebleKnobState = treble_slider;
273-
}
274264
ampPresenceKnobState = presence_slider;
275265
}
276266

0 commit comments

Comments
 (0)