41 if (
newSource !=
nullptr && bufferSize > 0 && sampleRate > 0)
42 newSource->prepareToPlay (bufferSize, sampleRate);
66 jassert (sampleRate > 0 && bufferSize > 0);
70 if (source !=
nullptr)
81 if (
numInputs >= numElementsInArray (inputChans))
91 if (
numOutputs >= numElementsInArray (outputChans))
130 zeromem (channels[
numActiveChans],
sizeof (
float) * (
size_t) numSamples);
140 for (
int i =
info.buffer->getNumChannels(); --i >= 0;)
141 buffer.applyGainRamp (i,
info.startSample,
info.numSamples, lastGain, gain);
156 device->getCurrentBufferSizeSamples());
163 zeromem (channels,
sizeof (channels));
165 if (source !=
nullptr)
171 if (source !=
nullptr)
Holds a resizable array of primitive or copy-by-value objects.
void setSize(int newNumChannels, int newNumSamples, bool keepExistingContent=false, bool clearExtraSpace=false, bool avoidReallocating=false)
Changes the buffer's size or number of channels.
Type * getWritePointer(int channelNumber) noexcept
Returns a writeable pointer to one of the buffer's channels.
Base class for an audio device with synchronised input and output channels.
void setGain(float newGain) noexcept
Sets a gain to apply to the audio data.
void setSource(AudioSource *newSource)
Changes the current audio source to play from.
AudioSourcePlayer()
Creates an empty AudioSourcePlayer.
void audioDeviceStopped() override
Implementation of the AudioIODeviceCallback method.
void audioDeviceIOCallback(const float **inputChannelData, int totalNumInputChannels, float **outputChannelData, int totalNumOutputChannels, int numSamples) override
Implementation of the AudioIODeviceCallback method.
~AudioSourcePlayer() override
Destructor.
void prepareToPlay(double sampleRate, int blockSize)
An alternative method for initialising the source without an AudioIODevice.
void audioDeviceAboutToStart(AudioIODevice *device) override
Implementation of the AudioIODeviceCallback method.
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.
virtual void getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill)=0
Called repeatedly to fetch subsequent blocks of audio data.
Used by AudioSource::getNextAudioBlock().