mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
AudioPluginFormatManager: Replace addDefaultFormats function() with non-member
This commit is contained in:
parent
33b9f1e6ec
commit
426b74fcf7
6 changed files with 60 additions and 48 deletions
|
|
@ -2,6 +2,25 @@
|
|||
|
||||
# Version 8.0.9
|
||||
|
||||
## Change
|
||||
|
||||
The function AudioPluginFormatManager::addDefaultFormats() has been removed.
|
||||
|
||||
**Possible Issues**
|
||||
|
||||
Code that calls this function will fail to compile.
|
||||
|
||||
**Workaround**
|
||||
|
||||
Use the new non-member function "addDefaultFormatsToManager()" instead.
|
||||
|
||||
**Rationale**
|
||||
|
||||
This change removes the dependency between the AudioPluginFormatManager and the
|
||||
concrete plugin format types, allowing the AudioPluginFormatManager to be built
|
||||
in isolation.
|
||||
|
||||
|
||||
## Change
|
||||
|
||||
The signatures of OpenGLFrameBuffer::readPixels() and
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ public:
|
|||
return opt;
|
||||
}());
|
||||
|
||||
pluginFormatManager.addDefaultFormats();
|
||||
addDefaultFormatsToManager (pluginFormatManager);
|
||||
|
||||
if (auto savedPluginList = appProperties.getUserSettings()->getXmlValue ("pluginList"))
|
||||
pluginList.recreateFromXml (*savedPluginList);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class PluginScannerSubprocess final : private ChildProcessWorker,
|
|||
public:
|
||||
PluginScannerSubprocess()
|
||||
{
|
||||
formatManager.addDefaultFormats();
|
||||
addDefaultFormatsToManager (formatManager);
|
||||
}
|
||||
|
||||
using ChildProcessWorker::initialiseFromCommandLine;
|
||||
|
|
|
|||
|
|
@ -314,8 +314,8 @@ MainHostWindow::MainHostWindow()
|
|||
LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
|
||||
DocumentWindow::allButtons)
|
||||
{
|
||||
formatManager.addDefaultFormats();
|
||||
formatManager.addFormat (new InternalPluginFormat());
|
||||
addDefaultFormatsToManager (formatManager);
|
||||
formatManager.addFormat (std::make_unique<InternalPluginFormat>());
|
||||
|
||||
auto safeThis = SafePointer<MainHostWindow> (this);
|
||||
RuntimePermissions::request (RuntimePermissions::recordAudio,
|
||||
|
|
|
|||
|
|
@ -37,56 +37,27 @@
|
|||
namespace juce
|
||||
{
|
||||
|
||||
AudioPluginFormatManager::AudioPluginFormatManager() {}
|
||||
AudioPluginFormatManager::~AudioPluginFormatManager() {}
|
||||
|
||||
//==============================================================================
|
||||
void AudioPluginFormatManager::addDefaultFormats()
|
||||
void addDefaultFormatsToManager (AudioPluginFormatManager& manager)
|
||||
{
|
||||
#if JUCE_DEBUG
|
||||
// you should only call this method once!
|
||||
for (auto* format [[maybe_unused]] : formats)
|
||||
{
|
||||
#if JUCE_INTERNAL_HAS_VST
|
||||
jassert (dynamic_cast<VSTPluginFormat*> (format) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_VST3
|
||||
jassert (dynamic_cast<VST3PluginFormat*> (format) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_AU
|
||||
jassert (dynamic_cast<AudioUnitPluginFormat*> (format) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_LADSPA
|
||||
jassert (dynamic_cast<LADSPAPluginFormat*> (format) == nullptr);
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_LV2
|
||||
jassert (dynamic_cast<LV2PluginFormat*> (format) == nullptr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_AU
|
||||
formats.add (new AudioUnitPluginFormat());
|
||||
manager.addFormat (std::make_unique<AudioUnitPluginFormat>());
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_VST
|
||||
formats.add (new VSTPluginFormat());
|
||||
manager.addFormat (std::make_unique<VSTPluginFormat>());
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_VST3
|
||||
formats.add (new VST3PluginFormat());
|
||||
manager.addFormat (std::make_unique<VST3PluginFormat>());
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_LADSPA
|
||||
formats.add (new LADSPAPluginFormat());
|
||||
manager.addFormat (std::make_unique<LADSPAPluginFormat>());
|
||||
#endif
|
||||
|
||||
#if JUCE_INTERNAL_HAS_LV2
|
||||
formats.add (new LV2PluginFormat());
|
||||
manager.addFormat (std::make_unique<LV2PluginFormat>());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -100,9 +71,19 @@ Array<AudioPluginFormat*> AudioPluginFormatManager::getFormats() const
|
|||
return a;
|
||||
}
|
||||
|
||||
void AudioPluginFormatManager::addFormat (AudioPluginFormat* format)
|
||||
void AudioPluginFormatManager::addFormat (std::unique_ptr<AudioPluginFormat> format)
|
||||
{
|
||||
formats.add (format);
|
||||
for (auto* existing : formats)
|
||||
{
|
||||
if (existing->getName() == format->getName())
|
||||
{
|
||||
// This format manager already contains a format with this name!
|
||||
jassertfalse;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
formats.add (std::move (format));
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioPluginInstance> AudioPluginFormatManager::createPluginInstance (const PluginDescription& description,
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ class JUCE_API AudioPluginFormatManager
|
|||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
AudioPluginFormatManager();
|
||||
|
||||
/** Destructor. */
|
||||
~AudioPluginFormatManager();
|
||||
AudioPluginFormatManager() = default;
|
||||
|
||||
//==============================================================================
|
||||
/** Adds the set of available standard formats, e.g. VST. */
|
||||
void addDefaultFormats();
|
||||
/** This function has been removed. To add default formats to the manager,
|
||||
use one of the new functions addDefaultFormatsToManager() or
|
||||
addHeadlessDefaultFormatsToManager();
|
||||
*/
|
||||
void addDefaultFormats() = delete;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the number of types of format that are available.
|
||||
|
|
@ -74,7 +74,13 @@ public:
|
|||
/** Adds a format to the list.
|
||||
The object passed in will be owned and deleted by the manager.
|
||||
*/
|
||||
void addFormat (AudioPluginFormat*);
|
||||
[[deprecated ("Prefer the signature that accepts a unique_ptr")]]
|
||||
void addFormat (AudioPluginFormat* f) { addFormat (rawToUniquePtr (f)); }
|
||||
|
||||
/** Adds a format to the list.
|
||||
The object passed in will be owned and deleted by the manager.
|
||||
*/
|
||||
void addFormat (std::unique_ptr<AudioPluginFormat>);
|
||||
|
||||
//==============================================================================
|
||||
/** Tries to load the type for this description, by trying all the formats
|
||||
|
|
@ -148,4 +154,10 @@ private:
|
|||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginFormatManager)
|
||||
};
|
||||
|
||||
/** Add all standard plugin formats to the AudioPluginFormatManager, *with* UI support.
|
||||
|
||||
This function replaces AudioPluginFormatManager::addDefaultFormats().
|
||||
*/
|
||||
void addDefaultFormatsToManager (AudioPluginFormatManager&);
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue