A sound file input component.
More...
#include <mipsndfileinput.h>
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.
|
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 libsndfile
library to accomplish this. This component accepts MIPSYSTEMMESSAGE_ISTIME messages, so a timing component should sent its messages to the component. The output messages contain raw audio in floating point 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 MIPSndFileInput::close |
( |
| ) |
|
Use this function to stop using a previously opened sound file.
int MIPSndFileInput::getNumberOfChannels |
( |
| ) |
const [inline] |
int MIPSndFileInput::getNumberOfFrames |
( |
| ) |
const [inline] |
int MIPSndFileInput::getSamplingRate |
( |
| ) |
const [inline] |
virtual void MIPSndFileInput::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 MIPSndFileInput::open |
( |
const std::string & |
fname, |
|
|
MIPTime |
interval, |
|
|
bool |
loop = true |
|
) |
| |
With this function, a sound file can be opened for reading.
- Parameters:
-
fname | The name of the sound file |
interval | During each iteration, a number of frames corresponding to the time interval described by this parameter are read. |
loop | Flag indicating if the sound file should be played over and over again or just once. |
bool MIPSndFileInput::open |
( |
const std::string & |
fname, |
|
|
int |
frames, |
|
|
bool |
loop = true |
|
) |
| |
With this function, a sound file can be opened for reading.
- Parameters:
-
fname | The name of the sound file |
frames | The number of frames which should be read during each iteration. |
loop | Flag indicating if the sound file should be played over and over again or just once. |
void MIPSndFileInput::setSourceID |
( |
uint64_t |
sourceID | ) |
[inline] |
The documentation for this class was generated from the following file: