Skip to content

Commit 2303926

Browse files
authored
Merge pull request #5 from keyth72/feature-save-knob-states
Added save knob state feature and removed unused code.
2 parents 093647a + 6d316d0 commit 2303926

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

SmartPedal/Source/PluginEditor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ SmartPedalAudioProcessorEditor::SmartPedalAudioProcessorEditor (SmartPedalAudioP
6767
odDriveKnob.setLookAndFeel(&blackHexKnobLAF);
6868
odDriveKnob.addListener(this);
6969
odDriveKnob.setRange(-23.0, 25.0);
70-
odDriveKnob.setValue(1.0);
70+
odDriveKnob.setValue(processor.pedalDriveKnobState);
7171
odDriveKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
7272
odDriveKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20);
7373
odDriveKnob.setNumDecimalPlacesToDisplay(1);
74-
odDriveKnob.setDoubleClickReturnValue(true, 0.0);
74+
odDriveKnob.setDoubleClickReturnValue(true, 1.0);
7575

7676
addAndMakeVisible(odLevelKnob);
7777
odLevelKnob.setLookAndFeel(&blackHexKnobLAF);
7878
odLevelKnob.addListener(this);
7979
odLevelKnob.setRange(-23.0, 25.0);
80-
odLevelKnob.setValue(1.0);
80+
odLevelKnob.setValue(processor.pedalLevelKnobState);
8181
odLevelKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
8282
odLevelKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20);
8383
odLevelKnob.setNumDecimalPlacesToDisplay(1);
84-
odLevelKnob.setDoubleClickReturnValue(true, 0.0);
84+
odLevelKnob.setDoubleClickReturnValue(true, 1.0);
8585

8686
// Size of plugin GUI
8787
setSize (500, 650);

SmartPedal/Source/PluginProcessor.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,21 +209,13 @@ void SmartPedalAudioProcessor::loadConfig(File configFile)
209209
}
210210

211211

212-
void SmartPedalAudioProcessor::setPreGain(float dbValue)
213-
{
214-
preGain = decibelToLinear(dbValue);
215-
}
216-
217-
void SmartPedalAudioProcessor::setPostGain(float dbValue)
218-
{
219-
postGain = decibelToLinear(dbValue);
220-
}
221-
222212
void SmartPedalAudioProcessor::set_odDrive(float odDriveKnobValue)
223213
{
224214
odDrive = decibelToLinear(odDriveKnobValue);
215+
pedalDriveKnobState = odDriveKnobValue;
225216
}
226217

218+
227219
float SmartPedalAudioProcessor::convertLogScale(float in_value, float x_min, float x_max, float y_min, float y_max)
228220
{
229221
float b = log(y_max / y_min) / (x_max - x_min);
@@ -236,6 +228,7 @@ float SmartPedalAudioProcessor::convertLogScale(float in_value, float x_min, flo
236228
void SmartPedalAudioProcessor::set_odLevel(float db_odLevel)
237229
{
238230
odLevel = decibelToLinear(db_odLevel);
231+
pedalLevelKnobState = db_odLevel;
239232
}
240233

241234

SmartPedal/Source/PluginProcessor.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ class SmartPedalAudioProcessor : public AudioProcessor
6161
void addDirectory(const File& file);
6262

6363
void loadConfig(File configFile);
64-
65-
void setPreGain(float dbValue);
66-
void setPostGain(float dbValue);
6764

6865
// Overdrive Pedal
6966
void set_odDrive(float odDriveKnobLevel);
@@ -75,6 +72,8 @@ class SmartPedalAudioProcessor : public AudioProcessor
7572

7673
// Pedal/amp states
7774
int od_state = 1; // 0 = off, 1 = on
75+
float pedalDriveKnobState = 1.0;
76+
float pedalLevelKnobState = 1.0;
7877

7978
File currentDirectory = File::getCurrentWorkingDirectory().getFullPathName();
8079

0 commit comments

Comments
 (0)