Planeshift
Public Member Functions | Public Attributes

SoundControl Class Reference

A Volume and Sound control class. More...

#include <control.h>

List of all members.

Public Member Functions

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

Public Attributes

int id
 id of this control

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.

virtual bool SoundControl::GetToggle ( ) const [virtual]

Get current Toggle state.

Returns isEnabled

bool SoundControl::GetToggle ( )

Get current Toggle state.

Returns isEnabled

virtual float SoundControl::GetVolume ( ) const [virtual]

Returns current Volume as float.

float SoundControl::GetVolume ( )

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.
virtual void SoundControl::Mute ( ) [virtual]

Mute this.

void SoundControl::Mute ( )

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
virtual void SoundControl::SetVolume ( float  vol) [virtual]

Sets volume to the given float.

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

Sets volume to the given float.

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

Subscribe to SoundControl's events.

Parameters:
listenerthe subscriber.
virtual void SoundControl::Unmute ( ) [virtual]

Unmute this.

void SoundControl::Unmute ( )

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

id of this control

Definition at line 43 of file control.h.


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