TracktionEngine
Public Member Functions | List of all members
tracktion::engine::BufferedFileReader Class Reference

Inherits juce::AudioFormatReader, and juce::TimeSliceClient.

Public Member Functions

 BufferedFileReader (juce::AudioFormatReader *sourceReader, juce::TimeSliceThread &timeSliceThread, int samplesToBuffer)
 Creates a reader. More...
 
 ~BufferedFileReader () override
 Destructor. More...
 
void setReadTimeout (int timeoutMilliseconds) noexcept
 Sets a number of milliseconds that the reader can block for in its readSamples() method before giving up and returning silence. More...
 
bool isFullyBuffered () const
 Returns true if this has been initialised to buffer the whole file once that is complete, false otherwise. More...
 
bool readSamples (int *const *destSamples, int numDestChannels, int startOffsetInDestBuffer, juce::int64 startSampleInFile, int numSamples) override
 

Detailed Description

An AudioFormatReader that uses a background thread to pre-read data from another reader.

N.B. This class is in development and not ready for public use yet!!

Constructor & Destructor Documentation

◆ BufferedFileReader()

tracktion::engine::BufferedFileReader::BufferedFileReader ( juce::AudioFormatReader *  sourceReader,
juce::TimeSliceThread &  timeSliceThread,
int  samplesToBuffer 
)

Creates a reader.

Parameters
sourceReaderthe source reader to wrap. This BufferingAudioReader takes ownership of this object and will delete it later when no longer needed
timeSliceThreadthe thread that should be used to do the background reading. Make sure that the thread you supply is running, and won't be deleted while the reader object still exists.
samplesToBufferthe total number of samples to buffer ahead. Pass -1 to buffer the whole source

◆ ~BufferedFileReader()

tracktion::engine::BufferedFileReader::~BufferedFileReader ( )
override

Destructor.

Member Function Documentation

◆ setReadTimeout()

void tracktion::engine::BufferedFileReader::setReadTimeout ( int  timeoutMilliseconds)
noexcept

Sets a number of milliseconds that the reader can block for in its readSamples() method before giving up and returning silence.

A value of less that 0 means "wait forever". The default timeout is 0 which means don't wait at all.

◆ isFullyBuffered()

bool tracktion::engine::BufferedFileReader::isFullyBuffered ( ) const

Returns true if this has been initialised to buffer the whole file once that is complete, false otherwise.

◆ readSamples()

bool tracktion::engine::BufferedFileReader::readSamples ( int *const *  destSamples,
int  numDestChannels,
int  startOffsetInDestBuffer,
juce::int64  startSampleInFile,
int  numSamples 
)
override

The documentation for this class was generated from the following file: