Cafu Engine
OggVorbisStreamT Class Reference

Represents an Ogg Vorbis stream. More...

#include "OggVorbisStream.hpp"

Inheritance diagram for OggVorbisStreamT:

Public Member Functions

 OggVorbisStreamT (const std::string &FileName)
 The constructor. More...
 
 ~OggVorbisStreamT ()
 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 Ogg Vorbis stream.

Audio data is decompressed and readable as 16 bit enconded mono or stereo raw PCM data. This class uses libogg and libvorbis provided by Xiph.org to read PCM data from an Ogg Vorbis file.

Constructor & Destructor Documentation

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

The constructor.

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

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

Destructor.

Member Function Documentation

unsigned int OggVorbisStreamT::GetChannels ( )
virtual

Returns the number of channels in the current stream.

Returns
Number of channels in the stream.

Implements SoundStreamT.

unsigned int OggVorbisStreamT::GetRate ( )
virtual

Get the sampling rate of this stream.

Returns
The sampling rate in Hz.

Implements SoundStreamT.

int OggVorbisStreamT::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 OggVorbisStreamT::Rewind ( )
virtual

Sets the stream back to the beginning.

Implements SoundStreamT.


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