diff --git a/Source/JaySynthAudioProcessorEditor.cpp b/Source/JaySynthAudioProcessorEditor.cpp index d1de0ed..7500b51 100644 --- a/Source/JaySynthAudioProcessorEditor.cpp +++ b/Source/JaySynthAudioProcessorEditor.cpp @@ -26,6 +26,8 @@ //[MiscUserDefs] You can add your own user definitions and misc code here... //[/MiscUserDefs] +using namespace juce; + //============================================================================== JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcessor* ownerFilter, bool has_wt) : AudioProcessorEditor (ownerFilter) @@ -4927,7 +4929,43 @@ void JaySynthAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked) float value; param_info_t *pParamInfo; - if (buttonThatWasClicked == m_button_patch_incr) + if (buttonThatWasClicked == m_button_bank_load) + { + FileChooser fc("Load bank"); + if (fc.browseForFileToOpen()) + { + File const &file = fc.getResult(); + getProcessor()->loadBank(file); + } + } + else if (buttonThatWasClicked == m_button_bank_save) + { + FileChooser fc("Save bank"); + if (fc.browseForFileToSave(true)) + { + File const &file = fc.getResult(); + getProcessor()->saveBank(file); + } + } + else if (buttonThatWasClicked == m_button_patch_load) + { + FileChooser fc("Load patch"); + if (fc.browseForFileToOpen()) + { + File const &file = fc.getResult(); + getProcessor()->loadPatch(0, file); + } + } + else if (buttonThatWasClicked == m_button_patch_save) + { + FileChooser fc("Save patch"); + if (fc.browseForFileToSave(true)) + { + File const &file = fc.getResult(); + getProcessor()->savePatch(0, file); + } + } + else if (buttonThatWasClicked == m_button_patch_incr) { getProcessor()->setCurrentProgram(getProcessor()->getCurrentProgram()+1); return; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 6a89d9f..bf877ca 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -911,6 +911,26 @@ void JaySynthAudioProcessor::setCurrentProgramStateInformation (const void* data } } +void JaySynthAudioProcessor::loadPatch (int index, const File &file) +{ + String filename(file.getFullPathName()); +} + +void JaySynthAudioProcessor::savePatch (int index, const File &file) +{ + String filename(file.getFullPathName()); +} + +void JaySynthAudioProcessor::loadBank (const File &file) +{ + String filename(file.getFullPathName()); +} + +void JaySynthAudioProcessor::saveBank (const File &file) +{ + String filename(file.getFullPathName()); +} + //============================================================================== // This creates new instances of the plugin.. AudioProcessor* JUCE_CALLTYPE createPluginFilter() diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 269f73f..6745b48 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -211,6 +211,10 @@ public: void getStateInformation (MemoryBlock& destData); void setStateInformation (const void* data, int sizeInBytes); + void loadPatch (int index, const File &file); + void savePatch (int index, const File &file); + void loadBank (const File &file); + void saveBank (const File &file); //============================================================================== // These properties are public so that our editor component can access them // A bit of a hacky way to do it, but it's only a demo! Obviously in your own