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

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

#include <juce_AudioProcessorPlayer.h>

Inheritance diagram for juce::AudioProcessorPlayer:
Collaboration diagram for juce::AudioProcessorPlayer:

Classes

struct  NumChannels
 

Public Member Functions

 AudioProcessorPlayer (bool doDoublePrecisionProcessing=false)
 
 ~AudioProcessorPlayer () override
 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 setMidiOutput (MidiOutput *midiOutputToUse)
 Sets the MIDI output that should be used, if required. More...
 
void setProcessor (AudioProcessor *processorToPlay)
 Sets the processor that should be played. More...
 

Private Member Functions

NumChannels findMostSuitableLayout (const AudioProcessor &) const
 
void resizeChannels ()
 

Private Attributes

NumChannels actualProcessorChannels
 
int blockSize = 0
 
std::vector< float * > channels
 
AudioBuffer< double > conversionBuffer
 
NumChannels defaultProcessorChannels
 
NumChannels deviceChannels
 
MidiBuffer incomingMidi
 
bool isDoublePrecision = false
 
bool isPrepared = false
 
CriticalSection lock
 
MidiMessageCollector messageCollector
 
MidiOutputmidiOutput = nullptr
 
AudioProcessorprocessor = nullptr
 
double sampleRate = 0
 
AudioBuffer< floattempBuffer
 

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. To set a MidiOutput for the processor, use the setMidiOutput() method.

See also
AudioProcessor, AudioProcessorGraph

@tags{Audio}

Constructor & Destructor Documentation

◆ AudioProcessorPlayer()

juce::AudioProcessorPlayer::AudioProcessorPlayer ( bool  doDoublePrecisionProcessing = false)

◆ ~AudioProcessorPlayer()

juce::AudioProcessorPlayer::~AudioProcessorPlayer ( )
override

Destructor.

Member Function Documentation

◆ audioDeviceAboutToStart()

void juce::AudioProcessorPlayer::audioDeviceAboutToStart ( AudioIODevice )
overridevirtual

◆ audioDeviceError()

virtual void juce::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 juce::SoundPlayer.

◆ audioDeviceIOCallback()

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

◆ audioDeviceStopped()

void juce::AudioProcessorPlayer::audioDeviceStopped ( )
overridevirtual

◆ findMostSuitableLayout()

NumChannels juce::AudioProcessorPlayer::findMostSuitableLayout ( const AudioProcessor ) const
private

◆ getCurrentProcessor()

AudioProcessor* juce::AudioProcessorPlayer::getCurrentProcessor ( ) const
inlinenoexcept

Returns the current audio processor that is being played.

◆ getDoublePrecisionProcessing()

bool juce::AudioProcessorPlayer::getDoublePrecisionProcessing ( )
inline

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

◆ getMidiMessageCollector()

MidiMessageCollector& juce::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 juce::StandalonePluginHolder::startPlaying().

◆ handleIncomingMidiMessage()

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

◆ handlePartialSysexMessage()

virtual void juce::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(), and juce::gl::source.

◆ resizeChannels()

void juce::AudioProcessorPlayer::resizeChannels ( )
private

◆ setDoublePrecisionProcessing()

void juce::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.

◆ setMidiOutput()

void juce::AudioProcessorPlayer::setMidiOutput ( MidiOutput midiOutputToUse)

Sets the MIDI output that should be used, if required.

The MIDI output will not be deleted or owned by this object. If the MIDI output is deleted, pass a nullptr to this method.

Referenced by juce::StandalonePluginHolder::audioDeviceAboutToStart(), and juce::StandalonePluginHolder::audioDeviceStopped().

◆ setProcessor()

void juce::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 juce::StandalonePluginHolder::startPlaying(), and juce::StandalonePluginHolder::stopPlaying().

Member Data Documentation

◆ actualProcessorChannels

NumChannels juce::AudioProcessorPlayer::actualProcessorChannels
private

◆ blockSize

int juce::AudioProcessorPlayer::blockSize = 0
private

◆ channels

std::vector<float*> juce::AudioProcessorPlayer::channels
private

◆ conversionBuffer

AudioBuffer<double> juce::AudioProcessorPlayer::conversionBuffer
private

◆ defaultProcessorChannels

NumChannels juce::AudioProcessorPlayer::defaultProcessorChannels
private

◆ deviceChannels

NumChannels juce::AudioProcessorPlayer::deviceChannels
private

◆ incomingMidi

MidiBuffer juce::AudioProcessorPlayer::incomingMidi
private

◆ isDoublePrecision

bool juce::AudioProcessorPlayer::isDoublePrecision = false
private

◆ isPrepared

bool juce::AudioProcessorPlayer::isPrepared = false
private

◆ lock

CriticalSection juce::AudioProcessorPlayer::lock
private

◆ messageCollector

MidiMessageCollector juce::AudioProcessorPlayer::messageCollector
private

◆ midiOutput

MidiOutput* juce::AudioProcessorPlayer::midiOutput = nullptr
private

◆ processor

AudioProcessor* juce::AudioProcessorPlayer::processor = nullptr
private

◆ sampleRate

double juce::AudioProcessorPlayer::sampleRate = 0
private

◆ tempBuffer

AudioBuffer<float> juce::AudioProcessorPlayer::tempBuffer
private

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