27 : currentSampleRate (0.0), bufferSizeExpected (0)
39 if (input !=
nullptr && ! inputs.contains (input))
68 const int index = inputs.indexOf (input);
73 if (inputsToDelete [index])
77 inputs.remove (index);
91 for (
int i = inputs.size(); --i >= 0;)
92 if (inputsToDelete[i])
93 toDelete.add (inputs.getUnchecked (i));
98 for (
int i =
toDelete.size(); --i >= 0;)
99 toDelete.getUnchecked (i)->releaseResources();
108 currentSampleRate = sampleRate;
111 for (
int i = inputs.size(); --i >= 0;)
119 for (
int i = inputs.size(); --i >= 0;)
120 inputs.getUnchecked (i)->releaseResources();
124 currentSampleRate = 0;
125 bufferSizeExpected = 0;
132 if (inputs.size() > 0)
134 inputs.getUnchecked (0)->getNextAudioBlock (info);
136 if (inputs.size() > 1)
143 for (
int i = 1; i < inputs.size(); ++i)
145 inputs.getUnchecked (i)->getNextAudioBlock (
info2);
void setSize(int newNumChannels, int newNumSamples, bool keepExistingContent=false, bool clearExtraSpace=false, bool avoidReallocating=false)
Changes the buffer's size or number of channels.
int getNumChannels() const noexcept
Returns the number of channels of audio data that this buffer contains.
int getNumSamples() const noexcept
Returns the number of samples allocated in each of the buffer's channels.
void addFrom(int destChannel, int destStartSample, const AudioBuffer &source, int sourceChannel, int sourceStartSample, int numSamples, Type gainToApplyToSource=Type(1)) noexcept
Adds samples from another buffer to this one.
Base class for objects that can produce a continuous stream of audio.
virtual void releaseResources()=0
Allows the source to release anything it no longer needs after playback has stopped.
virtual void prepareToPlay(int samplesPerBlockExpected, double sampleRate)=0
Tells the source to prepare for playing.
BigInteger & shiftBits(int howManyBitsLeft, int startBit)
Shifts a section of bits left or right.
BigInteger & setBit(int bitNumber)
Sets a specified bit to 1.
Automatically locks and unlocks a mutex object.
void removeInputSource(AudioSource *input)
Removes an input source.
void getNextAudioBlock(const AudioSourceChannelInfo &) override
Implementation of the AudioSource method.
MixerAudioSource()
Creates a MixerAudioSource.
void removeAllInputs()
Removes all the input sources.
void addInputSource(AudioSource *newInput, bool deleteWhenRemoved)
Adds an input source to the mixer.
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Implementation of the AudioSource method.
~MixerAudioSource() override
Destructor.
void releaseResources() override
Implementation of the AudioSource method.
An array designed for holding objects.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Used by AudioSource::getNextAudioBlock().
int numSamples
The number of samples in the buffer which the callback is expected to fill with data.
void clearActiveBufferRegion() const
Convenient method to clear the buffer if the source is not producing any data.
AudioBuffer< float > * buffer
The destination buffer to fill with audio data.
int startSample
The first sample in the buffer from which the callback is expected to write data.