Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends

alize::AudioFileReader Class Reference

#include <AudioFileReader.h>

Inheritance diagram for alize::AudioFileReader:
Inheritance graph
[legend]
Collaboration diagram for alize::AudioFileReader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 AudioFileReader (const FileName &f, const Config &c, BigEndian be=BIGENDIAN_AUTO)
virtual ~AudioFileReader ()
virtual bool readFrame (AudioFrame &f)
virtual void seekFrame (unsigned long pos)
virtual void reset ()
virtual void close ()
unsigned long getFrameCount ()
virtual unsigned long getChannelCount ()
virtual unsigned long getSampleBytes ()
virtual real_t getFrameRate ()
virtual unsigned long getSourceCount ()
virtual String getClassName () const
String toString () const

Static Public Member Functions

static AudioFileReadercreate (const FileName &f, const Config &c, BigEndian be=BIGENDIAN_AUTO)

Private Member Functions

String getPath (const FileName &, const Config &) const
String getExt (const FileName &, const Config &) const
unsigned long getChannel (const Config &) const
bool getBigEndian (const Config &, BigEndian) const
void readParams ()
unsigned long getHeaderLength ()

Private Attributes

FileReader_pReader
unsigned long _frameCount
unsigned long _frameIndex
unsigned long _headerLength
unsigned long _channelCount
unsigned long _sampleBytes
real_t _frameRate
bool _paramDefined
bool _seekWanted
unsigned long _seekWantedIdx

Friends

class TestAudioFileReader

Detailed Description

Class used to read audio files.

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2005

Definition at line 83 of file AudioFileReader.h.


Constructor & Destructor Documentation

R::AudioFileReader ( const FileName f,
const Config c,
BigEndian  be = BIGENDIAN_AUTO 
) [explicit]

Build the reader

Parameters:
fthe file to read
cthe configuration to use
beBig/little endian flag

Definition at line 68 of file AudioFileReader.cpp.

R::~AudioFileReader (  ) [virtual]

Definition at line 318 of file AudioFileReader.cpp.

References NULL.


Member Function Documentation

void R::close (  ) [virtual]

Closes the file

Implements alize::AudioInputStream.

Definition at line 99 of file AudioFileReader.cpp.

References NULL.

R & R::create ( const FileName f,
const Config c,
BigEndian  be = BIGENDIAN_AUTO 
) [static]

Definition at line 78 of file AudioFileReader.cpp.

bool R::getBigEndian ( const Config c,
BigEndian  b 
) const [private]

Definition at line 112 of file AudioFileReader.cpp.

References alize::BIGENDIAN_FALSE, and alize::BIGENDIAN_TRUE.

unsigned long R::getChannel ( const Config c ) const [private]
unsigned long R::getChannelCount (  ) [virtual]

Returns the channel count of the file

Returns:
the channel count of the file

Implements alize::AudioInputStream.

Definition at line 285 of file AudioFileReader.cpp.

Referenced by toString().

String R::getClassName (  ) const [virtual]

Returns the name of the class

Returns:
the name of the class of the object as a String

Implements alize::Object.

Definition at line 306 of file AudioFileReader.cpp.

String R::getExt ( const FileName f,
const Config c 
) const [private]
unsigned long R::getFrameCount (  ) [virtual]

Returns the frame count of the file

Returns:
the frame count of the file

Implements alize::AudioInputStream.

Definition at line 210 of file AudioFileReader.cpp.

Referenced by toString().

real_t R::getFrameRate (  ) [virtual]

Returns the frame rate (in frames per second)

Returns:
the frame rate (in frames per second)

Implements alize::AudioInputStream.

Definition at line 299 of file AudioFileReader.cpp.

unsigned long R::getHeaderLength (  ) [private]

Definition at line 278 of file AudioFileReader.cpp.

String R::getPath ( const FileName f,
const Config c 
) const [private]
unsigned long R::getSampleBytes (  ) [virtual]

Returns the sample size in bytes of this file

Returns:
the sample size in bytes of this file

Implements alize::AudioInputStream.

Definition at line 292 of file AudioFileReader.cpp.

Referenced by toString().

unsigned long R::getSourceCount (  ) [virtual]

Returns the number of files read by the reader

Returns:
the number of files

Implements alize::AudioInputStream.

Definition at line 276 of file AudioFileReader.cpp.

bool R::readFrame ( AudioFrame f ) [virtual]

Reads the next available audio frame
Reads a unique channel. See method setSelectedChannel(...) to choose a channel

Parameters:
fthe audio frame object to store the data
Returns:
false if there is no more data because the end of the file has been reached
Exceptions:
IOExceptionif an I/O error occurs

Implements alize::AudioInputStream.

Definition at line 126 of file AudioFileReader.cpp.

References alize::AudioFrame::setData(), alize::AudioFrame::setValidity(), and alize::String::valueOf().

void R::readParams (  ) [private]
void R::reset (  ) [virtual]

Same effect as seekFrame(0)
Does not change selected channel

Implements alize::AudioInputStream.

Definition at line 274 of file AudioFileReader.cpp.

void R::seekFrame ( unsigned long  n ) [virtual]

Sets the position indicator associated with the stream to a new position. Does not throw any exception or error if the position exceeds file length

Parameters:
posposition of the next frame to read

Implements alize::AudioInputStream.

Definition at line 204 of file AudioFileReader.cpp.

String R::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

Definition at line 308 of file AudioFileReader.cpp.

References getChannelCount(), getFrameCount(), getSampleBytes(), alize::AudioInputStream::getSelectedChannel(), alize::Object::toString(), and alize::String::valueOf().


Friends And Related Function Documentation

friend class TestAudioFileReader [friend]

Reimplemented from alize::AudioInputStream.

Definition at line 85 of file AudioFileReader.h.


Member Data Documentation

unsigned long alize::AudioFileReader::_channelCount [private]

Definition at line 152 of file AudioFileReader.h.

unsigned long alize::AudioFileReader::_frameCount [private]

Definition at line 149 of file AudioFileReader.h.

unsigned long alize::AudioFileReader::_frameIndex [private]

Definition at line 150 of file AudioFileReader.h.

Definition at line 154 of file AudioFileReader.h.

unsigned long alize::AudioFileReader::_headerLength [private]

Definition at line 151 of file AudioFileReader.h.

Definition at line 155 of file AudioFileReader.h.

Definition at line 148 of file AudioFileReader.h.

unsigned long alize::AudioFileReader::_sampleBytes [private]

Definition at line 153 of file AudioFileReader.h.

Definition at line 156 of file AudioFileReader.h.

unsigned long alize::AudioFileReader::_seekWantedIdx [private]

Definition at line 157 of file AudioFileReader.h.


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