EMIPLIB
Public Member Functions | Protected Member Functions

MIPAudioFileInput Class Reference

A sound file input component. More...

#include <mipaudiofileinput.h>

Inheritance diagram for MIPAudioFileInput:
Inheritance graph
[legend]
Collaboration diagram for MIPAudioFileInput:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool open (const std::string &fname, int frames, bool loop=true)
 Opens a sound file.
bool open (const std::string &fname, MIPTime interval, bool loop=true)
 Opens a sound file.
bool close ()
 Closes the sound file.
int getSamplingRate () const
 Returns the sampling rate of the sound file.
int getNumberOfFrames () const
 Returns the number of frames that will be read during each iteration.
int getNumberOfChannels () const
 Returns the number of channels in the sound file.
MIPRaw16bitAudioMessage::SampleEncoding getSampleEncoding () const
 Returns the sample encoding used in generated raw audio messages.
void setSourceID (uint64_t sourceID)
 Selects which source ID will be set in outgoing audio messages.

Protected Member Functions

virtual void onLastInputFrame ()
 This function is called when the last frame of the input file has been read.

Detailed Description

This component can be used to read audio from a file. The component uses the libaudiofile library to accomplish this. This component accepts MIPSYSTEMMESSAGE_TYPE_ISTIME messages, so a timing component should sent its messages to the component. The output messages contain raw audio in 16 bit integer encoding.

Note:
A frame consists of a number of samples (equal to the number of channels) sampled at the same instant. For example, in a stereo sound file, one frame would consist of two samples: one for the left channel and one for the right.

Member Function Documentation

bool MIPAudioFileInput::close ( )

Use this function to stop using a previously opened sound file.

int MIPAudioFileInput::getNumberOfChannels ( ) const [inline]
int MIPAudioFileInput::getNumberOfFrames ( ) const [inline]
MIPRaw16bitAudioMessage::SampleEncoding MIPAudioFileInput::getSampleEncoding ( ) const [inline]
int MIPAudioFileInput::getSamplingRate ( ) const [inline]
virtual void MIPAudioFileInput::onLastInputFrame ( ) [inline, protected, virtual]

This function is called when the last frame of the input file has been read. In this function you could send a signal to another thread, indicating that the chain can be stopped for example.

bool MIPAudioFileInput::open ( const std::string &  fname,
MIPTime  interval,
bool  loop = true 
)

With this function, a sound file can be opened for reading.

Parameters:
fnameThe name of the sound file
intervalDuring each iteration, a number of frames corresponding to the time interval described by this parameter are read.
loopFlag indicating if the sound file should be played over and over again or just once.
bool MIPAudioFileInput::open ( const std::string &  fname,
int  frames,
bool  loop = true 
)

With this function, a sound file can be opened for reading.

Parameters:
fnameThe name of the sound file
framesThe number of frames which should be read during each iteration.
loopFlag indicating if the sound file should be played over and over again or just once.
void MIPAudioFileInput::setSourceID ( uint64_t  sourceID) [inline]

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