mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
LADSPAPluginFormat: Move to juce_audio_processors_headless
This commit is contained in:
parent
6f24663ed9
commit
4f22db33b7
6 changed files with 94 additions and 47 deletions
|
|
@ -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<PluginDescription>&, 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
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -586,10 +586,7 @@ private:
|
|||
|
||||
|
||||
//==============================================================================
|
||||
LADSPAPluginFormat::LADSPAPluginFormat() {}
|
||||
LADSPAPluginFormat::~LADSPAPluginFormat() {}
|
||||
|
||||
void LADSPAPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& results, const String& fileOrIdentifier)
|
||||
void LADSPAPluginFormatHeadless::findAllTypesForFile (OwnedArray<PluginDescription>& results, const String& fileOrIdentifier)
|
||||
{
|
||||
if (! fileMightContainThisPluginType (fileOrIdentifier))
|
||||
return;
|
||||
|
|
@ -627,9 +624,10 @@ void LADSPAPluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& 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<LADSPAPluginInstance> 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 (":", ";") };
|
||||
}
|
||||
|
|
@ -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<PluginDescription>&, 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
|
||||
|
||||
}
|
||||
|
|
@ -65,3 +65,4 @@
|
|||
#include <juce_audio_processors_headless/utilities/juce_AudioParameterChoice.cpp>
|
||||
#include <juce_audio_processors_headless/utilities/ARA/juce_ARA_utils.cpp>
|
||||
#include <juce_audio_processors_headless/format_types/juce_AudioUnitPluginFormatHeadless.mm>
|
||||
#include <juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.cpp>
|
||||
|
|
|
|||
|
|
@ -90,3 +90,4 @@
|
|||
#include <juce_audio_processors_headless/utilities/ARA/juce_ARADebug.h>
|
||||
#include <juce_audio_processors_headless/utilities/ARA/juce_ARA_utils.h>
|
||||
#include <juce_audio_processors_headless/format_types/juce_AudioUnitPluginFormatHeadless.h>
|
||||
#include <juce_audio_processors_headless/format_types/juce_LADSPAPluginFormatHeadless.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue