Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cinder::audio::cocoa::SourceFileCoreAudio Class Reference

#include <FileCoreAudio.h>

Inheritance diagram for cinder::audio::cocoa::SourceFileCoreAudio:
[legend]

Public Member Functions

 SourceFileCoreAudio ()
 
 SourceFileCoreAudio (const DataSourceRef &dataSource, size_t sampleRate)
 
virtual ~SourceFileCoreAudio ()
 
SourceFileRef cloneWithSampleRate (size_t sampleRate) const override
 Returns an copy of this Source with all properties identical except the sampleRate. This is useful if the SourceFile must match a samplerate that was unknown when it was first constructed. More...
 
size_t getNumChannels () const override
 Returns the number of channels. More...
 
size_t getSampleRateNative () const override
 Returns the true samplerate of the Source. More...
 
size_t read (Buffer *buffer) override
 Loads either as many frames as buffer can hold, or as many as there are left. More...
 
SourceFileRef clone () const
 Returns a copy of this Source, with identical properties and pointing at the same data source. More...
 
BufferRef loadBuffer ()
 Loads and returns the entire contents of this SourceFile. More...
 
void seek (size_t readPositionFrames)
 Seek the read position to readPositionFrames. More...
 
void seekToTime (double readPositionSeconds)
 Seek to read position readPositionSeconds. More...
 
size_t getReadPosition () const
 Returns the current read position in frames. More...
 
double getReadPositionSeconds () const
 Returns the current read position in seconds. More...
 
size_t getNumFrames () const
 Returns the length in frames. More...
 
double getNumSeconds () const
 Returns the length in seconds. More...
 
size_t getSampleRate () const
 Returns the user facing samplerate (output). More...
 
size_t getMaxFramesPerRead () const
 Returns the maximum number of frames that can be read with one call to read(). More...
 
virtual void setMaxFramesPerRead (size_t count)
 Sets the maximum number of frames that can be read in one chunk. More...
 
virtual std::string getMetaData () const
 Returns the metadata, if any, as a string. More...
 

Static Public Member Functions

static std::vector< std::stringgetSupportedExtensions ()
 
static std::unique_ptr
< SourceFile
create (const DataSourceRef &dataSource, size_t sampleRate=0)
 Creates a new SourceFile from dataSource, with optional output samplerate. If sampleRate equals 0 the native file's samplerate is used. More...
 

Protected Member Functions

virtual void setupSampleRateConversion ()
 Sets up samplerate conversion if needed. Can be overridden by implementation if they handle samplerate conversion in a specific way, else it is handled generically with a dsp::Converter. More...
 
void setSampleRate (size_t sampleRate)
 Allows implementations to set the output samplerate. More...
 

Protected Attributes

size_t mNumFrames
 
size_t mFileNumFrames
 
size_t mReadPos
 
std::unique_ptr< dsp::ConvertermConverter
 
BufferDynamic mConverterReadBuffer
 

Constructor & Destructor Documentation

cinder::audio::cocoa::SourceFileCoreAudio::SourceFileCoreAudio ( )
cinder::audio::cocoa::SourceFileCoreAudio::SourceFileCoreAudio ( const DataSourceRef dataSource,
size_t  sampleRate 
)
cinder::audio::cocoa::SourceFileCoreAudio::~SourceFileCoreAudio ( )
virtual

Member Function Documentation

SourceFileRef cinder::audio::cocoa::SourceFileCoreAudio::cloneWithSampleRate ( size_t  sampleRate) const
overridevirtual

Returns an copy of this Source with all properties identical except the sampleRate. This is useful if the SourceFile must match a samplerate that was unknown when it was first constructed.

Implements cinder::audio::SourceFile.

size_t cinder::audio::cocoa::SourceFileCoreAudio::getNumChannels ( ) const
overridevirtual

Returns the number of channels.

Implements cinder::audio::Source.

size_t cinder::audio::cocoa::SourceFileCoreAudio::getSampleRateNative ( ) const
overridevirtual

Returns the true samplerate of the Source.

Note
Actual output samplerate may differ.
See also
getSampleRate()

Implements cinder::audio::Source.

vector< string > cinder::audio::cocoa::SourceFileCoreAudio::getSupportedExtensions ( )
static
unique_ptr< SourceFile > cinder::audio::SourceFile::create ( const DataSourceRef dataSource,
size_t  sampleRate = 0 
)
staticinherited

Creates a new SourceFile from dataSource, with optional output samplerate. If sampleRate equals 0 the native file's samplerate is used.

size_t cinder::audio::SourceFile::read ( Buffer buffer)
overridevirtualinherited

Loads either as many frames as buffer can hold, or as many as there are left.

Returns
number of frames read into buffer.

Implements cinder::audio::Source.

SourceFileRef cinder::audio::SourceFile::clone ( ) const
inherited

Returns a copy of this Source, with identical properties and pointing at the same data source.

BufferRef cinder::audio::SourceFile::loadBuffer ( )
inherited

Loads and returns the entire contents of this SourceFile.

Returns
a BufferRef containing the file contents.
void cinder::audio::SourceFile::seek ( size_t  readPositionFrames)
inherited

Seek the read position to readPositionFrames.

void cinder::audio::SourceFile::seekToTime ( double  readPositionSeconds)
inherited

Seek to read position readPositionSeconds.

size_t cinder::audio::SourceFile::getReadPosition ( ) const
inherited

Returns the current read position in frames.

double cinder::audio::SourceFile::getReadPositionSeconds ( ) const
inherited

Returns the current read position in seconds.

size_t cinder::audio::SourceFile::getNumFrames ( ) const
inherited

Returns the length in frames.

double cinder::audio::SourceFile::getNumSeconds ( ) const
inherited

Returns the length in seconds.

void cinder::audio::SourceFile::setupSampleRateConversion ( )
protectedvirtualinherited

Sets up samplerate conversion if needed. Can be overridden by implementation if they handle samplerate conversion in a specific way, else it is handled generically with a dsp::Converter.

size_t cinder::audio::Source::getSampleRate ( ) const
inherited

Returns the user facing samplerate (output).

size_t cinder::audio::Source::getMaxFramesPerRead ( ) const
inherited

Returns the maximum number of frames that can be read with one call to read().

virtual void cinder::audio::Source::setMaxFramesPerRead ( size_t  count)
virtualinherited

Sets the maximum number of frames that can be read in one chunk.

virtual std::string cinder::audio::Source::getMetaData ( ) const
virtualinherited

Returns the metadata, if any, as a string.

Reimplemented in cinder::audio::SourceFileOggVorbis.

void cinder::audio::Source::setSampleRate ( size_t  sampleRate)
protectedinherited

Allows implementations to set the output samplerate.

Member Data Documentation

size_t cinder::audio::SourceFile::mNumFrames
protectedinherited
size_t cinder::audio::SourceFile::mFileNumFrames
protectedinherited
size_t cinder::audio::SourceFile::mReadPos
protectedinherited
std::unique_ptr<dsp::Converter> cinder::audio::Source::mConverter
protectedinherited
BufferDynamic cinder::audio::Source::mConverterReadBuffer
protectedinherited

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