JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::VSTPluginFormat Class Reference

Implements a plugin format manager for VSTs. More...

#include <juce_VSTPluginFormat.h>

Inheritance diagram for juce::VSTPluginFormat:
Collaboration diagram for juce::VSTPluginFormat:

Classes

class  ExtraFunctions
 Base class for some extra functions that can be attached to a VST plugin instance. More...
 

Public Types

using PluginCreationCallback = std::function< void(std::unique_ptr< AudioPluginInstance >, const String &)>
 A callback lambda that is passed to createPluginInstanceAsync() More...
 

Public Member Functions

 VSTPluginFormat ()
 
 ~VSTPluginFormat () override
 
virtual void aboutToScanVSTShellPlugin (const PluginDescription &)
 Can be overridden to receive a callback when each member of a shell plugin is about to be tested during a call to findAllTypesForFile(). More...
 
bool canScanForPlugins () const override
 Returns true if this format needs to run a scan to find its list of plugins. More...
 
std::unique_ptr< AudioPluginInstancecreateInstanceFromDescription (const PluginDescription &, double initialSampleRate, int initialBufferSize)
 Tries to recreate a type from a previously generated PluginDescription. More...
 
std::unique_ptr< AudioPluginInstancecreateInstanceFromDescription (const PluginDescription &, double initialSampleRate, int initialBufferSize, String &errorMessage)
 Same as above but with the possibility of returning an error message. More...
 
void createPluginInstanceAsync (const PluginDescription &description, double initialSampleRate, int initialBufferSize, PluginCreationCallback)
 Tries to recreate a type from a previously generated PluginDescription. More...
 
bool doesPluginStillExist (const PluginDescription &) override
 Checks whether this plugin could possibly be loaded. More...
 
bool fileMightContainThisPluginType (const String &fileOrIdentifier) override
 Should do a quick check to see if this file or directory might be a plugin of this format. More...
 
void findAllTypesForFile (OwnedArray< PluginDescription > &, const String &fileOrIdentifier) override
 This tries to create descriptions for all the plugin types available in a binary module file. More...
 
FileSearchPath getDefaultLocationsToSearch () override
 Returns the typical places to look for this kind of plugin. More...
 
String getName () const override
 Returns the format name. More...
 
String getNameOfPluginFromIdentifier (const String &fileOrIdentifier) override
 Returns a readable version of the name of the plugin that this identifier refers to. More...
 
bool isTrivialToScan () const override
 Should return true if this format is both safe and quick to scan - i.e. More...
 
bool pluginNeedsRescanning (const PluginDescription &) override
 Returns true if this plugin's version or date has changed and it should be re-checked. More...
 
StringArray searchPathsForPlugins (const FileSearchPath &, bool recursive, bool) override
 Searches a suggested set of directories for any plugins in this format. More...
 

Static Public Member Functions

static AudioPluginInstancecreateCustomVSTFromMainCall (void *entryPointFunction, double initialSampleRate, int initialBufferSize)
 Given a suitable function pointer to a VSTPluginMain function, this will attempt to instantiate and return a plugin for it. More...
 
static pointer_sized_int dispatcher (AudioPluginInstance *, int32, int32, pointer_sized_int, void *, float)
 This simply calls directly to the VST's AEffect::dispatcher() function. More...
 
static bool getChunkData (AudioPluginInstance *plugin, MemoryBlock &result, bool isPreset)
 Attempts to get a VST's state as a chunk of memory. More...
 
static String getFormatName ()
 
static AudioPluginInstancegetPluginInstanceFromVstEffectInterface (void *aEffect)
 Given a VstEffectInterface* (aka vst::AEffect*), this will return the juce AudioPluginInstance that is being used to wrap it. More...
 
static const XmlElementgetVSTXML (AudioPluginInstance *plugin)
 Attempts to retrieve the VSTXML data from a plugin. More...
 
static bool loadFromFXBFile (AudioPluginInstance *plugin, const void *data, size_t dataSize)
 Attempts to reload a VST plugin's state from some FXB or FXP data. More...
 
static bool saveToFXBFile (AudioPluginInstance *plugin, MemoryBlock &result, bool asFXB)
 Attempts to save a VST's state to some FXP or FXB data. More...
 
static bool setChunkData (AudioPluginInstance *plugin, const void *data, int size, bool isPreset)
 Attempts to set a VST's state from a chunk of memory. More...
 
static void setExtraFunctions (AudioPluginInstance *plugin, ExtraFunctions *functions)
 Provides an ExtraFunctions callback object for a plugin to use. More...
 

Private Member Functions

void createPluginInstance (const PluginDescription &, double initialSampleRate, int initialBufferSize, PluginCreationCallback) override
 Implementors must override this function. More...
 
void handleMessage (const Message &) override
 This is the callback method that receives incoming messages. More...
 
void postMessage (Message *message) const
 Sends a message to the message queue, for asynchronous delivery to this listener later on. More...
 
void recursiveFileSearch (StringArray &, const File &, bool recursive)
 
bool requiresUnblockedMessageThreadDuringCreation (const PluginDescription &) const override
 Returns true if instantiation of this plugin type must be done from a non-message thread. More...
 

Private Attributes

WeakReference< MessageListener >::Master masterReference
 

Detailed Description

Implements a plugin format manager for VSTs.

@tags{Audio}

Member Typedef Documentation

◆ PluginCreationCallback

using juce::AudioPluginFormat::PluginCreationCallback = std::function<void (std::unique_ptr<AudioPluginInstance>, const String&)>
inherited

A callback lambda that is passed to createPluginInstanceAsync()

Constructor & Destructor Documentation

◆ VSTPluginFormat()

juce::VSTPluginFormat::VSTPluginFormat ( )

◆ ~VSTPluginFormat()

juce::VSTPluginFormat::~VSTPluginFormat ( )
override

Member Function Documentation

◆ aboutToScanVSTShellPlugin()

virtual void juce::VSTPluginFormat::aboutToScanVSTShellPlugin ( const PluginDescription )
virtual

Can be overridden to receive a callback when each member of a shell plugin is about to be tested during a call to findAllTypesForFile().

Only the name and uid members of the PluginDescription are guaranteed to be valid when this is called.

◆ canScanForPlugins()

bool juce::VSTPluginFormat::canScanForPlugins ( ) const
inlineoverridevirtual

Returns true if this format needs to run a scan to find its list of plugins.

Implements juce::AudioPluginFormat.

◆ createCustomVSTFromMainCall()

static AudioPluginInstance* juce::VSTPluginFormat::createCustomVSTFromMainCall ( void *  entryPointFunction,
double  initialSampleRate,
int  initialBufferSize 
)
static

Given a suitable function pointer to a VSTPluginMain function, this will attempt to instantiate and return a plugin for it.

◆ createInstanceFromDescription() [1/2]

std::unique_ptr<AudioPluginInstance> juce::AudioPluginFormat::createInstanceFromDescription ( const PluginDescription ,
double  initialSampleRate,
int  initialBufferSize 
)
inherited

Tries to recreate a type from a previously generated PluginDescription.

See also
AudioPluginFormatManager::createInstance

◆ createInstanceFromDescription() [2/2]

std::unique_ptr<AudioPluginInstance> juce::AudioPluginFormat::createInstanceFromDescription ( const PluginDescription ,
double  initialSampleRate,
int  initialBufferSize,
String errorMessage 
)
inherited

Same as above but with the possibility of returning an error message.

See also
AudioPluginFormatManager::createInstance

◆ createPluginInstance()

void juce::VSTPluginFormat::createPluginInstance ( const PluginDescription ,
double  initialSampleRate,
int  initialBufferSize,
PluginCreationCallback   
)
overrideprivatevirtual

Implementors must override this function.

This is guaranteed to be called on the message thread. You may call the callback on any thread.

Implements juce::AudioPluginFormat.

◆ createPluginInstanceAsync()

void juce::AudioPluginFormat::createPluginInstanceAsync ( const PluginDescription description,
double  initialSampleRate,
int  initialBufferSize,
PluginCreationCallback   
)
inherited

Tries to recreate a type from a previously generated PluginDescription.

When the plugin has been created, it will be passed to the caller via an asynchronous call to the PluginCreationCallback lambda that was provided.

See also
AudioPluginFormatManager::createPluginInstanceAsync

◆ dispatcher()

static pointer_sized_int juce::VSTPluginFormat::dispatcher ( AudioPluginInstance ,
int32  ,
int32  ,
pointer_sized_int  ,
void *  ,
float   
)
static

This simply calls directly to the VST's AEffect::dispatcher() function.

◆ doesPluginStillExist()

bool juce::VSTPluginFormat::doesPluginStillExist ( const PluginDescription )
overridevirtual

Checks whether this plugin could possibly be loaded.

It doesn't actually need to load it, just to check whether the file or component still exists.

Implements juce::AudioPluginFormat.

◆ fileMightContainThisPluginType()

bool juce::VSTPluginFormat::fileMightContainThisPluginType ( const String fileOrIdentifier)
overridevirtual

Should do a quick check to see if this file or directory might be a plugin of this format.

This is for searching for potential files, so it shouldn't actually try to load the plugin or do anything time-consuming.

Implements juce::AudioPluginFormat.

◆ findAllTypesForFile()

void juce::VSTPluginFormat::findAllTypesForFile ( OwnedArray< PluginDescription > &  results,
const String fileOrIdentifier 
)
overridevirtual

This tries to create descriptions for all the plugin types available in a binary module file.

The file will be some kind of DLL or bundle.

Normally there will only be one type returned, but some plugins (e.g. VST shells) can use a single DLL to create a set of different plugin subtypes, so in that case, each subtype is returned as a separate object.

Implements juce::AudioPluginFormat.

◆ getChunkData()

static bool juce::VSTPluginFormat::getChunkData ( AudioPluginInstance plugin,
MemoryBlock result,
bool  isPreset 
)
static

Attempts to get a VST's state as a chunk of memory.

◆ getDefaultLocationsToSearch()

FileSearchPath juce::VSTPluginFormat::getDefaultLocationsToSearch ( )
overridevirtual

Returns the typical places to look for this kind of plugin.

Note that if this returns no paths, it means that the format doesn't search in files or folders, e.g. AudioUnits.

Implements juce::AudioPluginFormat.

◆ getFormatName()

static String juce::VSTPluginFormat::getFormatName ( )
inlinestatic

◆ getName()

String juce::VSTPluginFormat::getName ( ) const
inlineoverridevirtual

Returns the format name.

E.g. "VST", "AudioUnit", etc.

Implements juce::AudioPluginFormat.

◆ getNameOfPluginFromIdentifier()

String juce::VSTPluginFormat::getNameOfPluginFromIdentifier ( const String fileOrIdentifier)
overridevirtual

Returns a readable version of the name of the plugin that this identifier refers to.

Implements juce::AudioPluginFormat.

◆ getPluginInstanceFromVstEffectInterface()

static AudioPluginInstance* juce::VSTPluginFormat::getPluginInstanceFromVstEffectInterface ( void *  aEffect)
static

Given a VstEffectInterface* (aka vst::AEffect*), this will return the juce AudioPluginInstance that is being used to wrap it.

◆ getVSTXML()

static const XmlElement* juce::VSTPluginFormat::getVSTXML ( AudioPluginInstance plugin)
static

Attempts to retrieve the VSTXML data from a plugin.

Will return nullptr if the plugin isn't a VST, or if it doesn't have any VSTXML.

◆ handleMessage()

void juce::AudioPluginFormat::handleMessage ( const Message message)
overrideprivatevirtualinherited

This is the callback method that receives incoming messages.

This is called by the MessageManager from its dispatch loop.

See also
postMessage

Implements juce::MessageListener.

◆ isTrivialToScan()

bool juce::VSTPluginFormat::isTrivialToScan ( ) const
inlineoverridevirtual

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.

Implements juce::AudioPluginFormat.

◆ loadFromFXBFile()

static bool juce::VSTPluginFormat::loadFromFXBFile ( AudioPluginInstance plugin,
const void *  data,
size_t  dataSize 
)
static

Attempts to reload a VST plugin's state from some FXB or FXP data.

◆ pluginNeedsRescanning()

bool juce::VSTPluginFormat::pluginNeedsRescanning ( const PluginDescription )
overridevirtual

Returns true if this plugin's version or date has changed and it should be re-checked.

Implements juce::AudioPluginFormat.

◆ postMessage()

void juce::MessageListener::postMessage ( Message message) const
inherited

Sends a message to the message queue, for asynchronous delivery to this listener later on.

This method can be called safely by any thread.

Parameters
messagethe message object to send - this will be deleted automatically by the message queue, so make sure it's allocated on the heap, not the stack!
See also
handleMessage

◆ recursiveFileSearch()

void juce::VSTPluginFormat::recursiveFileSearch ( StringArray ,
const File ,
bool  recursive 
)
private

◆ requiresUnblockedMessageThreadDuringCreation()

bool juce::VSTPluginFormat::requiresUnblockedMessageThreadDuringCreation ( const PluginDescription ) const
overrideprivatevirtual

Returns true if instantiation of this plugin type must be done from a non-message thread.

Implements juce::AudioPluginFormat.

◆ saveToFXBFile()

static bool juce::VSTPluginFormat::saveToFXBFile ( AudioPluginInstance plugin,
MemoryBlock result,
bool  asFXB 
)
static

Attempts to save a VST's state to some FXP or FXB data.

◆ searchPathsForPlugins()

StringArray juce::VSTPluginFormat::searchPathsForPlugins ( const FileSearchPath directoriesToSearch,
bool  recursive,
bool  allowPluginsWhichRequireAsynchronousInstantiation 
)
overridevirtual

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.

Parameters
directoriesToSearchThis specifies which directories shall be searched for plug-ins.
recursiveShould the search recursively traverse folders.
allowPluginsWhichRequireAsynchronousInstantiationIf this is false then plug-ins which require asynchronous creation will be excluded.

Implements juce::AudioPluginFormat.

◆ setChunkData()

static bool juce::VSTPluginFormat::setChunkData ( AudioPluginInstance plugin,
const void *  data,
int  size,
bool  isPreset 
)
static

Attempts to set a VST's state from a chunk of memory.

◆ setExtraFunctions()

static void juce::VSTPluginFormat::setExtraFunctions ( AudioPluginInstance plugin,
ExtraFunctions functions 
)
static

Provides an ExtraFunctions callback object for a plugin to use.

The plugin will take ownership of the object and will delete it automatically.

Member Data Documentation

◆ masterReference

WeakReference<MessageListener>::Master juce::MessageListener::masterReference
privateinherited

The documentation for this class was generated from the following file: