π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Update pedalboard/ExternalPlugin.h
emilio12348a9131dde4d7
diff --git a/pedalboard/ExternalPlugin.h b/pedalboard/ExternalPlugin.hindex 006c4a1..779f6a2 100644--- a/pedalboard/ExternalPlugin.h+++ b/pedalboard/ExternalPlugin.h@@ -226,19 +226,21 @@ public:}}- struct PresetVisitor: juce::ExtensionsVisitor{- std::string presetFile;- bool result;- PresetVisitor(std::string file){- presetFile = file;- }- void visitVST3Client (const juce::ExtensionsVisitor::VST3Client& client) override{- result = false;- juce::File fl(presetFile);- juce::MemoryBlock mb;+ struct PresetVisitor : public juce::ExtensionsVisitor {+ const std::string presetFilePath;++ PresetVisitor(const std::string presetFilePath): presetFilePath(presetFilePath) { }++ void visitVST3Client(const juce::ExtensionsVisitor::VST3Client& client) override {+ juce::File presetFile(presetFilePath);+ juce::MemoryBlock presetData;++ if (!presetFile.loadFileAsData(presetData)) {+ throw std::runtime_error("Failed to read preset file: " + presetFilePath);+ }- if (fl.loadFileAsData(mb)){- result = client.setPreset(mb);+ if (!client.setPreset(presetData)) {+ throw std::runtime_error("Plugin returned an error when loading data from preset file: " + presetFilePath);}}};