EMIPLIB  1.2.1
Public Member Functions | Protected Member Functions | List of all members
MIPWAVInput Class Reference

A sound file input component. More...

#include <mipwavinput.h>

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

Public Member Functions

bool open (const std::string &fname, int frames, bool loop=true, bool intSamples=false)
 Opens a sound file. More...
 
bool open (const std::string &fname, MIPTime interval, bool loop=true, bool intSamples=false)
 Opens a sound file. More...
 
bool close ()
 Closes the sound file. More...
 
int getSamplingRate () const
 Returns the sampling rate of the sound file. More...
 
int getNumberOfFrames () const
 Returns the number of frames that will be read during each iteration. More...
 
int getNumberOfChannels () const
 Returns the number of channels in the sound file. More...
 
void setSourceID (uint64_t sourceID)
 Sets the source ID for outgoing messages. More...
 
- Public Member Functions inherited from MIPComponent
virtual void lock ()
 Locks the current component. More...
 
virtual void unlock ()
 Unlocks the current component. More...
 
virtual bool processFeedback (const MIPComponentChain &chain, int64_t feedbackChainID, MIPFeedback *feedback)
 Add feedback information about this component. More...
 
std::string getComponentName () const
 Returns the name of the component. More...
 
- Public Member Functions inherited from MIPErrorBase
std::string getErrorString () const
 Returns the last known error description. More...
 

Protected Member Functions

virtual void onLastInputFrame ()
 This function is called when the last frame of the input file has been read. More...
 
- Protected Member Functions inherited from MIPComponent
 MIPComponent (const std::string &componentName)
 Create a component with the specified name. More...
 
- Protected Member Functions inherited from MIPErrorBase
void setErrorString (const std::string &str) const
 Stores an error description. More...
 

Detailed Description

This component can be used to read audio from a WAV file. The component accepts MIPSYSTEMMESSAGE_ISTIME messages, so a timing component should send its messages to the component. The output messages contain raw audio in floating point or 16 bit signed native 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 MIPWAVInput::close ( )

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

int MIPWAVInput::getNumberOfChannels ( ) const
inline
int MIPWAVInput::getNumberOfFrames ( ) const
inline
int MIPWAVInput::getSamplingRate ( ) const
inline
virtual void MIPWAVInput::onLastInputFrame ( )
inlineprotectedvirtual

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 MIPWAVInput::open ( const std::string &  fname,
int  frames,
bool  loop = true,
bool  intSamples = false 
)

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.
intSamplesIf true, 16 bit integer samples will be used. If false, floating point samples will be used.
bool MIPWAVInput::open ( const std::string &  fname,
MIPTime  interval,
bool  loop = true,
bool  intSamples = false 
)

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.
intSamplesIf true, 16 bit integer samples will be used. If false, floating point samples will be used.
void MIPWAVInput::setSourceID ( uint64_t  sourceID)
inline

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