Cafu Engine
StaticBufferT Class Reference

A StaticBufferT is a BufferT specialization for audio data from a file whose contents fits entirely into memory. More...

#include "StaticBuffer.hpp"

Inheritance diagram for StaticBufferT:

Public Member Functions

 StaticBufferT (const std::string &FileName, bool ForceMono)
 The constructor. More...
 
 ~StaticBufferT ()
 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 StaticBufferT is a BufferT specialization for audio data from a file whose contents fits entirely into memory.

StaticBufferT instances can be shared and thus independently be used by multiple mixer tracks at the same time.

Constructor & Destructor Documentation

StaticBufferT::StaticBufferT ( const std::string &  FileName,
bool  ForceMono 
)

The constructor.

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

Parameters
FileNameThe name of the audio file that this buffer is created from.
ForceMonoWhether the data from the resource should be reduced to a single channel before use (mono output).
StaticBufferT::~StaticBufferT ( )

The destructor.

Member Function Documentation

bool StaticBufferT::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 StaticBufferT::CanShare ( ) const
virtual

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

Implements BufferT.

bool StaticBufferT::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 StaticBufferT::GetChannels ( ) const
virtual

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

Implements BufferT.

void StaticBufferT::Update ( )
virtual

Updates the buffer.

Implements BufferT.


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