Public Types | Public Member Functions | Public Attributes | Static Public Attributes

MoAudioFileIn Class Reference

Wavefile audio input. More...

#include <mo_io.h>

List of all members.

Public Types

typedef unsigned long STK_FORMAT

Public Member Functions

 MoAudioFileIn ()
 constructor
virtual ~MoAudioFileIn ()
 destructor
virtual bool openFile (const char *fileName, const char *extension, bool raw=FALSE, bool doNormalize=TRUE, bool generate=true)
 open the specified file and load its data
void closeFile ()
 if a file is open, close it
void reset ()
 clear outputs and reset time (file pointer) to zero
void normalize ()
 normalize data to a maximum of +-1.0
void normalize (SAMPLE peak)
 normalize data to a maximum of +-peak
unsigned long getSize () const
 return the file size in sample frames
unsigned int getChannels () const
 return the number of audio channels in the file
SAMPLE getFileRate () const
 return the input file sample rate in Hz (not the data read rate)
bool isFinished () const
 query whether reading is complete
void setRate (SAMPLE aRate)
 set the data read rate in samples. The rate can be negative
virtual void addTime (SAMPLE aTime)
 increment the read pointer by aTime samples.
void setInterpolate (bool doInterpolate)
 turn linear interpolation on/off
virtual SAMPLE lastOut () const
 return the average across the last output sample frame
virtual SAMPLE tick ()
 read out the average across one sample frame of data.
virtual SAMPLE * tick (SAMPLE *vector, unsigned int vectorSize)
 read out vectorSize averaged sample frames of data in vector
virtual const SAMPLE * lastFrame () const
 return a pointer to the last output sample frame
virtual const SAMPLE * tickFrame ()
 eturn a pointer to the next sample frame of data.
virtual SAMPLE * tickFrame (SAMPLE *frameVector, unsigned int frames)
 read out sample frames of data to frameVector
void init ()
virtual bool readData (unsigned long index)
bool getRawInfo (const char *fileName)
bool getWavInfo (const char *fileName)
bool getSndInfo (const char *fileName)
bool getAifInfo (const char *fileName)
bool getMatInfo (const char *fileName)

Public Attributes

const char * m_filename
FILE * fd
SAMPLE * data
SAMPLE * lastOutput
bool chunking
bool finished
bool interpolate
bool byteswap
unsigned long fileSize
unsigned long bufferSize
unsigned long dataOffset
unsigned int channels
long chunkPointer
STK_FORMAT dataType
SAMPLE fileRate
SAMPLE gain
SAMPLE time
SAMPLE rate
bool m_loaded
SAMPLE m_gain

Static Public Attributes

static const STK_FORMAT STK_SINT8 = 1
static const STK_FORMAT STK_SINT16 = 2
static const STK_FORMAT STK_SINT32 = 8
static const STK_FORMAT MY_FLOAT32 = 16
static const STK_FORMAT MY_FLOAT64 = 32

Detailed Description

Wavefile audio input.

This class provides common functionality for a variety of audio data input subclasses.

Taken from STK by Perry R. Cook and Gary P. Scavone, 1995 - 2009.


Member Typedef Documentation

typedef unsigned long MoAudioFileIn::STK_FORMAT

Constructor & Destructor Documentation

MoAudioFileIn::MoAudioFileIn (  ) 

constructor

MoAudioFileIn::~MoAudioFileIn (  )  [virtual]

destructor


Member Function Documentation

void MoAudioFileIn::addTime ( SAMPLE  aTime  )  [virtual]

increment the read pointer by aTime samples.

void MoAudioFileIn::closeFile (  ) 

if a file is open, close it

bool MoAudioFileIn::getAifInfo ( const char *  fileName  ) 
unsigned int MoAudioFileIn::getChannels (  )  const

return the number of audio channels in the file

SAMPLE MoAudioFileIn::getFileRate (  )  const

return the input file sample rate in Hz (not the data read rate)

bool MoAudioFileIn::getMatInfo ( const char *  fileName  ) 
bool MoAudioFileIn::getRawInfo ( const char *  fileName  ) 
unsigned long MoAudioFileIn::getSize (  )  const

return the file size in sample frames

bool MoAudioFileIn::getSndInfo ( const char *  fileName  ) 
bool MoAudioFileIn::getWavInfo ( const char *  fileName  ) 
void MoAudioFileIn::init (  ) 
bool MoAudioFileIn::isFinished (  )  const

query whether reading is complete

const SAMPLE * MoAudioFileIn::lastFrame (  )  const [virtual]

return a pointer to the last output sample frame

SAMPLE MoAudioFileIn::lastOut ( void   )  const [virtual]

return the average across the last output sample frame

void MoAudioFileIn::normalize ( SAMPLE  peak  ) 

normalize data to a maximum of +-peak

void MoAudioFileIn::normalize (  ) 

normalize data to a maximum of +-1.0

bool MoAudioFileIn::openFile ( const char *  fileName,
const char *  extension,
bool  raw = FALSE,
bool  doNormalize = TRUE,
bool  generate = true 
) [virtual]

open the specified file and load its data

bool MoAudioFileIn::readData ( unsigned long  index  )  [virtual]
void MoAudioFileIn::reset (  ) 

clear outputs and reset time (file pointer) to zero

void MoAudioFileIn::setInterpolate ( bool  doInterpolate  ) 

turn linear interpolation on/off

interpolation is automatically off when the read rate is an integer value. If interpolation is turned off for a fractional rate, the time index is truncated to an integer value.

void MoAudioFileIn::setRate ( SAMPLE  aRate  ) 

set the data read rate in samples. The rate can be negative

SAMPLE * MoAudioFileIn::tick ( SAMPLE *  vector,
unsigned int  vectorSize 
) [virtual]

read out vectorSize averaged sample frames of data in vector

SAMPLE MoAudioFileIn::tick (  )  [virtual]

read out the average across one sample frame of data.

SAMPLE * MoAudioFileIn::tickFrame ( SAMPLE *  frameVector,
unsigned int  frames 
) [virtual]

read out sample frames of data to frameVector

const SAMPLE * MoAudioFileIn::tickFrame (  )  [virtual]

eturn a pointer to the next sample frame of data.


Member Data Documentation

unsigned long MoAudioFileIn::fileSize

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines