Skip to content

Commit

Permalink
Merge pull request #4 from keyth72/feature-add-load-model-button
Browse files Browse the repository at this point in the history
Added load model button
  • Loading branch information
GuitarML authored Oct 29, 2020
2 parents 2742976 + 3874270 commit 693ed15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 3 additions & 2 deletions SmartPedal/SmartPedal.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<JUCERPROJECT id="ym7AY5" name="SmartPedal" projectType="audioplug" pluginAUMainType="'aufx'"
companyName="HandDrawnAmps" headerPath="$(HOME)/eigen/" displaySplashScreen="1"
jucerFormatVersion="1" pluginCode="sp1" maxBinaryFileSize="20971520">
jucerFormatVersion="1" pluginCode="sp1" maxBinaryFileSize="20971520"
pluginManufacturer="GuitarML">
<MAINGROUP id="ZrSGof" name="SmartPedal">
<GROUP id="{0250E2E8-A733-0AA7-0A08-97085228CF87}" name="Resources">
<FILE id="v4BKeZ" name="footswitch_down.png" compile="0" resource="1"
Expand Down Expand Up @@ -72,7 +73,7 @@
<VS2019 targetFolder="Builds/VisualStudio2019">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" targetName="SmartPedal"/>
<CONFIGURATION isDebug="0" name="Release" targetName="SmartPedal"/>
<CONFIGURATION isDebug="0" name="Release" targetName="SmartPedal" headerPath="C:\Users\rache\Desktop\dev\eigen-3.3.7"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_video"/>
Expand Down
17 changes: 12 additions & 5 deletions SmartPedal/Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ SmartPedalAudioProcessorEditor::SmartPedalAudioProcessorEditor (SmartPedalAudioP
// editor's size to whatever you need it to

// Overall Widgets
addAndMakeVisible(loadButton);
loadButton.setButtonText("LOAD MODEL");
loadButton.addListener(this);

addAndMakeVisible(modelLabel);
modelLabel.setText("Model", juce::NotificationType::dontSendNotification);
Expand Down Expand Up @@ -124,6 +127,7 @@ void SmartPedalAudioProcessorEditor::resized()
// subcomponents in your editor..

//Overall Widgets
loadButton.setBounds(184, 68, 120, 20);
modelSelect.setBounds(142, 36, 210, 25);
modelLabel.setBounds(193, 12, 90, 25);

Expand All @@ -136,20 +140,23 @@ void SmartPedalAudioProcessorEditor::resized()

void SmartPedalAudioProcessorEditor::loadButtonClicked()
{
FileChooser chooser("Load model directory...",
FileChooser chooser("Load a .json model...",
{},
"*.json");
if (chooser.browseForDirectory())
if (chooser.browseForFileToOpen())
{
processor.currentDirectory = chooser.getResult();
File file = chooser.getResult();
processor.loadConfig(file);
}
}

void SmartPedalAudioProcessorEditor::buttonClicked(juce::Button* button)
{
if (button == &odFootSw)
if (button == &odFootSw) {
odFootSwClicked();
} else if (button == &loadButton) {
loadButtonClicked();
}
}

void SmartPedalAudioProcessorEditor::odFootSwClicked() {
Expand Down
2 changes: 1 addition & 1 deletion SmartPedal/Source/PluginEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SmartPedalAudioProcessorEditor : public AudioProcessorEditor,
// This reference is provided as a quick way for your editor to
// access the processor object that created it.
SmartPedalAudioProcessor& processor;

TextButton loadButton;
virtual void buttonClicked(Button* button) override;
void loadButtonClicked();

Expand Down

0 comments on commit 693ed15

Please sign in to comment.