Base class that is used to load and read from an audio source.
Public Member Functions
size_tgetSampleRate () const
Returns the user facing samplerate (output).
size_tgetNumChannels () const =0
Returns the number of channels.
size_tgetMaxFramesPerRead () const
Returns the maximum number of frames that can be read with one call to read() .
voidsetMaxFramesPerRead (size_t count)
Sets the maximum number of frames that can be read in one chunk.
size_tread (Buffer *buffer)=0
Loads either as many frames as buffer can hold, or as many as there are left.
number of frames read into buffer .
std::stringgetMetaData () const
Returns the metadata, if any, as a string.
Protected Member Functions
Source (size_t sampleRate)
size_tperformRead (Buffer *buffer, size_t bufferFrameOffset, size_t numFramesNeeded)=0
Implement to perform read of frames into buffer starting at offset bufferFrameOffset
the actual number of frames read.
Implementations should override and return true if they can provide samplerate conversion. If false (default), a Converter will be used if needed.
voidsetSampleRate (size_t sampleRate)
Allows implementations to set the output samplerate.
std::unique_ptr< dsp::Converter >mConverter