62 int64 dataChunkStart, int64 dataChunkLength,
int bytesPerFrame);
72 virtual bool mapSectionOfFile (
Range<int64> samplesToMap);
78 void touchSample (int64 sample)
const noexcept;
84 virtual void getSample (int64 sampleIndex,
float* result)
const noexcept = 0;
92 std::unique_ptr<MemoryMappedFile> map;
93 int64 dataChunkStart, dataLength;
97 inline int64
sampleToFilePos (int64 sample)
const noexcept {
return dataChunkStart + sample * bytesPerFrame; }
100 inline int64
filePosToSample (int64 filePos)
const noexcept {
return (filePos - dataChunkStart) / bytesPerFrame; }
103 inline const void*
sampleToPointer (int64 sample)
const noexcept {
return addBytesToPointer (map->getData(), sampleToFilePos (sample) - map->getRange().getStart()); }
106 template <
typename SampleType,
typename Endianness>
111 return SourceType (addBytesToPointer (sampleToPointer (startSampleInFile), ((
int) bitsPerSample / 8) * channel), (
int) numChannels)
Used as a template parameter for AudioData::Pointer.
#define JUCE_API
This macro is added to all JUCE public class declarations.
Represents a local file or directory.
Range< float > findMinAndMax(size_t numSamples) const noexcept
Scans a block of data, returning the lowest and highest levels as floats.