Planeshift
|
A Volume and Sound control class. More...
#include <control.h>
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 |
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
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.
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.
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
object | pointer to a instance |
function | pointer to a static void function within that instance |
void SoundControl::SetToggle | ( | bool | value | ) |
Sets Toggle.
value | true or false |
virtual void SoundControl::SetToggle | ( | bool | value | ) | [virtual] |
Sets Toggle.
value | true or false |
virtual void SoundControl::SetVolume | ( | float | vol | ) | [virtual] |
Sets volume to the given float.
vol | Volume as float |
void SoundControl::SetVolume | ( | float | vol | ) |
Sets volume to the given float.
vol | Volume as float |
void SoundControl::Subscribe | ( | iSoundControlListener * | listener | ) |
Subscribe to SoundControl's events.
listener | the subscriber. |
virtual void SoundControl::Unmute | ( | ) | [virtual] |
Unmute this.
void SoundControl::Unmute | ( | ) |
Unmute this.
void SoundControl::Unsubscribe | ( | iSoundControlListener * | listener | ) |
Unsubscribe the listener.
listener | the object to remove. |
virtual void SoundControl::VolumeDampening | ( | float | damp | ) | [virtual] |
Dampen volume over time to configured value.
damp | This value is used to describe if the function should dampen or open the sound. |