A BufferT encapsulates an audio resource such as a file or a capture device. More...
#include "Buffer.hpp"
Public Member Functions | |
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... | |
virtual unsigned int | GetChannels () const =0 |
Returns the number of audio channels in this buffer (1 is mono, 2 is stereo). More... | |
virtual bool | CanShare () const =0 |
Returns whether this buffer can be attached to multiple mixer tracks (resource sharing). More... | |
virtual void | Update ()=0 |
Updates the buffer. More... | |
virtual bool | AttachToMixerTrack (MixerTrackT *MixerTrack)=0 |
Attaches the buffer to a mixer track, so the mixer track can play this buffer. More... | |
virtual bool | DetachFromMixerTrack (MixerTrackT *MixerTrack)=0 |
Detaches the buffer from a mixer track. More... | |
Public Attributes | |
unsigned int | References |
Number of references to this buffer (e.g. how many sound objects use this buffer). More... | |
Protected Member Functions | |
unsigned int | ConvertToMono (unsigned char *Buffer, unsigned int Size) |
Converts signed 16 bit raw PCM data from stereo to mono. More... | |
Protected Attributes | |
ArrayT< MixerTrackT * > | m_MixerTracks |
Mixer tracks this buffer is currently attached to. More... | |
A BufferT encapsulates an audio resource such as a file or a capture device.
It is responsible for managing the OpenAL buffer(s) in an OpenAL source, such as creating and filling the buffer(s), assigning or queuing them to the source, etc.
BufferT::BufferT | ( | const std::string & | ResName, |
bool | ForceMono | ||
) |
The constructor.
ResName | The name of the resource (file or capture device) that this buffer is created from. |
ForceMono | Whether the data from the resource should be reduced to a single channel before use (mono output). |
|
inlinevirtual |
The virtual destructor, so that derived classes can safely be deleted via a BufferT (base class) pointer.
|
pure 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.
MixerTrack | The mixer track this buffer should be attached to. |
Implemented in StreamingBufferT, and StaticBufferT.
|
pure virtual |
Returns whether this buffer can be attached to multiple mixer tracks (resource sharing).
Implemented in StreamingBufferT, and StaticBufferT.
|
protected |
Converts signed 16 bit raw PCM data from stereo to mono.
Buffer | The PCM data to convert to mono. |
Size | Size of the data in bytes. |
|
pure virtual |
Detaches the buffer from a mixer track.
This method informs the mixer track as well as the buffer of the change.
MixerTrack | The mixer track this buffer should be attached from. |
Implemented in StreamingBufferT, and StaticBufferT.
|
inline |
Returns whether the data from the resource is reduced to a single channel before use (mono output).
|
pure virtual |
Returns the number of audio channels in this buffer (1 is mono, 2 is stereo).
Implemented in StreamingBufferT, and StaticBufferT.
|
inline |
Returns the name of the resource (file or capture device) that this buffer was created from.
|
pure virtual |
Updates the buffer.
Implemented in StreamingBufferT, and StaticBufferT.
|
protected |
Mixer tracks this buffer is currently attached to.
unsigned int BufferT::References |
Number of references to this buffer (e.g. how many sound objects use this buffer).