Planeshift
SoundControl Class Reference

A Volume and Sound control class. More...

#include <control.h>

Public Member Functions

void ActivateToggle ()
 activates Toggle. More...
 
virtual void ActivateToggle ()
 activates Toggle. More...
 
void DeactivateToggle ()
 deactivates Toggle. More...
 
virtual void DeactivateToggle ()
 deactivates Toggle. More...
 
virtual int GetID () const
 Returns this Volume ID. More...
 
bool GetToggle ()
 Get current Toggle state. More...
 
virtual bool GetToggle () const
 Get current Toggle state. More...
 
float GetVolume ()
 Returns current Volume as float. More...
 
virtual float GetVolume () const
 Returns current Volume as float. More...
 
virtual bool IsDampened () const
 Retrieve if volume is dampened. More...
 
void Mute ()
 Mute this. More...
 
virtual void Mute ()
 Mute this. More...
 
void RemoveCallback ()
 Removes Callback. More...
 
void SetCallback (void(*object), void(*function)(void *))
 Sets internal callbackpointers. More...
 
void SetToggle (bool value)
 Sets Toggle. More...
 
virtual void SetToggle (bool value)
 Sets Toggle. More...
 
void SetVolume (float vol)
 Sets volume to the given float. More...
 
virtual void SetVolume (float vol)
 Sets volume to the given float. More...
 
 SoundControl ()
 Constructor. More...
 
 SoundControl (int ID)
 Constructor. More...
 
void Subscribe (iSoundControlListener *listener)
 Subscribe to SoundControl's events. More...
 
void Unmute ()
 Unmute this. More...
 
virtual void Unmute ()
 Unmute this. More...
 
void Unsubscribe (iSoundControlListener *listener)
 Unsubscribe the listener. More...
 
virtual void VolumeDampening (float damp)
 Dampen volume over time to configured value. More...
 
 ~SoundControl ()
 Destructor. More...
 
virtual ~SoundControl ()
 Destructor. More...
 

Public Attributes

int id
 id of this control More...
 

Detailed Description

A Volume and Sound control class.

With this class you can control the volume and the overall state of a unlimited number of SoundsHandles. The whole class is pretty straith forward and selfdescribing. It also provides a callback functionality which calls back whenever something changes. You can use it by using SetCallback, please make sure that you call RemoveCallback before removing whether this Callback is set to.

Each SoundHandle must have one SoundControl associated. This is done during SoundHandle creation

See also
SystemSoundManager or
SoundHandle::Init for details.

Definition at line 40 of file control.h.

Constructor & Destructor Documentation

SoundControl::SoundControl ( )

Constructor.

Defaults are unmuted, enabled and volume is set to 1.0f.

SoundControl::~SoundControl ( )

Destructor.

SoundControl::SoundControl ( int  ID)

Constructor.

Defaults are unmuted, enabled and volume is set to 1.0f.

virtual SoundControl::~SoundControl ( )
virtual

Destructor.

Member Function Documentation

void SoundControl::ActivateToggle ( )

activates Toggle.

Sets isEnabled to true

virtual void SoundControl::ActivateToggle ( )
virtual

activates Toggle.

Sets isEnabled to true

void SoundControl::DeactivateToggle ( )

deactivates Toggle.

Sets isEnabled to false

virtual void SoundControl::DeactivateToggle ( )
virtual

deactivates Toggle.

Sets isEnabled to false

virtual int SoundControl::GetID ( ) const
virtual

Returns this Volume ID.

bool SoundControl::GetToggle ( )

Get current Toggle state.

Returns isEnabled

virtual bool SoundControl::GetToggle ( ) const
virtual

Get current Toggle state.

Returns isEnabled

float SoundControl::GetVolume ( )

Returns current Volume as float.

virtual float SoundControl::GetVolume ( ) const
virtual

Returns current Volume as float.

virtual bool SoundControl::IsDampened ( ) const
virtual

Retrieve if volume is dampened.

Returns
true when the volume has reached the dampened or full value.
void SoundControl::Mute ( )

Mute this.

virtual void SoundControl::Mute ( )
virtual

Mute this.

void SoundControl::RemoveCallback ( )

Removes Callback.

void SoundControl::SetCallback ( void *  object,
void(*)(void *)  function 
)

Sets internal callbackpointers.

Those Callbacks are called whenever a control changes. E.g. someone changes Volume or pushes a Toggle

Parameters
objectpointer to a instance
functionpointer to a static void function within that instance
void SoundControl::SetToggle ( bool  value)

Sets Toggle.

Parameters
valuetrue or false
virtual void SoundControl::SetToggle ( bool  value)
virtual

Sets Toggle.

Parameters
valuetrue or false
void SoundControl::SetVolume ( float  vol)

Sets volume to the given float.

Parameters
volVolume as float
virtual void SoundControl::SetVolume ( float  vol)
virtual

Sets volume to the given float.

Parameters
volVolume as float
void SoundControl::Subscribe ( iSoundControlListener listener)

Subscribe to SoundControl's events.

Parameters
listenerthe subscriber.
void SoundControl::Unmute ( )

Unmute this.

virtual void SoundControl::Unmute ( )
virtual

Unmute this.

void SoundControl::Unsubscribe ( iSoundControlListener listener)

Unsubscribe the listener.

Parameters
listenerthe object to remove.
virtual void SoundControl::VolumeDampening ( float  damp)
virtual

Dampen volume over time to configured value.

Parameters
dampThis value is used to describe if the function should dampen or open the sound.
Returns
true when the volume has reached the dampened or full value.

Member Data Documentation

int SoundControl::id

id of this control

Definition at line 43 of file control.h.


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