30 const bool deleteReaderWhenThisIsDeleted)
31 : reader (r, deleteReaderWhenThisIsDeleted),
46 return looping ? nextPlayPos % reader->lengthInSamples
57 const int64 start = nextPlayPos;
61 const int64 newStart = start % reader->lengthInSamples;
62 const int64 newEnd = (start + info.
numSamples) % reader->lengthInSamples;
64 if (newEnd > newStart)
67 (
int) (newEnd - newStart), newStart,
true,
true);
71 const int endSamps = (
int) (reader->lengthInSamples - newStart);
74 endSamps, newStart,
true,
true);
77 (
int) newEnd, 0,
true,
true);
86 reader->lengthInSamples - start);
88 reader->read (info.
buffer, info.
startSample, (
int) samplesToRead, start,
true,
true);
void clear() noexcept
Clears all the samples in all channels and marks the buffer as cleared.
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
Constrains a value to keep it within a given range.
long long int64
A platform-independent 64-bit integer type.
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.