commit 350004b910af751005a8322c870ed73859dc70f8
parent f400bb8e08cb18ecf3878195ba10e25f62729477
Author: Keith Bloemer <[email protected]>
Date: Mon, 14 Mar 2022 09:59:43 -0500
Merge pull request #29 from GuitarML/update-filechooser
Update filechooser
https://github.com/GuitarML/NeuralPi/issues/28
Diffstat:
4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
@@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false # show all errors for each platform (vs. cancel jobs on error)
matrix:
- os: [ubuntu-latest, windows-latest, macOS-latest]
+ os: [ubuntu-latest, windows-2019, macOS-latest]
steps:
- name: Install Linux Deps
diff --git a/Source/CabSim.h b/Source/CabSim.h
@@ -41,7 +41,7 @@ public:
convolution.loadImpulseResponse(irFile,
juce::dsp::Convolution::Stereo::yes,
juce::dsp::Convolution::Trim::no,
- 1024);
+ 0); // Set to 0 to use the full size of IR with no trimming
}
private:
@@ -53,4 +53,4 @@ private:
juce::dsp::ProcessorChain<juce::dsp::Convolution> processorChain;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CabSim)
-};
-\ No newline at end of file
+};
diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp
@@ -682,13 +682,15 @@ void NeuralPiAudioProcessorEditor::updateToggleState(juce::Button* button, juce:
}
void NeuralPiAudioProcessorEditor::loadButtonClicked()
-{
- FileChooser chooser("Select one or more .json tone files to import",
- {},
- "*.json");
- if (chooser.browseForMultipleFilesToOpen())
+{
+ myChooser = std::make_unique<FileChooser> ("Select one or more .json tone files to import",
+ File::getSpecialLocation (File::userDesktopDirectory),
+ "*.json");
+
+ auto folderChooserFlags = FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles | FileBrowserComponent::canSelectMultipleItems;
+
+ myChooser->launchAsync (folderChooserFlags, [this] (const FileChooser& chooser)
{
- int import_fail = 1;
Array<File> files = chooser.getResults();
for (auto file : files) {
File fullpath = processor.userAppDataDirectory_tones.getFullPathName() + "/" + file.getFileName();
@@ -713,18 +715,20 @@ void NeuralPiAudioProcessorEditor::loadButtonClicked()
std::sort(processor.jsonFiles.begin(), processor.jsonFiles.end());
}
}
- }
+ });
setParamKnobColor();
}
void NeuralPiAudioProcessorEditor::loadIRClicked()
{
- FileChooser chooser("Select one or more .wav IR files to import",
- {},
- "*.wav");
- if (chooser.browseForMultipleFilesToOpen())
+ myChooser = std::make_unique<FileChooser> ("Select one or more .wav IR files to import",
+ File::getSpecialLocation (File::userDesktopDirectory),
+ "*.wav");
+
+ auto folderChooserFlags = FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles | FileBrowserComponent::canSelectMultipleItems;
+
+ myChooser->launchAsync (folderChooserFlags, [this] (const FileChooser& chooser)
{
- int import_fail = 1;
Array<File> files = chooser.getResults();
for (auto file : files) {
File fullpath = processor.userAppDataDirectory_irs.getFullPathName() + "/" + file.getFileName();
@@ -749,7 +753,7 @@ void NeuralPiAudioProcessorEditor::loadIRClicked()
std::sort(processor.irFiles.begin(), processor.irFiles.end());
}
}
- }
+ });
}
@@ -1101,4 +1105,4 @@ void NeuralPiAudioProcessorEditor::setParamKnobColor()
ampMasterKnob.setLookAndFeel(&redLookAndFeel);
}
-}
-\ No newline at end of file
+}
diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h
@@ -66,6 +66,9 @@ public:
const String modelName{ "model" };
const String irName{ "ir" };
+ // For the FileChooser to load json models and IR files
+ std::unique_ptr<FileChooser> myChooser;
+
private:
// This reference is provided as a quick way for your editor to
// access the processor object that created it.