diff --git a/modules/juce_audio_processors/format/juce_AudioPluginFormat.h b/modules/juce_audio_processors/format/juce_AudioPluginFormat.h index 88f263b512..c7753e0b44 100644 --- a/modules/juce_audio_processors/format/juce_AudioPluginFormat.h +++ b/modules/juce_audio_processors/format/juce_AudioPluginFormat.h @@ -110,6 +110,12 @@ public: /** Returns true if this format needs to run a scan to find its list of plugins. */ virtual bool canScanForPlugins() const = 0; + /** Should return true if this format is both safe and quick to scan - i.e. if a file + can be scanned within a few milliseconds on a background thread, without actually + needing to load an executable. + */ + virtual bool isTrivialToScan() const = 0; + /** Searches a suggested set of directories for any plugins in this format. The path might be ignored, e.g. by AUs, which are found by the OS rather than manually. @@ -144,7 +150,8 @@ protected: virtual void createPluginInstance (const PluginDescription&, double initialSampleRate, int initialBufferSize, PluginCreationCallback) = 0; - virtual bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept = 0; + /** Returns true if instantiation of this plugin type must be done from a non-message thread. */ + virtual bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const = 0; private: struct AsyncCreateMessage; diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h index 2afb4fe870..34ff650e57 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.h @@ -43,7 +43,10 @@ public: ~AudioUnitPluginFormat() override; //============================================================================== - String getName() const override { return "AudioUnit"; } + String getName() const override { return "AudioUnit"; } + bool canScanForPlugins() const override { return true; } + bool isTrivialToScan() const override { return false; } + void findAllTypesForFile (OwnedArray&, const String& fileOrIdentifier) override; bool fileMightContainThisPluginType (const String& fileOrIdentifier) override; String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) override; @@ -51,17 +54,13 @@ public: StringArray searchPathsForPlugins (const FileSearchPath&, bool recursive, bool) override; bool doesPluginStillExist (const PluginDescription&) override; FileSearchPath getDefaultLocationsToSearch() override; - bool canScanForPlugins() const override { return true; } private: //============================================================================== - void createPluginInstance (const PluginDescription&, - double initialSampleRate, int initialBufferSize, - PluginCreationCallback) override; + void createPluginInstance (const PluginDescription&, double initialSampleRate, + int initialBufferSize, PluginCreationCallback) override; + bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const override; - bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept override; - - //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioUnitPluginFormat) }; diff --git a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm index b8e70062e2..af6e491b87 100644 --- a/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm +++ b/modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm @@ -2754,7 +2754,7 @@ void AudioUnitPluginFormat::createPluginInstance (const PluginDescription& desc, } } -bool AudioUnitPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription& desc) const noexcept +bool AudioUnitPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription& desc) const { #if JUCE_SUPPORTS_AUv3 String pluginName, version, manufacturer; diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp index 1a8deebfdf..960b3db8b7 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp @@ -653,7 +653,7 @@ void LADSPAPluginFormat::createPluginInstance (const PluginDescription& desc, callback (std::move (result), errorMsg); } -bool LADSPAPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept +bool LADSPAPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const { return false; } diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h index 960c1fa2f3..c1f8741ddb 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h @@ -42,7 +42,10 @@ public: ~LADSPAPluginFormat() override; //============================================================================== - String getName() const override { return "LADSPA"; } + String getName() const override { return "LADSPA"; } + bool canScanForPlugins() const override { return true; } + bool isTrivialToScan() const override { return false; } + void findAllTypesForFile (OwnedArray&, const String& fileOrIdentifier) override; bool fileMightContainThisPluginType (const String& fileOrIdentifier) override; String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) override; @@ -50,16 +53,12 @@ public: StringArray searchPathsForPlugins (const FileSearchPath&, bool recursive, bool) override; bool doesPluginStillExist (const PluginDescription&) override; FileSearchPath getDefaultLocationsToSearch() override; - bool canScanForPlugins() const override { return true; } private: //============================================================================== void createPluginInstance (const PluginDescription&, double initialSampleRate, int initialBufferSize, PluginCreationCallback) override; - - bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept override; - -private: + bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const override; void recursiveFileSearch (StringArray&, const File&, bool recursive); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LADSPAPluginFormat) diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 4dc3ed1670..e8290fcd30 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -3114,7 +3114,7 @@ void VST3PluginFormat::createPluginInstance (const PluginDescription& descriptio callback (std::move (result), errorMsg); } -bool VST3PluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept +bool VST3PluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const { return false; } diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h index f38bdc33d3..ebb78f1724 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.h @@ -51,7 +51,10 @@ public: static bool setStateFromVSTPresetFile (AudioPluginInstance*, const MemoryBlock&); //============================================================================== - String getName() const override { return "VST3"; } + String getName() const override { return "VST3"; } + bool canScanForPlugins() const override { return true; } + bool isTrivialToScan() const override { return false; } + void findAllTypesForFile (OwnedArray&, const String& fileOrIdentifier) override; bool fileMightContainThisPluginType (const String& fileOrIdentifier) override; String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) override; @@ -59,16 +62,12 @@ public: StringArray searchPathsForPlugins (const FileSearchPath&, bool recursive, bool) override; bool doesPluginStillExist (const PluginDescription&) override; FileSearchPath getDefaultLocationsToSearch() override; - bool canScanForPlugins() const override { return true; } - -private: - void createPluginInstance (const PluginDescription&, double initialSampleRate, - int initialBufferSize, PluginCreationCallback) override; - - bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept override; private: //============================================================================== + void createPluginInstance (const PluginDescription&, double initialSampleRate, + int initialBufferSize, PluginCreationCallback) override; + bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const override; void recursiveFileSearch (StringArray&, const File&, bool recursive); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VST3PluginFormat) diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index 3b77c92fd7..35293b8b1c 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -3611,7 +3611,7 @@ void VSTPluginFormat::createPluginInstance (const PluginDescription& desc, callback (std::move (result), errorMsg); } -bool VSTPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept +bool VSTPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const { return false; } diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h index d66dcf581a..39519399de 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.h @@ -98,7 +98,10 @@ public: static AudioPluginInstance* getPluginInstanceFromVstEffectInterface (void* aEffect); //============================================================================== - String getName() const override { return "VST"; } + String getName() const override { return "VST"; } + bool canScanForPlugins() const override { return true; } + bool isTrivialToScan() const override { return false; } + void findAllTypesForFile (OwnedArray&, const String& fileOrIdentifier) override; bool fileMightContainThisPluginType (const String& fileOrIdentifier) override; String getNameOfPluginFromIdentifier (const String& fileOrIdentifier) override; @@ -106,7 +109,6 @@ public: StringArray searchPathsForPlugins (const FileSearchPath&, bool recursive, bool) override; bool doesPluginStillExist (const PluginDescription&) override; FileSearchPath getDefaultLocationsToSearch() override; - bool canScanForPlugins() const override { return true; } /** Can be overridden to receive a callback when each member of a shell plugin is about to be tested during a call to findAllTypesForFile(). @@ -119,10 +121,7 @@ private: //============================================================================== void createPluginInstance (const PluginDescription&, double initialSampleRate, int initialBufferSize, PluginCreationCallback) override; - - bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const noexcept override; - -private: + bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const override; void recursiveFileSearch (StringArray&, const File&, bool recursive); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VSTPluginFormat)