Cafu Engine
StreamingBufferT Class Reference

A StreamingBufferT is a BufferT specialization for audio data from a device or file whose contents is not kept in memory all at once. More...

#include "StreamingBuffer.hpp"

Inheritance diagram for StreamingBufferT:

Public Member Functions

 StreamingBufferT (const std::string &ResName, bool ForceMono)
 The constructor. More...
 
 ~StreamingBufferT ()
 The destructor. More...
 
unsigned int GetChannels () const
 Returns the number of audio channels in this buffer (1 is mono, 2 is stereo). More...
 
bool CanShare () const
 Returns whether this buffer can be attached to multiple mixer tracks (resource sharing). More...
 
void Update ()
 Updates the buffer. More...
 
bool AttachToMixerTrack (MixerTrackT *MixerTrack)
 Attaches the buffer to a mixer track, so the mixer track can play this buffer. More...
 
bool DetachFromMixerTrack (MixerTrackT *MixerTrack)
 Detaches the buffer from a mixer track. More...
 
- Public Member Functions inherited from BufferT
 BufferT (const std::string &ResName, bool ForceMono)
 The constructor. More...
 
virtual ~BufferT ()
 The virtual destructor, so that derived classes can safely be deleted via a BufferT (base class) pointer. More...
 
const std::string & GetName () const
 Returns the name of the resource (file or capture device) that this buffer was created from. More...
 
bool ForcesMono () const
 Returns whether the data from the resource is reduced to a single channel before use (mono output). More...
 

Additional Inherited Members

- Public Attributes inherited from BufferT
unsigned int References
 Number of references to this buffer (e.g. how many sound objects use this buffer). More...
 
- Protected Member Functions inherited from BufferT
unsigned int ConvertToMono (unsigned char *Buffer, unsigned int Size)
 Converts signed 16 bit raw PCM data from stereo to mono. More...
 
- Protected Attributes inherited from BufferT
ArrayT< MixerTrackT * > m_MixerTracks
 Mixer tracks this buffer is currently attached to. More...
 

Detailed Description

A StreamingBufferT is a BufferT specialization for audio data from a device or file whose contents is not kept in memory all at once.

Instead, the audio data is streamed from the resource and piecewise queued on the OpenAL source. StreamingBufferT instances cannot be shared, each instance can only be used on a single mixer track.

Constructor & Destructor Documentation

StreamingBufferT::StreamingBufferT ( const std::string &  ResName,
bool  ForceMono 
)

The constructor.

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

Parameters
ResNameThe name of the audio resource that this buffer is created from. ResName can be a file name or the name of an OpenAL capture device (as obtained from the ALC_CAPTURE_DEVICE_SPECIFIER list).
ForceMonoWhether the data from the resource should be reduced to a single channel before use (mono output).
StreamingBufferT::~StreamingBufferT ( )

The destructor.

Member Function Documentation

bool StreamingBufferT::AttachToMixerTrack ( MixerTrackT MixerTrack)
virtual

Attaches the buffer to a mixer track, so the mixer track can play this buffer.

Note that depending on the underlying buffer it is possible to attach one buffer to multiple mixer tracks. As for streaming buffers this is not possible since they are unique and can only be attached to one mixer track.

Parameters
MixerTrackThe mixer track this buffer should be attached to.
Returns
Whether the buffer could be attached to the mixer track.

Implements BufferT.

bool StreamingBufferT::CanShare ( ) const
virtual

Returns whether this buffer can be attached to multiple mixer tracks (resource sharing).

Implements BufferT.

bool StreamingBufferT::DetachFromMixerTrack ( MixerTrackT MixerTrack)
virtual

Detaches the buffer from a mixer track.

This method informs the mixer track as well as the buffer of the change.

Parameters
MixerTrackThe mixer track this buffer should be attached from.
Returns
Whether the buffer could be attached to the mixer track. False means usually that this buffer wasn't attached to the passed mixer track at all.

Implements BufferT.

unsigned int StreamingBufferT::GetChannels ( ) const
virtual

Returns the number of audio channels in this buffer (1 is mono, 2 is stereo).

Implements BufferT.

void StreamingBufferT::Update ( )
virtual

Updates the buffer.

Implements BufferT.


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