Loading...
Searching...
No Matches
AudioPluginInstance Class Referenceabstract

Base class for an active instance of a plugin. More...

#include <juce_AudioPluginInstance.h>

Inheritance diagram for AudioPluginInstance:

Classes

struct  Parameter
 Structure used to describe plugin parameters. More...
 

Public Types

using HostedParameter = HostedAudioProcessorParameter
 
- Public Types inherited from AudioProcessor
enum  ProcessingPrecision { singlePrecision , doublePrecision }
 
enum class  Realtime { no , yes }
 
enum  WrapperType {
  wrapperType_Undefined = 0 , wrapperType_VST , wrapperType_VST3 , wrapperType_AudioUnit ,
  wrapperType_AudioUnitv3 , wrapperType_AAX , wrapperType_Standalone , wrapperType_Unity ,
  wrapperType_LV2
}
 Flags to indicate the type of plugin context in which a processor is being used. More...
 
using ChangeDetails = AudioProcessorListener::ChangeDetails
 

Public Member Functions

 ~AudioPluginInstance () override=default
 Destructor.
 
virtual void fillInPluginDescription (PluginDescription &) const =0
 Fills-in the appropriate parts of this plugin description object.
 
PluginDescription getPluginDescription () const
 Returns a PluginDescription for this plugin.
 
virtual void getExtensions (ExtensionsVisitor &) const
 Allows retrieval of information related to the inner workings of a particular plugin format, such as the AEffect* of a VST, or the handle of an AudioUnit.
 
void addHostedParameter (std::unique_ptr< HostedParameter >)
 Adds a parameter to this instance.
 
void addHostedParameterGroup (std::unique_ptr< AudioProcessorParameterGroup >)
 Adds multiple parameters to this instance.
 
void setHostedParameterTree (AudioProcessorParameterGroup)
 Adds multiple parameters to this instance.
 
HostedParametergetHostedParameter (int index) const
 Gets the parameter at a particular index.
 
- Public Member Functions inherited from AudioProcessor
virtual ~AudioProcessor ()
 Destructor.
 
virtual const String getName () const =0
 Returns the name of this processor.
 
virtual StringArray getAlternateDisplayNames () const
 Returns a list of alternative names to use for this processor.
 
virtual void prepareToPlay (double sampleRate, int maximumExpectedSamplesPerBlock)=0
 Called before playback starts, to let the processor prepare itself.
 
virtual void releaseResources ()=0
 Called after playback has stopped, to let the object free up any resources it no longer needs.
 
virtual void memoryWarningReceived ()
 Called by the host to indicate that you should reduce your memory footprint.
 
virtual void processBlock (AudioBuffer< float > &buffer, MidiBuffer &midiMessages)=0
 Renders the next block.
 
virtual void processBlock (AudioBuffer< double > &buffer, MidiBuffer &midiMessages)
 Renders the next block.
 
virtual void processBlockBypassed (AudioBuffer< float > &buffer, MidiBuffer &midiMessages)
 Renders the next block when the processor is being bypassed.
 
virtual void processBlockBypassed (AudioBuffer< double > &buffer, MidiBuffer &midiMessages)
 Renders the next block when the processor is being bypassed.
 
int getBusCount (bool isInput) const noexcept
 Returns the number of buses on the input or output side.
 
BusgetBus (bool isInput, int busIndex) noexcept
 Returns the audio bus with a given index and direction.
 
const BusgetBus (bool isInput, int busIndex) const noexcept
 Returns the audio bus with a given index and direction.
 
virtual bool canAddBus (bool isInput) const
 Callback to query if a bus can currently be added.
 
virtual bool canRemoveBus (bool isInput) const
 Callback to query if the last bus can currently be removed.
 
bool addBus (bool isInput)
 Dynamically request an additional bus.
 
bool removeBus (bool isInput)
 Dynamically remove the latest added bus.
 
bool setBusesLayout (const BusesLayout &)
 Set the channel layouts of this audio processor.
 
bool setBusesLayoutWithoutEnabling (const BusesLayout &)
 Set the channel layouts of this audio processor without changing the enablement state of the buses.
 
BusesLayout getBusesLayout () const
 Provides the current channel layouts of this audio processor.
 
AudioChannelSet getChannelLayoutOfBus (bool isInput, int busIndex) const noexcept
 Provides the channel layout of the bus with a given index and direction.
 
bool setChannelLayoutOfBus (bool isInput, int busIndex, const AudioChannelSet &layout)
 Set the channel layout of the bus with a given index and direction.
 
int getChannelCountOfBus (bool isInput, int busIndex) const noexcept
 Provides the number of channels of the bus with a given index and direction.
 
bool enableAllBuses ()
 Enables all buses.
 
bool disableNonMainBuses ()
 Disables all non-main buses (aux and sidechains).
 
int getChannelIndexInProcessBlockBuffer (bool isInput, int busIndex, int channelIndex) const noexcept
 Returns the position of a bus's channels within the processBlock buffer.
 
int getOffsetInBusBufferForAbsoluteChannelIndex (bool isInput, int absoluteChannelIndex, int &busIndex) const noexcept
 Returns the offset in a bus's buffer from an absolute channel index.
 
template<typename FloatType >
AudioBuffer< FloatType > getBusBuffer (AudioBuffer< FloatType > &processBlockBuffer, bool isInput, int busIndex) const
 Returns an AudioBuffer containing a set of channel pointers for a specific bus.
 
bool checkBusesLayoutSupported (const BusesLayout &) const
 Returns true if the Audio processor is likely to support a given layout.
 
virtual bool supportsDoublePrecisionProcessing () const
 Returns true if the Audio processor supports double precision floating point processing.
 
ProcessingPrecision getProcessingPrecision () const noexcept
 Returns the precision-mode of the processor.
 
bool isUsingDoublePrecision () const noexcept
 Returns true if the current precision is set to doublePrecision.
 
void setProcessingPrecision (ProcessingPrecision newPrecision) noexcept
 Changes the processing precision of the receiver.
 
AudioPlayHeadgetPlayHead () const noexcept
 Returns the current AudioPlayHead object that should be used to find out the state and position of the playhead.
 
int getTotalNumInputChannels () const noexcept
 Returns the total number of input channels.
 
int getTotalNumOutputChannels () const noexcept
 Returns the total number of output channels.
 
int getMainBusNumInputChannels () const noexcept
 Returns the number of input channels on the main bus.
 
int getMainBusNumOutputChannels () const noexcept
 Returns the number of output channels on the main bus.
 
template<size_t numLayouts>
BusesLayout getNextBestLayoutInLayoutList (const BusesLayout &layouts, const short(&channelLayoutList)[numLayouts][2])
 Returns the next best layout which is contained in a channel layout map.
 
double getSampleRate () const noexcept
 Returns the current sample rate.
 
int getBlockSize () const noexcept
 Returns the current typical block size that is being used.
 
int getLatencySamples () const noexcept
 This returns the number of samples delay that the processor imposes on the audio passing through it.
 
void setLatencySamples (int newLatency)
 Your processor subclass should call this to set the number of samples delay that it introduces.
 
virtual double getTailLengthSeconds () const =0
 Returns the length of the processor's tail, in seconds.
 
virtual bool acceptsMidi () const =0
 Returns true if the processor wants MIDI messages.
 
virtual bool producesMidi () const =0
 Returns true if the processor produces MIDI messages.
 
virtual bool supportsMPE () const
 Returns true if the processor supports MPE.
 
virtual bool isMidiEffect () const
 Returns true if this is a MIDI effect plug-in and does no audio processing.
 
const CriticalSectiongetCallbackLock () const noexcept
 This returns a critical section that will automatically be locked while the host is calling the processBlock() method.
 
void suspendProcessing (bool shouldBeSuspended)
 Enables and disables the processing callback.
 
bool isSuspended () const noexcept
 Returns true if processing is currently suspended.
 
virtual void reset ()
 A plugin can override this to be told when it should reset any playing voices.
 
virtual AudioProcessorParametergetBypassParameter () const
 Returns the parameter that controls the AudioProcessor's bypass state.
 
bool isNonRealtime () const noexcept
 Returns true if the processor is being run in an offline mode for rendering.
 
Realtime isRealtime () const noexcept
 Returns no if the processor is being run in an offline mode for rendering.
 
virtual void setNonRealtime (bool isNonRealtime) noexcept
 Called by the host to tell this processor whether it's being used in a non-realtime capacity for offline rendering or bouncing.
 
virtual AudioProcessorEditorcreateEditor ()=0
 Creates the processor's GUI.
 
virtual bool hasEditor () const =0
 Your processor subclass must override this and return true if it can create an editor component.
 
AudioProcessorEditorgetActiveEditor () const noexcept
 Returns the active editor, if there is one.
 
AudioProcessorEditorcreateEditorIfNeeded ()
 Returns the active editor, or if there isn't one, it will create one.
 
void updateHostDisplay (const ChangeDetails &details=ChangeDetails::getDefaultFlags())
 The processor can call this when something (apart from a parameter value) has changed.
 
void addParameter (AudioProcessorParameter *)
 Adds a parameter to the AudioProcessor.
 
void addParameterGroup (std::unique_ptr< AudioProcessorParameterGroup >)
 Adds a group of parameters to the AudioProcessor.
 
const AudioProcessorParameterGroupgetParameterTree () const
 Returns the group of parameters managed by this AudioProcessor.
 
void setParameterTree (AudioProcessorParameterGroup &&newTree)
 Sets the group of parameters managed by this AudioProcessor.
 
virtual void refreshParameterList ()
 A processor should implement this method so that the host can ask it to rebuild its parameter tree.
 
const Array< AudioProcessorParameter * > & getParameters () const
 Returns a flat list of the parameters in the current tree.
 
virtual int getNumPrograms ()=0
 Returns the number of preset programs the processor supports.
 
virtual int getCurrentProgram ()=0
 Returns the number of the currently active program.
 
virtual void setCurrentProgram (int index)=0
 Called by the host to change the current program.
 
virtual const String getProgramName (int index)=0
 Must return the name of a given program.
 
virtual void changeProgramName (int index, const String &newName)=0
 Called by the host to rename a program.
 
virtual void getStateInformation (juce::MemoryBlock &destData)=0
 The host will call this method when it wants to save the processor's internal state.
 
virtual void getCurrentProgramStateInformation (juce::MemoryBlock &destData)
 The host will call this method if it wants to save the state of just the processor's current program.
 
virtual void setStateInformation (const void *data, int sizeInBytes)=0
 This must restore the processor's state from a block of data previously created using getStateInformation().
 
virtual void setCurrentProgramStateInformation (const void *data, int sizeInBytes)
 The host will call this method if it wants to restore the state of just the processor's current program.
 
virtual void numChannelsChanged ()
 This method is called when the total number of input or output channels is changed.
 
virtual void numBusesChanged ()
 This method is called when the number of buses is changed.
 
virtual void processorLayoutsChanged ()
 This method is called when the layout of the audio processor changes.
 
virtual void addListener (AudioProcessorListener *newListener)
 Adds a listener that will be called when an aspect of this processor changes.
 
virtual void removeListener (AudioProcessorListener *listenerToRemove)
 Removes a previously added listener.
 
virtual void setPlayHead (AudioPlayHead *newPlayHead)
 Tells the processor to use this playhead object.
 
void setPlayConfigDetails (int numIns, int numOuts, double sampleRate, int blockSize)
 This is called by the processor to specify its details before being played.
 
void setRateAndBufferSizeDetails (double sampleRate, int blockSize) noexcept
 This is called by the processor to specify its details before being played.
 
virtual void audioWorkgroupContextChanged (const AudioWorkgroup &workgroup)
 This is called by the host when the thread workgroup context has changed.
 
virtual AAXClientExtensionsgetAAXClientExtensions ()
 Returns a reference to an object that implements AAX specific information regarding this AudioProcessor.
 
virtual VST2ClientExtensionsgetVST2ClientExtensions ()
 Returns a non-owning pointer to an object that implements VST2 specific information regarding this AudioProcessor.
 
virtual VST3ClientExtensionsgetVST3ClientExtensions ()
 Returns a non-owning pointer to an object that implements VST3 specific information regarding this AudioProcessor.
 
virtual CurveData getResponseCurve (CurveData::Type) const
 
void editorBeingDeleted (AudioProcessorEditor *) noexcept
 Not for public use - this is called before deleting an editor component.
 
virtual void updateTrackProperties (const TrackProperties &properties)
 Informs the AudioProcessor that track properties such as the track's name or colour has been changed.
 

Protected Member Functions

 AudioPluginInstance ()=default
 
 AudioPluginInstance (const BusesProperties &ioLayouts)
 
template<size_t numLayouts>
 AudioPluginInstance (const short channelLayoutList[numLayouts][2])
 
- Protected Member Functions inherited from AudioProcessor
 AudioProcessor ()
 Constructor.
 
 AudioProcessor (const BusesProperties &ioLayouts)
 Constructor for multi-bus AudioProcessors.
 
 AudioProcessor (const std::initializer_list< const short[2]> &channelLayoutList)
 Constructor for AudioProcessors which use layout maps If your AudioProcessor uses layout maps then use this constructor.
 
virtual bool isBusesLayoutSupported (const BusesLayout &) const
 Callback to query if the AudioProcessor supports a specific layout.
 
virtual bool canApplyBusesLayout (const BusesLayout &layouts) const
 Callback to check if a certain bus layout can now be applied.
 
virtual bool applyBusLayouts (const BusesLayout &layouts)
 This method will be called when a new bus layout needs to be applied.
 
virtual bool canApplyBusCountChange (bool isInput, bool isAddingBuses, BusProperties &outNewBusProperties)
 Callback to query if adding/removing buses currently possible.
 
void sendParamChangeMessageToListeners (int parameterIndex, float newValue)
 

Additional Inherited Members

- Static Public Member Functions inherited from AudioProcessor
static bool containsLayout (const BusesLayout &layouts, const std::initializer_list< const short[2]> &channelLayoutList)
 Returns true if the channel layout map contains a certain layout.
 
template<size_t numLayouts>
static bool containsLayout (const BusesLayout &layouts, const short(&channelLayoutList)[numLayouts][2])
 
static int getDefaultNumParameterSteps () noexcept
 Returns the default number of steps for a parameter.
 
static const char * getWrapperTypeDescription (AudioProcessor::WrapperType) noexcept
 Returns a textual description of a WrapperType value.
 
static void copyXmlToBinary (const XmlElement &xml, juce::MemoryBlock &destData)
 Helper function that just converts an xml element into a binary blob.
 
static std::unique_ptr< XmlElementgetXmlFromBinary (const void *data, int sizeInBytes)
 Retrieves an XML element that was stored as binary with the copyXmlToBinary() method.
 
static void JUCE_CALLTYPE setTypeOfNextNewPlugin (WrapperType)
 
- Public Attributes inherited from AudioProcessor
const WrapperType wrapperType
 When loaded by a plugin wrapper, this flag will be set to indicate the type of plugin within which the processor is running.
 
- Protected Attributes inherited from AudioProcessor
std::atomic< AudioPlayHead * > playHead { nullptr }
 

Detailed Description

Base class for an active instance of a plugin.

This derives from the AudioProcessor class, and adds some extra functionality that helps when wrapping dynamically loaded plugins.

This class is not needed when writing plugins, and you should never need to derive your own sub-classes from it. The plugin hosting classes use it internally and will return AudioPluginInstance objects which wrap external plugins.

See also
AudioProcessor, AudioPluginFormat

Member Typedef Documentation

◆ HostedParameter

Constructor & Destructor Documentation

◆ ~AudioPluginInstance()

AudioPluginInstance::~AudioPluginInstance ( )
overridedefault

Destructor.

Make sure that you delete any UI components that belong to this plugin before deleting the plugin.

◆ AudioPluginInstance() [1/3]

AudioPluginInstance::AudioPluginInstance ( )
protecteddefault

◆ AudioPluginInstance() [2/3]

AudioPluginInstance::AudioPluginInstance ( const BusesProperties & ioLayouts)
protected

◆ AudioPluginInstance() [3/3]

template<size_t numLayouts>
AudioPluginInstance::AudioPluginInstance ( const short channelLayoutList[numLayouts][2])
protected

Member Function Documentation

◆ fillInPluginDescription()

virtual void AudioPluginInstance::fillInPluginDescription ( PluginDescription & ) const
pure virtual

Fills-in the appropriate parts of this plugin description object.

Implemented in AudioProcessorGraph::AudioGraphIOProcessor.

◆ getPluginDescription()

PluginDescription AudioPluginInstance::getPluginDescription ( ) const

Returns a PluginDescription for this plugin.

This is just a convenience method to avoid calling fillInPluginDescription.

◆ getExtensions()

virtual void AudioPluginInstance::getExtensions ( ExtensionsVisitor & ) const
virtual

Allows retrieval of information related to the inner workings of a particular plugin format, such as the AEffect* of a VST, or the handle of an AudioUnit.

To use this, create a new class derived from ExtensionsVisitor, and override each of the visit member functions. If this AudioPluginInstance wraps a VST3 plugin the visitVST3() member will be called, while if the AudioPluginInstance wraps an unknown format the visitUnknown() member will be called. The argument of the visit function can be queried to extract information related to the AudioPluginInstance's implementation.

◆ addHostedParameter()

void AudioPluginInstance::addHostedParameter ( std::unique_ptr< HostedParameter > )

Adds a parameter to this instance.

See also
AudioProcessor::addParameter()

◆ addHostedParameterGroup()

void AudioPluginInstance::addHostedParameterGroup ( std::unique_ptr< AudioProcessorParameterGroup > )

Adds multiple parameters to this instance.

In debug mode, this will also check that all added parameters derive from HostedParameter.

See also
AudioProcessor::addParameterGroup()

◆ setHostedParameterTree()

void AudioPluginInstance::setHostedParameterTree ( AudioProcessorParameterGroup )

Adds multiple parameters to this instance.

In debug mode, this will also check that all added parameters derive from HostedParameter.

See also
AudioProcessor::setParameterTree()

◆ getHostedParameter()

HostedParameter * AudioPluginInstance::getHostedParameter ( int index) const

Gets the parameter at a particular index.

If you want to find lots of parameters by their IDs, you should probably build and use a map<String, HostedParameter*> by looping through all parameters.


The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram