diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h index 7f25c9fae7..67b1cb896f 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h +++ b/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.h @@ -38,42 +38,14 @@ namespace juce #if (JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD)) || DOXYGEN //============================================================================== -/** - Implements a plugin format manager for LADSPA plugins. +/** Provided for backwards compatibility; LADSPA plugins are always headless. @tags{Audio} */ -class JUCE_API LADSPAPluginFormat : public AudioPluginFormat +class JUCE_API LADSPAPluginFormat : public LADSPAPluginFormatHeadless { -public: - LADSPAPluginFormat(); - ~LADSPAPluginFormat() override; - - //============================================================================== - static String getFormatName() { return "LADSPA"; } - String getName() const override { return getFormatName(); } - 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; - bool pluginNeedsRescanning (const PluginDescription&) override; - StringArray searchPathsForPlugins (const FileSearchPath&, bool recursive, bool) override; - bool doesPluginStillExist (const PluginDescription&) override; - FileSearchPath getDefaultLocationsToSearch() 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 (LADSPAPluginFormat) }; - #endif } diff --git a/modules/juce_audio_processors/juce_audio_processors.cpp b/modules/juce_audio_processors/juce_audio_processors.cpp index 052b30f891..420b0bcb3f 100644 --- a/modules/juce_audio_processors/juce_audio_processors.cpp +++ b/modules/juce_audio_processors/juce_audio_processors.cpp @@ -169,7 +169,6 @@ private: #include "format/juce_AudioPluginFormatManager.cpp" #include "processors/juce_AudioProcessorEditor.cpp" #include "processors/juce_GenericAudioProcessorEditor.cpp" -#include "format_types/juce_LADSPAPluginFormat.cpp" #include "format_types/juce_VSTPluginFormat.cpp" #include "format_types/juce_VST3PluginFormat.cpp" #include "format_types/juce_AudioUnitPluginFormat.mm" diff --git a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp b/modules/juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.cpp similarity index 92% rename from modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp rename to modules/juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.cpp index 79a9cb2150..427b9dd790 100644 --- a/modules/juce_audio_processors/format_types/juce_LADSPAPluginFormat.cpp +++ b/modules/juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.cpp @@ -586,10 +586,7 @@ private: //============================================================================== -LADSPAPluginFormat::LADSPAPluginFormat() {} -LADSPAPluginFormat::~LADSPAPluginFormat() {} - -void LADSPAPluginFormat::findAllTypesForFile (OwnedArray& results, const String& fileOrIdentifier) +void LADSPAPluginFormatHeadless::findAllTypesForFile (OwnedArray& results, const String& fileOrIdentifier) { if (! fileMightContainThisPluginType (fileOrIdentifier)) return; @@ -627,9 +624,10 @@ void LADSPAPluginFormat::findAllTypesForFile (OwnedArray& res } } -void LADSPAPluginFormat::createPluginInstance (const PluginDescription& desc, - double sampleRate, int blockSize, - PluginCreationCallback callback) +void LADSPAPluginFormatHeadless::createPluginInstance (const PluginDescription& desc, + double sampleRate, + int blockSize, + PluginCreationCallback callback) { std::unique_ptr result; @@ -665,33 +663,33 @@ void LADSPAPluginFormat::createPluginInstance (const PluginDescription& desc, callback (std::move (result), errorMsg); } -bool LADSPAPluginFormat::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const +bool LADSPAPluginFormatHeadless::requiresUnblockedMessageThreadDuringCreation (const PluginDescription&) const { return false; } -bool LADSPAPluginFormat::fileMightContainThisPluginType (const String& fileOrIdentifier) +bool LADSPAPluginFormatHeadless::fileMightContainThisPluginType (const String& fileOrIdentifier) { auto f = File::createFileWithoutCheckingPath (fileOrIdentifier); return f.existsAsFile() && f.hasFileExtension (".so"); } -String LADSPAPluginFormat::getNameOfPluginFromIdentifier (const String& fileOrIdentifier) +String LADSPAPluginFormatHeadless::getNameOfPluginFromIdentifier (const String& fileOrIdentifier) { return fileOrIdentifier; } -bool LADSPAPluginFormat::pluginNeedsRescanning (const PluginDescription& desc) +bool LADSPAPluginFormatHeadless::pluginNeedsRescanning (const PluginDescription& desc) { return File (desc.fileOrIdentifier).getLastModificationTime() != desc.lastFileModTime; } -bool LADSPAPluginFormat::doesPluginStillExist (const PluginDescription& desc) +bool LADSPAPluginFormatHeadless::doesPluginStillExist (const PluginDescription& desc) { return File::createFileWithoutCheckingPath (desc.fileOrIdentifier).exists(); } -StringArray LADSPAPluginFormat::searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive, bool) +StringArray LADSPAPluginFormatHeadless::searchPathsForPlugins (const FileSearchPath& directoriesToSearch, const bool recursive, bool) { StringArray results; @@ -701,9 +699,8 @@ StringArray LADSPAPluginFormat::searchPathsForPlugins (const FileSearchPath& dir return results; } -void LADSPAPluginFormat::recursiveFileSearch (StringArray& results, const File& dir, const bool recursive) +void LADSPAPluginFormatHeadless::recursiveFileSearch (StringArray& results, const File& dir, const bool recursive) { - for (const auto& iter : RangedDirectoryIterator (dir, false, "*", File::findFilesAndDirectories)) { auto f = iter.getFile(); @@ -720,7 +717,7 @@ void LADSPAPluginFormat::recursiveFileSearch (StringArray& results, const File& } } -FileSearchPath LADSPAPluginFormat::getDefaultLocationsToSearch() +FileSearchPath LADSPAPluginFormatHeadless::getDefaultLocationsToSearch() { return { SystemStats::getEnvironmentVariable ("LADSPA_PATH", "/usr/lib/ladspa;/usr/local/lib/ladspa;~/.ladspa").replace (":", ";") }; } diff --git a/modules/juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.h b/modules/juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.h new file mode 100644 index 0000000000..43f727f906 --- /dev/null +++ b/modules/juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.h @@ -0,0 +1,77 @@ +/* + ============================================================================== + + This file is part of the JUCE framework. + Copyright (c) Raw Material Software Limited + + JUCE is an open source framework subject to commercial or open source + licensing. + + By downloading, installing, or using the JUCE framework, or combining the + JUCE framework with any other source code, object code, content or any other + copyrightable work, you agree to the terms of the JUCE End User Licence + Agreement, and all incorporated terms including the JUCE Privacy Policy and + the JUCE Website Terms of Service, as applicable, which will bind you. If you + do not agree to the terms of these agreements, we will not license the JUCE + framework to you, and you must discontinue the installation or download + process and cease use of the JUCE framework. + + JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ + JUCE Privacy Policy: https://juce.com/juce-privacy-policy + JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ + + Or: + + You may also use this code under the terms of the AGPLv3: + https://www.gnu.org/licenses/agpl-3.0.en.html + + THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL + WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. + + ============================================================================== +*/ + +namespace juce +{ + +#if (JUCE_PLUGINHOST_LADSPA && (JUCE_LINUX || JUCE_BSD)) || DOXYGEN + +//============================================================================== +/** + Implements a plugin format manager for LADSPA plugins. + + @tags{Audio} +*/ +class JUCE_API LADSPAPluginFormatHeadless : public AudioPluginFormat +{ +public: + LADSPAPluginFormatHeadless() = default; + + //============================================================================== + static String getFormatName() { return "LADSPA"; } + String getName() const override { return getFormatName(); } + 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; + bool pluginNeedsRescanning (const PluginDescription&) override; + StringArray searchPathsForPlugins (const FileSearchPath&, bool recursive, bool) override; + bool doesPluginStillExist (const PluginDescription&) override; + FileSearchPath getDefaultLocationsToSearch() 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 (LADSPAPluginFormatHeadless) +}; + +#endif + +} diff --git a/modules/juce_audio_processors_headless/juce_audio_processors_headless.cpp b/modules/juce_audio_processors_headless/juce_audio_processors_headless.cpp index 2612a17c8e..9b4044a617 100644 --- a/modules/juce_audio_processors_headless/juce_audio_processors_headless.cpp +++ b/modules/juce_audio_processors_headless/juce_audio_processors_headless.cpp @@ -65,3 +65,4 @@ #include #include #include +#include diff --git a/modules/juce_audio_processors_headless/juce_audio_processors_headless.h b/modules/juce_audio_processors_headless/juce_audio_processors_headless.h index 9fb95143dc..9881e2020e 100644 --- a/modules/juce_audio_processors_headless/juce_audio_processors_headless.h +++ b/modules/juce_audio_processors_headless/juce_audio_processors_headless.h @@ -90,3 +90,4 @@ #include #include #include +#include