Loading...
Searching...
No Matches
juce::AudioProcessorGraph::AudioGraphIOProcessor Class Reference

## Detailed Description

A special type of AudioProcessor that can live inside an AudioProcessorGraph in order to use the audio that comes into and out of the graph itself.

If you create an AudioGraphIOProcessor in "input" mode, it will act as a node in the graph which delivers the audio that is coming into the parent graph. This allows you to stream the data to other nodes and process the incoming audio.

Likewise, one of these in "output" mode can be sent data which it will add to the sum of data being sent to the graph's output.

See also
  AudioProcessorGraph

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

- juce_audio_processors_headless/processors/juce_AudioProcessorGraph.h

Inheritance diagram for juce::AudioProcessorGraph::AudioGraphIOProcessor:

## Public Types

enum | IODeviceType { audioInputNode , audioOutputNode , midiInputNode , midiOutputNode }
| Specifies the mode in which this processor will operate. More...
Public Types inherited from juce::AudioPluginInstance
using | HostedParameter = HostedAudioProcessorParameter
Public Types inherited from juce::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

IODeviceType | getType () const noexcept
| Returns the mode of this processor.
AudioProcessorGraph * | getParentGraph () const noexcept
| Returns the parent graph to which this processor belongs, or nullptr if it hasn't yet been added to one.
bool | isInput () const noexcept
| True if this is an audio or midi input.
bool | isOutput () const noexcept
| True if this is an audio or midi output.
| AudioGraphIOProcessor (IODeviceType)
| ~AudioGraphIOProcessor () override
const String | getName () const override
| Returns the name of this processor.
void | fillInPluginDescription (PluginDescription &) const override
| Fills-in the appropriate parts of this plugin description object.
void | prepareToPlay (double newSampleRate, int estimatedSamplesPerBlock) override
| Called before playback starts, to let the processor prepare itself.
void | releaseResources () override
| Called after playback has stopped, to let the object free up any resources it no longer needs.
void | processBlock (AudioBuffer< float > &, MidiBuffer &) override
| Renders the next block.
void | processBlock (AudioBuffer< double > &, MidiBuffer &) override
| Renders the next block.
bool | supportsDoublePrecisionProcessing () const override
| Returns true if the Audio processor supports double precision floating point processing.
double | getTailLengthSeconds () const override
| Returns the length of the processor's tail, in seconds.
bool | acceptsMidi () const override
| Returns true if the processor wants MIDI messages.
bool | producesMidi () const override
| Returns true if the processor produces MIDI messages.
bool | hasEditor () const override
| Your processor subclass must override this and return true if it can create an editor component.
AudioProcessorEditor * | createEditor () override
| Creates the processor's GUI.
int | getNumPrograms () override
| Returns the number of preset programs the processor supports.
int | getCurrentProgram () override
| Returns the number of the currently active program.
void | setCurrentProgram (int) override
| Called by the host to change the current program.
const String | getProgramName (int) override
| Must return the name of a given program.
void | changeProgramName (int, const String &) override
| Called by the host to rename a program.
void | getStateInformation (juce::MemoryBlock &destData) override
| The host will call this method when it wants to save the processor's internal state.
void | setStateInformation (const void *data, int sizeInBytes) override
| This must restore the processor's state from a block of data previously created using getStateInformation().
void | setParentGraph (AudioProcessorGraph *)
Public Member Functions inherited from juce::AudioPluginInstance
| ~AudioPluginInstance () override=default
| Destructor.
PluginDescription | getPluginDescription () const
| Returns a PluginDescription for this plugin.
void | getExtensions (class ExtensionsVisitor &) const =delete
| Obsolete: Prefer to use getVSTClient(), getVST3Client(), getAudioUnitClient(), and/or getARAClient().
virtual AudioPluginExtensions::ARAClient * | getARAClient ()
| Returns ARA-specific extensions, or nullptr if extensions are unavailable.
virtual const AudioPluginExtensions::ARAClient * | getARAClient () const
| Returns ARA-specific extensions, or nullptr if extensions are unavailable.
virtual AudioPluginExtensions::AudioUnitClient * | getAudioUnitClient ()
| Returns AU-specific extensions, or nullptr if extensions are unavailable.
virtual const AudioPluginExtensions::AudioUnitClient * | getAudioUnitClient () const
| Returns AU-specific extensions, or nullptr if extensions are unavailable.
virtual AudioPluginExtensions::VSTClient * | getVSTClient ()
| Returns VST-specific extensions, or nullptr if extensions are unavailable.
virtual const AudioPluginExtensions::VSTClient * | getVSTClient () const
| Returns VST-specific extensions, or nullptr if extensions are unavailable.
virtual AudioPluginExtensions::VST3Client * | getVST3Client ()
| Returns VST3-specific extensions, or nullptr if extensions are unavailable.
virtual const AudioPluginExtensions::VST3Client * | getVST3Client () const
| Returns VST3-specific extensions, or nullptr if extensions are unavailable.
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.
HostedParameter * | getHostedParameter (int index) const
| Gets the parameter at a particular index.
Public Member Functions inherited from juce::AudioProcessor
virtual | ~AudioProcessor ()
| Destructor.
virtual StringArray | getAlternateDisplayNames () const
| Returns a list of alternative names to use for this processor.
virtual void | memoryWarningReceived ()
| Called by the host to indicate that you should reduce your memory footprint.
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.
Bus * | getBus (bool isInput, int busIndex) noexcept
| Returns the audio bus with a given index and direction.
const Bus * | getBus (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.
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.
AudioPlayHead * | getPlayHead () 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 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 CriticalSection & | getCallbackLock () 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 AudioProcessorParameter * | getBypassParameter () 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.
AudioProcessorEditor * | getActiveEditor () const noexcept
| Returns the active editor, if there is one.
AudioProcessorEditor * | createEditorAndMakeActive ()
| If there's no active editor, creates a new editor and stores it as the active editor before returning it.
AudioProcessorEditor * | createEditorIfNeeded ()
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 AudioProcessorParameterGroup & | getParameterTree () 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 void | getCurrentProgramStateInformation (MemoryBlock &destData)
| The host will call this method if it wants to save the state of just the processor's current program.
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 AAXClientExtensions & | getAAXClientExtensions ()
| Returns a reference to an object that implements AAX specific information regarding this AudioProcessor.
virtual VST2ClientExtensions * | getVST2ClientExtensions ()
| Returns a non-owning pointer to an object that implements VST2 specific information regarding this AudioProcessor.
virtual VST3ClientExtensions * | getVST3ClientExtensions ()
| Returns a non-owning pointer to an object that implements VST3 specific information regarding this AudioProcessor.
virtual AudioProcessorARAExtension * | getARAClientExtensions ()
| Returns a non-owning pointer to an object that implements ARA 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.
virtual std::optional< String > | getNameForMidiNoteNumber (int note, int midiChannel)
| Returns a custom name for a MIDI note number.

## Additional Inherited Members

Static Public Member Functions inherited from juce::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, MemoryBlock &destData)
| Helper function that just converts an xml element into a binary blob.
static std::unique_ptr< XmlElement > | getXmlFromBinary (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 juce::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 Member Functions inherited from juce::AudioPluginInstance
| 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.
Protected Member Functions inherited from juce::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.
Protected Attributes inherited from juce::AudioProcessor
std::atomic< AudioPlayHead * > | playHead { nullptr }

## Member Enums

## IODeviceType

enum juce::AudioProcessorGraph::AudioGraphIOProcessor::IODeviceType

Specifies the mode in which this processor will operate.

Enumerator
audioInputNode | In this mode, the processor has output channels representing all the audio input channels that are coming into its parent audio graph.
audioOutputNode | In this mode, the processor has input channels representing all the audio output channels that are going out of its parent audio graph.
midiInputNode | In this mode, the processor has a midi output which delivers the same midi data that is arriving at its parent graph.
midiOutputNode | In this mode, the processor has a midi input and any data sent to it will be passed out of the parent graph.

## Constructors and Destructors

## AudioGraphIOProcessor()

juce::AudioProcessorGraph::AudioGraphIOProcessor::AudioGraphIOProcessor | ( | IODeviceType |  | ) |

References AudioGraphIOProcessor().

Referenced by AudioGraphIOProcessor(), setParentGraph(), and ~AudioGraphIOProcessor().

## ~AudioGraphIOProcessor()

juce::AudioProcessorGraph::AudioGraphIOProcessor::~AudioGraphIOProcessor | ( |  | ) |

override

References AudioGraphIOProcessor().

## Member Functions

## getType()

IODeviceType juce::AudioProcessorGraph::AudioGraphIOProcessor::getType | ( |  | ) | const

inline noexcept

Returns the mode of this processor.

## getParentGraph()

AudioProcessorGraph * juce::AudioProcessorGraph::AudioGraphIOProcessor::getParentGraph | ( |  | ) | const

inline noexcept

Returns the parent graph to which this processor belongs, or nullptr if it hasn't yet been added to one.

References juce::AudioProcessorGraph::AudioProcessorGraph().

## isInput()

bool juce::AudioProcessorGraph::AudioGraphIOProcessor::isInput | ( |  | ) | const

noexcept

True if this is an audio or midi input.

## isOutput()

bool juce::AudioProcessorGraph::AudioGraphIOProcessor::isOutput | ( |  | ) | const

noexcept

True if this is an audio or midi output.

References isOutput().

Referenced by isOutput().

## getName()

const String juce::AudioProcessorGraph::AudioGraphIOProcessor::getName | ( |  | ) | const

override virtual

Returns the name of this processor.

Implements juce::AudioProcessor.

References getName().

Referenced by getName().

## fillInPluginDescription()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::fillInPluginDescription | ( | PluginDescription & |  | ) | const

override virtual

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

Implements juce::AudioPluginInstance.

References fillInPluginDescription().

Referenced by fillInPluginDescription().

## prepareToPlay()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::prepareToPlay | ( | double | sampleRate,
|  | int | maximumExpectedSamplesPerBlock )

override virtual

Called before playback starts, to let the processor prepare itself.

The sample rate is the target sample rate, and will remain constant until playback stops.

You can call getTotalNumInputChannels and getTotalNumOutputChannels or query the busLayout member variable to find out the number of channels your processBlock callback must process.

The maximumExpectedSamplesPerBlock value is a strong hint about the maximum number of samples that will be provided in each block. You may want to use this value to resize internal buffers. You should program defensively in case a buggy host exceeds this value. The actual block sizes that the host uses may be different each time the callback happens: completely variable block sizes can be expected from some hosts.

See also
  busLayout, getTotalNumInputChannels, getTotalNumOutputChannels

Implements juce::AudioProcessor.

References prepareToPlay().

Referenced by prepareToPlay().

## releaseResources()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::releaseResources | ( |  | ) |

override virtual

Called after playback has stopped, to let the object free up any resources it no longer needs.

Implements juce::AudioProcessor.

References releaseResources().

Referenced by releaseResources().

## processBlock() [1/2]

void juce::AudioProcessorGraph::AudioGraphIOProcessor::processBlock | ( | AudioBuffer< float > & | buffer,
|  | MidiBuffer & | midiMessages )

override virtual

Renders the next block.

When this method is called, the buffer contains a number of channels which is at least as great as the maximum number of input and output channels that this processor is using. It will be filled with the processor's input data and should be replaced with the processor's output.

So for example if your processor has a total of 2 input channels and 4 output channels, then the buffer will contain 4 channels, the first two being filled with the input data. Your processor should read these, do its processing, and replace the contents of all 4 channels with its output.

Or if your processor has a total of 5 inputs and 2 outputs, the buffer will have 5 channels, all filled with data, and your processor should overwrite the first 2 of these with its output. But be VERY careful not to write anything to the last 3 channels, as these might be mapped to memory that the host assumes is read-only!

If your plug-in has more than one input or output buses then the buffer passed to the processBlock methods will contain a bundle of all channels of each bus. Use getBusBuffer to obtain an audio buffer for a particular bus.

Note that if you have more outputs than inputs, then only those channels that correspond to an input channel are guaranteed to contain sensible data - e.g. in the case of 2 inputs and 4 outputs, the first two channels contain the input, but the last two channels may contain garbage, so you should be careful not to let this pass through without being overwritten or cleared.

Also note that the buffer may have more channels than are strictly necessary, but you should only read/write from the ones that your processor is supposed to be using.

The number of samples in these buffers is NOT guaranteed to be the same for every callback, and may be more or less than the estimated value given to prepareToPlay(). Your code must be able to cope with variable-sized blocks, or you're going to get clicks and crashes!

Also note that some hosts will occasionally decide to pass a buffer containing zero samples, so make sure that your algorithm can deal with that!

If the processor is receiving a MIDI input, then the midiMessages array will be filled with the MIDI messages for this block. Each message's timestamp will indicate the message's time, as a number of samples from the start of the block.

Any messages left in the MIDI buffer when this method has finished are assumed to be the processor's MIDI output. This means that your processor should be careful to clear any incoming messages from the array if it doesn't want them to be passed-on.

If you have implemented the getBypassParameter method, then you need to check the value of this parameter in this callback and bypass your processing if the parameter has a non-zero value.

Note that when calling this method as a host, the result may still be bypassed as the parameter that controls the bypass may be non-zero.

Be very careful about what you do in this callback - it's going to be called by the audio thread, so any kind of interaction with the UI is absolutely out of the question. If you change a parameter in here and need to tell your UI to update itself, the best way is probably to inherit from a ChangeBroadcaster, let the UI components register as listeners, and then call sendChangeMessage() inside the processBlock() method to send out an asynchronous message. You could also use the AsyncUpdater class in a similar way.

See also
  getBusBuffer

Implements juce::AudioProcessor.

References processBlock().

Referenced by processBlock(), and processBlock().

## processBlock() [2/2]

void juce::AudioProcessorGraph::AudioGraphIOProcessor::processBlock | ( | AudioBuffer< double > & | buffer,
|  | MidiBuffer & | midiMessages )

override virtual

Renders the next block.

When this method is called, the buffer contains a number of channels which is at least as great as the maximum number of input and output channels that this processor is using. It will be filled with the processor's input data and should be replaced with the processor's output.

So for example if your processor has a combined total of 2 input channels and 4 output channels, then the buffer will contain 4 channels, the first two being filled with the input data. Your processor should read these, do its processing, and replace the contents of all 4 channels with its output.

Or if your processor has 5 inputs and 2 outputs, the buffer will have 5 channels, all filled with data, and your processor should overwrite the first 2 of these with its output. But be VERY careful not to write anything to the last 3 channels, as these might be mapped to memory that the host assumes is read-only!

If your plug-in has more than one input or output buses then the buffer passed to the processBlock methods will contain a bundle of all channels of each bus. Use getBusBuffer to obtain a audio buffer for a particular bus.

Note that if you have more outputs than inputs, then only those channels that correspond to an input channel are guaranteed to contain sensible data - e.g. in the case of 2 inputs and 4 outputs, the first two channels contain the input, but the last two channels may contain garbage, so you should be careful not to let this pass through without being overwritten or cleared.

Also note that the buffer may have more channels than are strictly necessary, but you should only read/write from the ones that your processor is supposed to be using.

If your plugin uses buses, then you should use getBusBuffer() or getChannelIndexInProcessBlockBuffer() to find out which of the input and output channels correspond to which of the buses.

The number of samples in these buffers is NOT guaranteed to be the same for every callback, and may be more or less than the estimated value given to prepareToPlay(). Your code must be able to cope with variable-sized blocks, or you're going to get clicks and crashes!

Also note that some hosts will occasionally decide to pass a buffer containing zero samples, so make sure that your algorithm can deal with that!

If the processor is receiving a MIDI input, then the midiMessages array will be filled with the MIDI messages for this block. Each message's timestamp will indicate the message's time, as a number of samples from the start of the block.

Any messages left in the MIDI buffer when this method has finished are assumed to be the processor's MIDI output. This means that your processor should be careful to clear any incoming messages from the array if it doesn't want them to be passed-on.

If you have implemented the getBypassParameter method, then you need to check the value of this parameter in this callback and bypass your processing if the parameter has a non-zero value.

Note that when calling this method as a host, the result may still be bypassed as the parameter that controls the bypass may be non-zero.

Be very careful about what you do in this callback - it's going to be called by the audio thread, so any kind of interaction with the UI is absolutely out of the question. If you change a parameter in here and need to tell your UI to update itself, the best way is probably to inherit from a ChangeBroadcaster, let the UI components register as listeners, and then call sendChangeMessage() inside the processBlock() method to send out an asynchronous message. You could also use the AsyncUpdater class in a similar way.

See also
  getBusBuffer

Reimplemented from juce::AudioProcessor.

References processBlock().

## supportsDoublePrecisionProcessing()

bool juce::AudioProcessorGraph::AudioGraphIOProcessor::supportsDoublePrecisionProcessing | ( |  | ) | const

override virtual

Returns true if the Audio processor supports double precision floating point processing.

The default implementation will always return false. If you return true here then you must override the double precision versions of processBlock. Additionally, you must call getProcessingPrecision() in your prepareToPlay method to determine the precision with which you need to allocate your internal buffers.

See also
  getProcessingPrecision, setProcessingPrecision

Reimplemented from juce::AudioProcessor.

References supportsDoublePrecisionProcessing().

Referenced by supportsDoublePrecisionProcessing().

## getTailLengthSeconds()

double juce::AudioProcessorGraph::AudioGraphIOProcessor::getTailLengthSeconds | ( |  | ) | const

override virtual

Returns the length of the processor's tail, in seconds.

Implements juce::AudioProcessor.

References getTailLengthSeconds().

Referenced by getTailLengthSeconds().

## acceptsMidi()

bool juce::AudioProcessorGraph::AudioGraphIOProcessor::acceptsMidi | ( |  | ) | const

override virtual

Returns true if the processor wants MIDI messages.

This must return the same value every time it is called. This may be called by the audio thread, so this should be fast. Ideally, just return a constant.

Implements juce::AudioProcessor.

References acceptsMidi().

Referenced by acceptsMidi().

## producesMidi()

bool juce::AudioProcessorGraph::AudioGraphIOProcessor::producesMidi | ( |  | ) | const

override virtual

Returns true if the processor produces MIDI messages.

This must return the same value every time it is called. This may be called by the audio thread, so this should be fast. Ideally, just return a constant.

Implements juce::AudioProcessor.

References producesMidi().

Referenced by producesMidi().

## hasEditor()

bool juce::AudioProcessorGraph::AudioGraphIOProcessor::hasEditor | ( |  | ) | const

override virtual

Your processor subclass must override this and return true if it can create an editor component.

See also
  createEditor

Implements juce::AudioProcessor.

References hasEditor().

Referenced by hasEditor().

## createEditor()

AudioProcessorEditor * juce::AudioProcessorGraph::AudioGraphIOProcessor::createEditor | ( |  | ) |

override virtual

Creates the processor's GUI.

This can return nullptr if you want a GUI-less processor, in which case the host may create a generic UI that lets the user twiddle the parameters directly.

If you do want to pass back a component, the component should be created and set to the correct size before returning it. If you implement this method, you must also implement the hasEditor() method and make it return true.

Remember not to do anything like allowing your processor to keep a pointer to the component that gets created - it could be deleted later without any warning, which would make your pointer into a dangler. Use the getActiveEditor() method instead.

The correct way to handle the connection between an editor component and its processor is to use something like a ChangeBroadcaster so that the editor can register itself as a listener, and be told when a change occurs. This lets them safely unregister themselves when they are deleted.

Here are a few things to bear in mind when writing an editor:

- Initially there won't be an editor, until the user opens one, or they might not open one at all. Your processor mustn't rely on it being there.
- An editor object may be deleted and a replacement one created again at any time.
- It's safe to assume that an editor will be deleted before its processor.

See also
  hasEditor

Implements juce::AudioProcessor.

References createEditor().

Referenced by createEditor().

## getNumPrograms()

int juce::AudioProcessorGraph::AudioGraphIOProcessor::getNumPrograms | ( |  | ) |

override virtual

Returns the number of preset programs the processor supports.

The value returned must be valid as soon as this object is created, and must not change over its lifetime.

This value shouldn't be less than 1.

Implements juce::AudioProcessor.

References getNumPrograms().

Referenced by getNumPrograms().

## getCurrentProgram()

int juce::AudioProcessorGraph::AudioGraphIOProcessor::getCurrentProgram | ( |  | ) |

override virtual

Returns the number of the currently active program.

Implements juce::AudioProcessor.

References getCurrentProgram().

Referenced by getCurrentProgram().

## setCurrentProgram()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::setCurrentProgram | ( | int | index | ) |

override virtual

Called by the host to change the current program.

Implements juce::AudioProcessor.

References setCurrentProgram().

Referenced by setCurrentProgram().

## getProgramName()

const String juce::AudioProcessorGraph::AudioGraphIOProcessor::getProgramName | ( | int | index | ) |

override virtual

Must return the name of a given program.

Implements juce::AudioProcessor.

References getProgramName().

Referenced by getProgramName().

## changeProgramName()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::changeProgramName | ( | int | index,
|  | const String & | newName )

override virtual

Called by the host to rename a program.

Implements juce::AudioProcessor.

References changeProgramName().

Referenced by changeProgramName().

## getStateInformation()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::getStateInformation | ( | juce::MemoryBlock & | destData | ) |

override virtual

The host will call this method when it wants to save the processor's internal state.

This must copy any info about the processor's state into the block of memory provided, so that the host can store this and later restore it using setStateInformation().

Note that there's also a getCurrentProgramStateInformation() method, which only stores the current program, not the state of the entire processor.

See also the helper function copyXmlToBinary() for storing settings as XML.

See also
  getCurrentProgramStateInformation

Implements juce::AudioProcessor.

References getStateInformation().

Referenced by getStateInformation().

## setStateInformation()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::setStateInformation | ( | const void * | data,
|  | int | sizeInBytes )

override virtual

This must restore the processor's state from a block of data previously created using getStateInformation().

Note that there's also a setCurrentProgramStateInformation() method, which tries to restore just the current program, not the state of the entire processor.

See also the helper function getXmlFromBinary() for loading settings as XML.

In the case that this AudioProcessor is implementing a VST3 that has declared compatible plugins via JUCE_VST3_COMPATIBLE_CLASSES, the state passed to this function may have been created by one of these compatible plugins.

If the parameter IDs of the current plugin differ from the IDs of the plugin whose state was passed to this function, you can use information from the plugin state to determine which parameter mapping to use if necessary. VST3ClientExtensions::getCompatibleParameterIds() will always be called after setStateInformation(), and that function should return the parameter mapping from the most recently-loaded state.

See also
  setCurrentProgramStateInformation, VST3ClientExtensions::getCompatibleParameterIds

Implements juce::AudioProcessor.

References setStateInformation().

Referenced by setStateInformation().

## setParentGraph()

void juce::AudioProcessorGraph::AudioGraphIOProcessor::setParentGraph | ( | AudioProcessorGraph * |  | ) |

References AudioGraphIOProcessor(), juce::AudioProcessorGraph::AudioProcessorGraph(), JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, and setParentGraph().

Referenced by setParentGraph().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited