Cafu Engine
BufferManagerT Class Reference

This class efficiently manages audio buffers by employing resource sharing whenever possible. More...

#include "BufferManager.hpp"

Public Member Functions

BufferTGetBuffer (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 BufferManagerTGetInstance ()
 Returns the BufferManagerTs singleton instance. More...
 

Detailed Description

This class efficiently manages audio buffers by employing resource sharing whenever possible.

Member Function Documentation

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.)

Parameters
ResNameThe name of the resource (file or capture device) that the requested buffer is for (i.e. created from).
ForceMonoWhether the data from the resource should be reduced to a single channel before use (mono output).
LoadTypeThe type of buffer that should handle the resource (see SoundShaderT for more details).
Returns
a BufferT instance for the specified resource. Throws an exception of type std::runtime_error on failure.
BufferManagerT * BufferManagerT::GetInstance ( )
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.

Parameters
BufferThe buffer to release.
void BufferManagerT::UpdateAll ( )

Updates all buffers.


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