Cafu Engine
CaptureStreamT Class Reference

This class represents a stream whose data is obtained from an OpenAL capture device. More...

#include "CaptureStream.hpp"

Inheritance diagram for CaptureStreamT:

Public Member Functions

 CaptureStreamT (const std::string &DeviceName, ALenum Format=AL_FORMAT_STEREO16, unsigned int SampleFrq=44100)
 The constructor. More...
 
 ~CaptureStreamT ()
 The 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

This class represents a stream whose data is obtained from an OpenAL capture device.

Constructor & Destructor Documentation

CaptureStreamT::CaptureStreamT ( const std::string &  DeviceName,
ALenum  Format = AL_FORMAT_STEREO16,
unsigned int  SampleFrq = 44100 
)

The constructor.

Throws an exception of type std::runtime_error on failure.

Parameters
DeviceNameThe name of the OpenAL device (as obtained from the ALC_CAPTURE_DEVICE_SPECIFIER list) that is used for capturing.
FormatThe data format in which the samples are captured, kept and returned). Must be AL_FORMAT_MONO16 or AL_FORMAT_STEREO16.
SampleFrqThe frequency the device is sampled with.
CaptureStreamT::~CaptureStreamT ( )

The destructor.

Member Function Documentation

unsigned int CaptureStreamT::GetChannels ( )
virtual

Returns the number of channels in the current stream.

Returns
Number of channels in the stream.

Implements SoundStreamT.

unsigned int CaptureStreamT::GetRate ( )
virtual

Get the sampling rate of this stream.

Returns
The sampling rate in Hz.

Implements SoundStreamT.

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

Sets the stream back to the beginning.

Implements SoundStreamT.


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