27 : isLooping (shouldLoop)
47 auto& dst = *bufferToFill.
buffer;
48 auto channels = jmin (dst.getNumChannels(), buffer.
getNumChannels());
49 auto max = 0, pos = 0;
53 for (i = position; (i < n || isLooping) && (pos < m); i += max)
55 max = jmin (m - pos, n - (i % n));
58 for (; ch < channels; ++ch)
59 dst.copyFrom (ch, bufferToFill.
startSample + pos, buffer, ch, i % n, max);
61 for (; ch < dst.getNumChannels(); ++ch)
62 dst.clear (ch, bufferToFill.
startSample + pos, max);
68 dst.clear (bufferToFill.
startSample + pos, m - pos);
Type ** getArrayOfWritePointers() noexcept
Returns an array of pointers to the channels in the buffer.
void makeCopyOf(const AudioBuffer< OtherType > &other, bool avoidReallocating=false)
Resizes this buffer to match the given one, and copies all of its content across.
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 setDataToReferTo(Type **dataToReferTo, int newNumChannels, int newStartSample, int newNumSamples)
Makes this buffer point to a pre-allocated set of channel data arrays.
MemoryAudioSource(AudioBuffer< float > &audioBuffer, bool copyMemory, bool shouldLoop=false)
Creates a MemoryAudioSource by providing an audio buffer.
void prepareToPlay(int samplesPerBlockExpected, double sampleRate) override
Implementation of the AudioSource method.
void getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill) override
Implementation of the AudioSource method.
void releaseResources() override
Implementation of the AudioSource method.
Used by AudioSource::getNextAudioBlock().
int numSamples
The number of samples in the buffer which the callback is expected to fill with 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.