43 int startSampleOffset,
int numSamplesToUse) noexcept
44 : buffer (bufferToUse),
45 startSample (startSampleOffset),
46 numSamples (numSamplesToUse)
55 : buffer (&bufferToUse),
57 numSamples (bufferToUse.getNumSamples())
90 if (buffer !=
nullptr)
91 buffer->
clear (startSample, numSamples);
152 double sampleRate) = 0;
void clear() noexcept
Clears all the samples in all channels.
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.
AudioSource()=default
Creates an AudioSource.
virtual void prepareToPlay(int samplesPerBlockExpected, double sampleRate)=0
Tells the source to prepare for playing.
virtual ~AudioSource()=default
Destructor.
virtual void getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill)=0
Called repeatedly to fetch subsequent blocks of audio data.
#define JUCE_API
This macro is added to all JUCE public class declarations.
Used by AudioSource::getNextAudioBlock().
AudioSourceChannelInfo(AudioBuffer< float > *bufferToUse, int startSampleOffset, int numSamplesToUse) noexcept
Creates an AudioSourceChannelInfo.
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.
AudioSourceChannelInfo(AudioBuffer< float > &bufferToUse) noexcept
Creates an AudioSourceChannelInfo that uses the whole of a buffer.
AudioSourceChannelInfo()=default
Creates an uninitialised AudioSourceChannelInfo.
int startSample
The first sample in the buffer from which the callback is expected to write data.