From 8a2af98497f7dd746ef43912deb30b387bdba20b Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 17 Jun 2014 08:54:41 +0100 Subject: [PATCH] Added an assertion to warn if a plugin reports no programs, because this can cause problems in some Sony hosts. --- extras/audio plugin demo/Source/PluginProcessor.h | 4 ++-- modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/audio plugin demo/Source/PluginProcessor.h b/extras/audio plugin demo/Source/PluginProcessor.h index f8190476b2..ad4fcf3014 100644 --- a/extras/audio plugin demo/Source/PluginProcessor.h +++ b/extras/audio plugin demo/Source/PluginProcessor.h @@ -56,10 +56,10 @@ public: double getTailLengthSeconds() const override; //============================================================================== - int getNumPrograms() override { return 0; } + int getNumPrograms() override { return 1; } int getCurrentProgram() override { return 0; } void setCurrentProgram (int /*index*/) override {} - const String getProgramName (int /*index*/) override { return String::empty; } + const String getProgramName (int /*index*/) override { return "Default"; } void changeProgramName (int /*index*/, const String& /*newName*/) override {} //============================================================================== diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp index 59391af17b..0b848748b6 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp @@ -281,6 +281,10 @@ public: setInitialDelay (filter->getLatencySamples()); programsAreChunks (true); + // NB: For reasons best known to themselves, some hosts fail to load/save plugin + // state correctly if the plugin doesn't report that it has at least 1 program. + jassert (af->getNumPrograms() > 0); + activePlugins.add (this); }