This class efficiently manages audio buffers by employing resource sharing whenever possible. More...
#include "BufferManager.hpp"
Public Member Functions | |
BufferT * | GetBuffer (const std::string &ResName, bool ForceMono, SoundShaderT::LoadTypeE LoadType) |
This method obtains a BufferT instance for the specified resource (a file or a capture device). More... | |
void | UpdateAll () |
Updates all buffers. More... | |
void | ReleaseBuffer (BufferT *Buffer) |
Releases a buffer. More... | |
void | ReleaseAll () |
Releases all buffers. More... | |
Static Public Member Functions | |
static BufferManagerT * | GetInstance () |
Returns the BufferManagerTs singleton instance. More... | |
This class efficiently manages audio buffers by employing resource sharing whenever possible.
BufferT * BufferManagerT::GetBuffer | ( | const std::string & | ResName, |
bool | ForceMono, | ||
SoundShaderT::LoadTypeE | LoadType | ||
) |
This method obtains a BufferT instance for the specified resource (a file or a capture device).
When the user code is done with the returned buffer, it must call ReleaseBuffer() in order to release the buffer. (The implementation can return a newly created or a reference-counted BufferT instance for resource sharing.)
ResName | The name of the resource (file or capture device) that the requested buffer is for (i.e. created from). |
ForceMono | Whether the data from the resource should be reduced to a single channel before use (mono output). |
LoadType | The type of buffer that should handle the resource (see SoundShaderT for more details). |
|
static |
Returns the BufferManagerTs singleton instance.
void BufferManagerT::ReleaseAll | ( | ) |
Releases all buffers.
void BufferManagerT::ReleaseBuffer | ( | BufferT * | Buffer | ) |
Releases a buffer.
Internally, the released buffer may or may not be completely deleted from memory, depending on its reference count.
Buffer | The buffer to release. |
void BufferManagerT::UpdateAll | ( | ) |
Updates all buffers.