Skip to content

Commit

Permalink
Merge pull request #5 from keyth72/feature-save-knob-states
Browse files Browse the repository at this point in the history
Added save knob state feature and removed unused code.
  • Loading branch information
GuitarML authored Nov 3, 2020
2 parents 093647a + 6d316d0 commit 2303926
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
8 changes: 4 additions & 4 deletions SmartPedal/Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,21 @@ SmartPedalAudioProcessorEditor::SmartPedalAudioProcessorEditor (SmartPedalAudioP
odDriveKnob.setLookAndFeel(&blackHexKnobLAF);
odDriveKnob.addListener(this);
odDriveKnob.setRange(-23.0, 25.0);
odDriveKnob.setValue(1.0);
odDriveKnob.setValue(processor.pedalDriveKnobState);
odDriveKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
odDriveKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20);
odDriveKnob.setNumDecimalPlacesToDisplay(1);
odDriveKnob.setDoubleClickReturnValue(true, 0.0);
odDriveKnob.setDoubleClickReturnValue(true, 1.0);

addAndMakeVisible(odLevelKnob);
odLevelKnob.setLookAndFeel(&blackHexKnobLAF);
odLevelKnob.addListener(this);
odLevelKnob.setRange(-23.0, 25.0);
odLevelKnob.setValue(1.0);
odLevelKnob.setValue(processor.pedalLevelKnobState);
odLevelKnob.setSliderStyle(juce::Slider::SliderStyle::RotaryVerticalDrag);
odLevelKnob.setTextBoxStyle(juce::Slider::TextEntryBoxPosition::NoTextBox, false, 50, 20);
odLevelKnob.setNumDecimalPlacesToDisplay(1);
odLevelKnob.setDoubleClickReturnValue(true, 0.0);
odLevelKnob.setDoubleClickReturnValue(true, 1.0);

// Size of plugin GUI
setSize (500, 650);
Expand Down
13 changes: 3 additions & 10 deletions SmartPedal/Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,13 @@ void SmartPedalAudioProcessor::loadConfig(File configFile)
}


void SmartPedalAudioProcessor::setPreGain(float dbValue)
{
preGain = decibelToLinear(dbValue);
}

void SmartPedalAudioProcessor::setPostGain(float dbValue)
{
postGain = decibelToLinear(dbValue);
}

void SmartPedalAudioProcessor::set_odDrive(float odDriveKnobValue)
{
odDrive = decibelToLinear(odDriveKnobValue);
pedalDriveKnobState = odDriveKnobValue;
}


float SmartPedalAudioProcessor::convertLogScale(float in_value, float x_min, float x_max, float y_min, float y_max)
{
float b = log(y_max / y_min) / (x_max - x_min);
Expand All @@ -236,6 +228,7 @@ float SmartPedalAudioProcessor::convertLogScale(float in_value, float x_min, flo
void SmartPedalAudioProcessor::set_odLevel(float db_odLevel)
{
odLevel = decibelToLinear(db_odLevel);
pedalLevelKnobState = db_odLevel;
}


Expand Down
5 changes: 2 additions & 3 deletions SmartPedal/Source/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ class SmartPedalAudioProcessor : public AudioProcessor
void addDirectory(const File& file);

void loadConfig(File configFile);

void setPreGain(float dbValue);
void setPostGain(float dbValue);

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

// Pedal/amp states
int od_state = 1; // 0 = off, 1 = on
float pedalDriveKnobState = 1.0;
float pedalLevelKnobState = 1.0;

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

Expand Down

0 comments on commit 2303926

Please sign in to comment.