31 int64 startSampleToUse, int64 lengthToUse,
35 startSample (startSampleToUse),
36 deleteSourceWhenDeleted (deleteSource)
38 length = jmin (jmax ((int64) 0, source->
lengthInSamples - startSample), lengthToUse);
49 if (deleteSourceWhenDeleted)
55 int64 startSampleInFile,
int numSamples)
58 startSampleInFile, numSamples, length);
60 return source->
readSamples (destSamples, numDestChannels, startOffsetInDestBuffer,
61 startSampleInFile + startSample, numSamples);
66 startSampleInFile = jmax ((int64) 0, startSampleInFile);
67 numSamples = jmax ((int64) 0, jmin (numSamples, length - startSampleInFile));
69 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.
virtual void readMaxLevels(int64 startSample, int64 numSamples, Range< float > *results, int numChannelsToRead)
Finds the highest and lowest sample levels from a section of the audio stream.
bool readSamples(int **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.