34 startSample (startSampleToUse),
35 deleteSourceWhenDeleted (deleteSource)
48 if (deleteSourceWhenDeleted)
54 int64 startSampleInFile,
int numSamples)
57 startSampleInFile, numSamples, length);
62 return source->
readSamples (destSamples, numDestChannels, startOffsetInDestBuffer,
63 startSampleInFile + startSample, numSamples);
68 startSampleInFile =
jmax ((
int64) 0, startSampleInFile);
69 numSamples =
jmax ((
int64) 0,
jmin (numSamples, length - startSampleInFile));
71 source->
readMaxLevels (startSampleInFile + startSample, numSamples, results, numChannelsToRead);
AudioSubsectionReader(AudioFormatReader *sourceReader, int64 subsectionStartSample, int64 subsectionLength, bool deleteSourceWhenDeleted)
Creates an AudioSubsectionReader for a given data source.
~AudioSubsectionReader() override
Destructor.
void readMaxLevels(int64 startSample, int64 numSamples, Range< float > *results, int numChannelsToRead) override
Finds the highest and lowest sample levels from a section of the audio stream.
bool readSamples(int *const *destSamples, int numDestChannels, int startOffsetInDestBuffer, int64 startSampleInFile, int numSamples) override
Subclasses must implement this method to perform the low-level read operation.
A general-purpose range object, that simply represents any linear range with a start and end point.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.
long long int64
A platform-independent 64-bit integer type.