Cafu Engine
MP3StreamT Class Reference

Represents an MP3 stream. More...

#include "MP3Stream.hpp"

Inheritance diagram for MP3StreamT:

Public Member Functions

 MP3StreamT (const std::string &FileName)
 The constructor. More...
 
 ~MP3StreamT ()
 Destructor. More...
 
int Read (unsigned char *Buffer, unsigned int Size)
 Reads an amount of bytes from the stream and writes them into the buffer. More...
 
bool Rewind ()
 Sets the stream back to the beginning. More...
 
unsigned int GetChannels ()
 Returns the number of channels in the current stream. More...
 
unsigned int GetRate ()
 Get the sampling rate of this stream. More...
 
- Public Member Functions inherited from SoundStreamT
virtual ~SoundStreamT ()
 Virtual destructor to make sure the destructor of the derived class is called. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from SoundStreamT
static SoundStreamTCreate (const std::string &ResName)
 Creates a new sound stream for the specified resource. More...
 

Detailed Description

Represents an MP3 stream.

Audio data is decompressed and readable as 16 bit enconded mono or stereo raw PCM data. This class uses the mpg123 library to read PCM data from an MP3 file.

Constructor & Destructor Documentation

MP3StreamT::MP3StreamT ( const std::string &  FileName)

The constructor.

Throws an exception of type std::runtime_error on failure. Creates an audio data stream from an MP3 file.

Parameters
FileNameThe path to the file from which the stream should be created.
MP3StreamT::~MP3StreamT ( )

Destructor.

Member Function Documentation

unsigned int MP3StreamT::GetChannels ( )
virtual

Returns the number of channels in the current stream.

Returns
Number of channels in the stream.

Implements SoundStreamT.

unsigned int MP3StreamT::GetRate ( )
virtual

Get the sampling rate of this stream.

Returns
The sampling rate in Hz.

Implements SoundStreamT.

int MP3StreamT::Read ( unsigned char *  Buffer,
unsigned int  Size 
)
virtual

Reads an amount of bytes from the stream and writes them into the buffer.

Parameters
BufferBuffer to write the data into.
SizeAmount of bytes to be read from the stream and write in the buffer.
Returns
Number of bytes wrote into the buffer. -1 if an error occured during reading.

Implements SoundStreamT.

bool MP3StreamT::Rewind ( )
virtual

Sets the stream back to the beginning.

Implements SoundStreamT.


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