JUCE  v5.1.1-3-g1a0b28c73
JUCE API
AudioProcessorPlayer Class Reference

An AudioIODeviceCallback object which streams audio through an AudioProcessor. More...

#include <juce_AudioProcessorPlayer.h>

Inheritance diagram for AudioProcessorPlayer:
Collaboration diagram for AudioProcessorPlayer:

Public Member Functions

 AudioProcessorPlayer (bool doDoublePrecisionProcessing=false)
 
virtual ~AudioProcessorPlayer ()
 Destructor. More...
 
void audioDeviceAboutToStart (AudioIODevice *) override
 
virtual void audioDeviceError (const String &errorMessage)
 This can be overridden to be told if the device generates an error while operating. More...
 
void audioDeviceIOCallback (const float **, int, float **, int, int) override
 
void audioDeviceStopped () override
 
AudioProcessorgetCurrentProcessor () const noexcept
 Returns the current audio processor that is being played. More...
 
bool getDoublePrecisionProcessing ()
 Returns true if this player processes internally processes the samples with double floating point precision. More...
 
MidiMessageCollectorgetMidiMessageCollector () noexcept
 Returns a midi message collector that you can pass midi messages to if you want them to be injected into the midi stream that is being sent to the processor. More...
 
void handleIncomingMidiMessage (MidiInput *, const MidiMessage &) override
 
virtual void handlePartialSysexMessage (MidiInput *source, const uint8 *messageData, int numBytesSoFar, double timestamp)
 Notification sent each time a packet of a multi-packet sysex message arrives. More...
 
void setDoublePrecisionProcessing (bool doublePrecision)
 Switch between double and single floating point precisions processing. More...
 
void setProcessor (AudioProcessor *processorToPlay)
 Sets the processor that should be played. More...
 

Private Attributes

int blockSize = 0
 
HeapBlock< float * > channels
 
AudioBuffer< double > conversionBuffer
 
MidiBuffer incomingMidi
 
bool isDoublePrecision = false
 
bool isPrepared = false
 
CriticalSection lock
 
MidiMessageCollector messageCollector
 
int numInputChans = 0
 
int numOutputChans = 0
 
AudioProcessorprocessor = nullptr
 
double sampleRate = 0
 
AudioBuffer< float > tempBuffer
 

Detailed Description

An AudioIODeviceCallback object which streams audio through an AudioProcessor.

To use one of these, just make it the callback used by your AudioIODevice, and give it a processor to use by calling setProcessor().

It's also a MidiInputCallback, so you can connect it to both an audio and midi input to send both streams through the processor.

See also
AudioProcessor, AudioProcessorGraph

Constructor & Destructor Documentation

◆ AudioProcessorPlayer()

AudioProcessorPlayer::AudioProcessorPlayer ( bool  doDoublePrecisionProcessing = false)

◆ ~AudioProcessorPlayer()

virtual AudioProcessorPlayer::~AudioProcessorPlayer ( )
virtual

Destructor.

Member Function Documentation

◆ audioDeviceAboutToStart()

void AudioProcessorPlayer::audioDeviceAboutToStart ( AudioIODevice )
overridevirtual

◆ audioDeviceError()

virtual void AudioIODeviceCallback::audioDeviceError ( const String errorMessage)
virtualinherited

This can be overridden to be told if the device generates an error while operating.

Be aware that this could be called by any thread! And not all devices perform this callback.

Reimplemented in SoundPlayer.

◆ audioDeviceIOCallback()

void AudioProcessorPlayer::audioDeviceIOCallback ( const float **  ,
int  ,
float **  ,
int  ,
int   
)
overridevirtual

◆ audioDeviceStopped()

void AudioProcessorPlayer::audioDeviceStopped ( )
overridevirtual

◆ getCurrentProcessor()

AudioProcessor* AudioProcessorPlayer::getCurrentProcessor ( ) const
inlinenoexcept

Returns the current audio processor that is being played.

◆ getDoublePrecisionProcessing()

bool AudioProcessorPlayer::getDoublePrecisionProcessing ( )
inline

Returns true if this player processes internally processes the samples with double floating point precision.

References AudioIODeviceCallback::audioDeviceAboutToStart(), AudioIODeviceCallback::audioDeviceIOCallback(), AudioIODeviceCallback::audioDeviceStopped(), and MidiInputCallback::handleIncomingMidiMessage().

◆ getMidiMessageCollector()

MidiMessageCollector& AudioProcessorPlayer::getMidiMessageCollector ( )
inlinenoexcept

Returns a midi message collector that you can pass midi messages to if you want them to be injected into the midi stream that is being sent to the processor.

Referenced by StandalonePluginHolder::startPlaying().

◆ handleIncomingMidiMessage()

void AudioProcessorPlayer::handleIncomingMidiMessage ( MidiInput ,
const MidiMessage  
)
overridevirtual

Implements MidiInputCallback.

◆ handlePartialSysexMessage()

virtual void MidiInputCallback::handlePartialSysexMessage ( MidiInput source,
const uint8 messageData,
int  numBytesSoFar,
double  timestamp 
)
inlinevirtualinherited

Notification sent each time a packet of a multi-packet sysex message arrives.

If a long sysex message is broken up into multiple packets, this callback is made for each packet that arrives until the message is finished, at which point the normal handleIncomingMidiMessage() callback will be made with the entire message.

The message passed in will contain the start of a sysex, but won't be finished with the terminating 0xf7 byte.

References juce::ignoreUnused().

◆ setDoublePrecisionProcessing()

void AudioProcessorPlayer::setDoublePrecisionProcessing ( bool  doublePrecision)

Switch between double and single floating point precisions processing.

The audio IO callbacks will still operate in single floating point precision, however, all internal processing including the AudioProcessor will be processed in double floating point precision if the AudioProcessor supports it (see AudioProcessor::supportsDoublePrecisionProcessing()). Otherwise, the processing will remain single precision irrespective of the parameter doublePrecision.

◆ setProcessor()

void AudioProcessorPlayer::setProcessor ( AudioProcessor processorToPlay)

Sets the processor that should be played.

The processor that is passed in will not be deleted or owned by this object. To stop anything playing, pass a nullptr to this method.

Referenced by StandalonePluginHolder::startPlaying(), and StandalonePluginHolder::stopPlaying().

Member Data Documentation

◆ blockSize

int AudioProcessorPlayer::blockSize = 0
private

◆ channels

HeapBlock<float*> AudioProcessorPlayer::channels
private

◆ conversionBuffer

AudioBuffer<double> AudioProcessorPlayer::conversionBuffer
private

◆ incomingMidi

MidiBuffer AudioProcessorPlayer::incomingMidi
private

◆ isDoublePrecision

bool AudioProcessorPlayer::isDoublePrecision = false
private

◆ isPrepared

bool AudioProcessorPlayer::isPrepared = false
private

◆ lock

CriticalSection AudioProcessorPlayer::lock
private

◆ messageCollector

MidiMessageCollector AudioProcessorPlayer::messageCollector
private

◆ numInputChans

int AudioProcessorPlayer::numInputChans = 0
private

◆ numOutputChans

int AudioProcessorPlayer::numOutputChans = 0
private

◆ processor

AudioProcessor* AudioProcessorPlayer::processor = nullptr
private

◆ sampleRate

double AudioProcessorPlayer::sampleRate = 0
private

◆ tempBuffer

AudioBuffer<float> AudioProcessorPlayer::tempBuffer
private

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