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"
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... | |
![]() | |
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 | |
![]() | |
unsigned int | References |
Number of references to this buffer (e.g. how many sound objects use this buffer). More... | |
![]() | |
unsigned int | ConvertToMono (unsigned char *Buffer, unsigned int Size) |
Converts signed 16 bit raw PCM data from stereo to mono. More... | |
![]() | |
ArrayT< MixerTrackT * > | m_MixerTracks |
Mixer tracks this buffer is currently attached to. More... | |
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.
StreamingBufferT::StreamingBufferT | ( | const std::string & | ResName, |
bool | ForceMono | ||
) |
The constructor.
Throws an exception of type std::runtime_error on failure.
ResName | The 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). |
ForceMono | Whether the data from the resource should be reduced to a single channel before use (mono output). |
StreamingBufferT::~StreamingBufferT | ( | ) |
The destructor.
|
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. |
Implements BufferT.
|
virtual |
Returns whether this buffer can be attached to multiple mixer tracks (resource sharing).
Implements BufferT.
|
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. |
Implements BufferT.
|
virtual |
Returns the number of audio channels in this buffer (1 is mono, 2 is stereo).
Implements BufferT.
|
virtual |
Updates the buffer.
Implements BufferT.