flimEngine
SoundEngine Class Reference

#include <SoundEngine.h>

Collaboration diagram for SoundEngine:
Collaboration graph

Public Member Functions

 SoundEngine (const SoundEngine &)=delete
 
const SoundEngineoperator= (const SoundEngine &)=delete
 

Static Public Member Functions

static snd_err Create ()
 Creates the SoundEngine. More...
 
static snd_err Update ()
 Updates this sound engine, processing commands. More...
 
static snd_err SendData (ThreadCommand val)
 Sends a command to the audio thread. More...
 
static snd_err SendDataA2G (ThreadCommand val)
 Sends a command from audio thread to game. More...
 
static CircularDataGetG2ABuff ()
 Gets g 2 a buffer. More...
 
static CircularDataGetA2GBuff ()
 Gets a 2 g buffer. More...
 
static snd_err CreateSoundCall (SoundCall *&in, SoundCallID id, bool _3D)
 Creates sound call. More...
 
static snd_err CreateSoundCall (SoundCall *&in, SoundCallID id, int priority)
 Creates sound call. More...
 
static snd_err ReturnSoundCall (SoundCall *in)
 Returns sound call. More...
 
static snd_err FindSoundCall (SoundCall *&out, unsigned int handle)
 Searches for the first sound call. More...
 
static snd_err Terminate ()
 Gets the terminate. More...
 
static snd_err LoadScript (std::string path, SoundCallID id, void(*cb)(void)=nullptr)
 Loads a script. More...
 
static snd_err LoadSound (std::string path, SoundCallID id, void(*cb)(void)=nullptr)
 Loads a sound. More...
 

Private Member Functions

 SoundEngine ()
 
 ~SoundEngine ()
 
snd_err privCreateSoundCall (SoundCall *&in, SoundCallID id, int priority)
 
snd_err privUpdate ()
 
snd_err privSendData (ThreadCommand val)
 
snd_err privSendDataA2G (ThreadCommand val)
 
snd_err privCreate ()
 
snd_err privTerminate ()
 
snd_err privCreateSoundCall (SoundCall *&in, SoundCallID id, bool _3D)
 
snd_err privReturnSoundCall (SoundCall *in)
 
snd_err privFindSoundCall (SoundCall *&out, unsigned int handle)
 
snd_err privLoadScript (std::string path, SoundCallID id, void(*cb)(void))
 
snd_err privLoadSound (std::string path, SoundCallID id, void(*cb)(void))
 
snd_err privLoadScript (const char *path, SoundCallID id, void(*cb)(void))
 
CircularDataprivGetG2ABuff ()
 
CircularDataprivGetA2GBuff ()
 

Static Private Member Functions

static SoundEngineInstance ()
 

Private Attributes

CircularDatapG2ABuff
 
CircularDatapA2GBuff
 
std::map< unsigned int, SoundCall * > activeSoundCalls
 
std::thread audioThread
 

Static Private Attributes

static SoundEngineinstance = nullptr
 

Constructor & Destructor Documentation

◆ SoundEngine() [1/2]

SoundEngine::SoundEngine ( const SoundEngine )
delete

◆ SoundEngine() [2/2]

SoundEngine::SoundEngine ( )
private

◆ ~SoundEngine()

SoundEngine::~SoundEngine ( )
private

Member Function Documentation

◆ Create()

static snd_err SoundEngine::Create ( )
inlinestatic

Creates the SoundEngine.

Author
Jack Campbell
Date
6/1/2017
Returns
A snd_err.

◆ CreateSoundCall() [1/2]

static snd_err SoundEngine::CreateSoundCall ( SoundCall *&  in,
SoundCallID  id,
bool  _3D 
)
inlinestatic

Creates sound call.

Author
Jack Campbell
Date
6/1/2017
Parameters
[in,out]in[in,out] If non-null, the in.
idThe identifier.
_3DTrue to 3D.
Returns
The new sound call.

◆ CreateSoundCall() [2/2]

static snd_err SoundEngine::CreateSoundCall ( SoundCall *&  in,
SoundCallID  id,
int  priority 
)
inlinestatic

Creates sound call.

Author
Jack Campbell
Date
6/1/2017
Parameters
[in,out]in[in,out] If non-null, the in.
idThe identifier.
priorityThe priority.
Returns
The new sound call.

◆ FindSoundCall()

static snd_err SoundEngine::FindSoundCall ( SoundCall *&  out,
unsigned int  handle 
)
inlinestatic

Searches for the first sound call.

Author
Jack Campbell
Date
6/1/2017
Parameters
[in,out]out[in,out] If non-null, the out.
handleThe handle.
Returns
The found sound call.

◆ GetA2GBuff()

static CircularData SoundEngine::* SoundEngine::GetA2GBuff ( )
inlinestatic

Gets a 2 g buffer.

Author
Jack Campbell
Date
6/1/2017
Returns
Null if it fails, else a 2 g buffer.

◆ GetG2ABuff()

static CircularData SoundEngine::* SoundEngine::GetG2ABuff ( )
inlinestatic

Gets g 2 a buffer.

Author
Jack Campbell
Date
6/1/2017
Returns
Null if it fails, else the g 2 a buffer.

◆ Instance()

static SoundEngine& SoundEngine::Instance ( )
inlinestaticprivate

◆ LoadScript()

static snd_err SoundEngine::LoadScript ( std::string  path,
SoundCallID  id,
void(*)(void)  cb = nullptr 
)
inlinestatic

Loads a script.

Author
Jack Campbell
Date
6/1/2017
Parameters
pathFull pathname of the file.
idThe identifier.
[in,out]cb(Optional) If non-null, the cb.
Returns
The script.

◆ LoadSound()

static snd_err SoundEngine::LoadSound ( std::string  path,
SoundCallID  id,
void(*)(void)  cb = nullptr 
)
inlinestatic

Loads a sound.

Author
Jack Campbell
Date
6/1/2017
Parameters
pathFull pathname of the file.
idThe identifier.
[in,out]cb(Optional) If non-null, the cb.
Returns
The sound.

◆ operator=()

const SoundEngine& SoundEngine::operator= ( const SoundEngine )
delete

◆ privCreate()

snd_err SoundEngine::privCreate ( )
private

◆ privCreateSoundCall() [1/2]

snd_err SoundEngine::privCreateSoundCall ( SoundCall *&  in,
SoundCallID  id,
int  priority 
)
private

◆ privCreateSoundCall() [2/2]

snd_err SoundEngine::privCreateSoundCall ( SoundCall *&  in,
SoundCallID  id,
bool  _3D 
)
private

◆ privFindSoundCall()

snd_err SoundEngine::privFindSoundCall ( SoundCall *&  out,
unsigned int  handle 
)
private

◆ privGetA2GBuff()

CircularData * SoundEngine::privGetA2GBuff ( )
private

◆ privGetG2ABuff()

CircularData * SoundEngine::privGetG2ABuff ( )
private

◆ privLoadScript() [1/2]

snd_err SoundEngine::privLoadScript ( std::string  path,
SoundCallID  id,
void(*)(void)  cb = nullptr 
)
private

◆ privLoadScript() [2/2]

snd_err SoundEngine::privLoadScript ( const char *  path,
SoundCallID  id,
void(*)(void)  cb 
)
private

◆ privLoadSound()

snd_err SoundEngine::privLoadSound ( std::string  path,
SoundCallID  id,
void(*)(void)  cb 
)
private

◆ privReturnSoundCall()

snd_err SoundEngine::privReturnSoundCall ( SoundCall in)
private

◆ privSendData()

snd_err SoundEngine::privSendData ( ThreadCommand  val)
private

◆ privSendDataA2G()

snd_err SoundEngine::privSendDataA2G ( ThreadCommand  val)
private

◆ privTerminate()

snd_err SoundEngine::privTerminate ( )
private

◆ privUpdate()

snd_err SoundEngine::privUpdate ( )
private

◆ ReturnSoundCall()

static snd_err SoundEngine::ReturnSoundCall ( SoundCall in)
inlinestatic

Returns sound call.

Author
Jack Campbell
Date
6/1/2017
Parameters
[in,out]inIf non-null, the in.
Returns
The sound call.

◆ SendData()

static snd_err SoundEngine::SendData ( ThreadCommand  val)
inlinestatic

Sends a command to the audio thread.

Author
Jack Campbell
Date
6/1/2017
Parameters
valThe value.
Returns
A snd_err.

◆ SendDataA2G()

static snd_err SoundEngine::SendDataA2G ( ThreadCommand  val)
inlinestatic

Sends a command from audio thread to game.

Author
Jack Campbell
Date
6/1/2017
Parameters
valThe value.
Returns
A snd_err.

◆ Terminate()

static snd_err SoundEngine::Terminate ( )
inlinestatic

Gets the terminate.

Author
Jack Campbell
Date
6/1/2017
Returns
A snd_err.

◆ Update()

static snd_err SoundEngine::Update ( )
inlinestatic

Updates this sound engine, processing commands.

Author
Jack Campbell
Date
6/1/2017
Returns
A snd_err.

Member Data Documentation

◆ activeSoundCalls

std::map<unsigned int, SoundCall*> SoundEngine::activeSoundCalls
private

◆ audioThread

std::thread SoundEngine::audioThread
private

◆ instance

SoundEngine * SoundEngine::instance = nullptr
staticprivate

◆ pA2GBuff

CircularData* SoundEngine::pA2GBuff
private

◆ pG2ABuff

CircularData* SoundEngine::pG2ABuff
private

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