- Bank/Patch load/save: Opens fileChooser on btn press and calls pluginProcessor

This commit is contained in:
2023-04-28 09:47:31 +02:00
parent 45f2696b77
commit 5850ab5d46
3 changed files with 63 additions and 1 deletions
+39 -1
View File
@@ -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;
+20
View File
@@ -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()
+4
View File
@@ -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