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

An AudioSource that mixes together the output of a set of other AudioSources. More...

#include <juce_MixerAudioSource.h>

Inheritance diagram for juce::MixerAudioSource:
Collaboration diagram for juce::MixerAudioSource:

Public Member Functions

 MixerAudioSource ()
 Creates a MixerAudioSource. More...
 
 ~MixerAudioSource () override
 Destructor. More...
 
void addInputSource (AudioSource *newInput, bool deleteWhenRemoved)
 Adds an input source to the mixer. More...
 
void getNextAudioBlock (const AudioSourceChannelInfo &) override
 Implementation of the AudioSource method. More...
 
void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override
 Implementation of the AudioSource method. More...
 
void releaseResources () override
 Implementation of the AudioSource method. More...
 
void removeAllInputs ()
 Removes all the input sources. More...
 
void removeInputSource (AudioSource *input)
 Removes an input source. More...
 

Private Attributes

int bufferSizeExpected
 
double currentSampleRate
 
Array< AudioSource * > inputs
 
BigInteger inputsToDelete
 
CriticalSection lock
 
AudioBuffer< floattempBuffer
 

Detailed Description

An AudioSource that mixes together the output of a set of other AudioSources.

Input sources can be added and removed while the mixer is running as long as their prepareToPlay() and releaseResources() methods are called before and after adding them to the mixer.

@tags{Audio}

Constructor & Destructor Documentation

◆ MixerAudioSource()

juce::MixerAudioSource::MixerAudioSource ( )

Creates a MixerAudioSource.

◆ ~MixerAudioSource()

juce::MixerAudioSource::~MixerAudioSource ( )
override

Destructor.

Member Function Documentation

◆ addInputSource()

void juce::MixerAudioSource::addInputSource ( AudioSource newInput,
bool  deleteWhenRemoved 
)

Adds an input source to the mixer.

If the mixer is running you'll need to make sure that the input source is ready to play by calling its prepareToPlay() method before adding it. If the mixer is stopped, then its input sources will be automatically prepared when the mixer's prepareToPlay() method is called.

Parameters
newInputthe source to add to the mixer
deleteWhenRemovedif true, then this source will be deleted when no longer needed by the mixer.

◆ getNextAudioBlock()

void juce::MixerAudioSource::getNextAudioBlock ( const AudioSourceChannelInfo )
overridevirtual

Implementation of the AudioSource method.

Implements juce::AudioSource.

◆ prepareToPlay()

void juce::MixerAudioSource::prepareToPlay ( int  samplesPerBlockExpected,
double  sampleRate 
)
overridevirtual

Implementation of the AudioSource method.

This will call prepareToPlay() on all its input sources.

Implements juce::AudioSource.

◆ releaseResources()

void juce::MixerAudioSource::releaseResources ( )
overridevirtual

Implementation of the AudioSource method.

This will call releaseResources() on all its input sources.

Implements juce::AudioSource.

◆ removeAllInputs()

void juce::MixerAudioSource::removeAllInputs ( )

Removes all the input sources.

Any sources which were added by calling addInputSource() with the deleteWhenRemoved flag set will be deleted by this method.

◆ removeInputSource()

void juce::MixerAudioSource::removeInputSource ( AudioSource input)

Removes an input source.

If the source was added by calling addInputSource() with the deleteWhenRemoved flag set, it will be deleted by this method.

Member Data Documentation

◆ bufferSizeExpected

int juce::MixerAudioSource::bufferSizeExpected
private

◆ currentSampleRate

double juce::MixerAudioSource::currentSampleRate
private

◆ inputs

Array<AudioSource*> juce::MixerAudioSource::inputs
private

◆ inputsToDelete

BigInteger juce::MixerAudioSource::inputsToDelete
private

◆ lock

CriticalSection juce::MixerAudioSource::lock
private

◆ tempBuffer

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

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