EMIPLIB
Public Member Functions | Protected Member Functions

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]

List of all members.

Public Member Functions

bool open (const std::string &fname, int frames, bool loop=true, bool intSamples=false)
 Opens a sound file.
bool open (const std::string &fname, MIPTime interval, bool loop=true, bool intSamples=false)
 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.
void setSourceID (uint64_t sourceID)
 Sets the source ID for outgoing 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 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 ( ) [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 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.
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.
void MIPWAVInput::setSourceID ( uint64_t  sourceID) [inline]

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