Planeshift
|
#include <handle.h>
Public Member Functions | |
void | ConvertTo3D (float mindist, float maxdist, csVector3 pos, csVector3 dir, float rad) |
Converts this Handle to a 3D Handle. More... | |
void | ConvertTo3D (float mindist, float maxdist, csVector3 pos, csVector3 dir, float rad) |
Converts this Handle to a 3D Handle. More... | |
void | Fade (float volume, int time, int direction) |
Does fading calculation for this Handle. More... | |
void | Fade (float volume, int time, int direction) |
Does fading calculation for this Handle. More... | |
void | FadeStep () |
Perform a fading step if it is needed. More... | |
bool | GetAutoRemove () |
Returns state of AutoRemove. More... | |
bool | GetAutoRemove () |
Returns state of AutoRemove. More... | |
uint | GetID () const |
Gets the ID of this handle. More... | |
csVector3 | GetSourcePosition () |
Gets the position of the source. More... | |
bool | Init (const char *resname, bool loop, float volume_preset, int type, SoundControl *&ctrl) |
Initialize this Handle. More... | |
virtual bool | Init (const char *resname, bool loop, float volume_preset, int type, SoundControl *&ctrl, bool dopplerEffect) |
Initialize this Handle. More... | |
bool | Is3D () |
Detects if the source of this handle is 3D. More... | |
bool | IsDopplerEffectEnabled () |
Check if the doppler effect is enabled for this sound. More... | |
bool | IsWithinMaximumDistance (csVector3 listenerPos) const |
Check if the listener is within the maximum distance allowed. More... | |
virtual void | OnSoundChange (SoundControl *sndCtrl) |
This function is called everytime the volume or the toggle change. More... | |
virtual bool | Perform (iTimerEvent *) |
Unpause the sound after the given delay has elapsed. More... | |
void | RemoveCallback () |
Remove the callback. More... | |
void | RemoveCallback () |
Remove the callback. More... | |
void | SetAutoRemove (bool toggle) |
Whether to remove this Sound/Handle on pause. More... | |
void | SetAutoRemove (bool toggle) |
Whether to remove this Sound/Handle on pause. More... | |
void | SetCallback (void(*object), void(*function)(void *)) |
Sets a Callback to a object function. More... | |
void | SetCallback (void(*object), void(*function)(void *)) |
Sets a Callback to a object function. More... | |
void | SetID (uint identifier) |
Sets the ID of this handle. More... | |
SoundHandle (SoundSystemManager *) | |
constructor More... | |
SoundHandle () | |
constructor More... | |
void | UnpauseAfterDelay (unsigned int delay) |
Unpause the sound stream of this header after the given delay. More... | |
~SoundHandle () | |
destructor More... | |
virtual | ~SoundHandle () |
destructor More... | |
Public Attributes | |
bool | autoremove |
remove this handle when pause? More... | |
int | fade |
>0 is number of steps up <0 is number of steps down, 0 is nothing More... | |
bool | fade_stop |
pause this sound after fading down true / false More... | |
float | fade_volume |
volume we add or remove in each step (during fading) More... | |
csString | name |
name of the resource or the file - not unique More... | |
float | preset_volume |
the volume all calculations are based upon More... | |
SoundControl * | sndCtrl |
csRef< iSndSysData > | snddata |
pointer to sound data More... | |
csRef< iSndSysSource > | sndsource |
sndsource if 2D More... | |
csRef< iSndSysSource3D > | sndsource3d |
sndsource if 3D More... | |
csRef< iSndSysSource3DDirectionalSimple > | sndsourcedir |
additional source if 3D and directional More... | |
csRef< iSndSysStream > | sndstream |
sound stream More... | |
Protected Attributes | |
float | currentVolume |
the volume all calculations are based upon. More... | |
bool | dopplerEffect |
true if the doppler effect is enabled for this sound More... | |
SoundHandle::SoundHandle | ( | SoundSystemManager * | ) |
constructor
SoundHandle::~SoundHandle | ( | ) |
destructor
SoundHandle::SoundHandle | ( | ) |
constructor
|
virtual |
destructor
void SoundHandle::ConvertTo3D | ( | float | mindist, |
float | maxdist, | ||
csVector3 | pos, | ||
csVector3 | dir, | ||
float | rad | ||
) |
Converts this Handle to a 3D Handle.
Note: doesnt work when type is CS_SND3D_DISABLE Also created directional sources if rad > 0
mindist | distance when volume reaches max |
maxdist | distance when volume is a min |
pos | 3d position of this sound |
dir | direction this sound is emitting to (if rad > 0) |
rad | radiation of the directional cone |
void SoundHandle::ConvertTo3D | ( | float | mindist, |
float | maxdist, | ||
csVector3 | pos, | ||
csVector3 | dir, | ||
float | rad | ||
) |
Converts this Handle to a 3D Handle.
Note: doesnt work when type is CS_SND3D_DISABLE Also created directional sources if rad > 0
mindist | distance when volume reaches max |
maxdist | distance when volume is a min |
pos | 3d position of this sound |
dir | direction this sound is emitting to (if rad > 0) |
rad | radiation of the directional cone |
Does fading calculation for this Handle.
volume | volume to add / substract |
time | time within this must be done |
direction | FADE_DOWN / FADE_UP or FADE_STOP |
Does fading calculation for this Handle.
volume | volume to add / substract |
time | time within this must be done |
direction | FADE_DOWN / FADE_UP or FADE_STOP |
void SoundHandle::FadeStep | ( | ) |
Perform a fading step if it is needed.
bool SoundHandle::GetAutoRemove | ( | ) |
Returns state of AutoRemove.
bool SoundHandle::GetAutoRemove | ( | ) |
Returns state of AutoRemove.
|
inline |
csVector3 SoundHandle::GetSourcePosition | ( | ) |
Gets the position of the source.
bool SoundHandle::Init | ( | const char * | resname, |
bool | loop, | ||
float | volume_preset, | ||
int | type, | ||
SoundControl *& | ctrl | ||
) |
Initialize this Handle.
Done within this because its not failsave. Returns true or false.
resname | name of the resource |
loop | LOOP or DONT_LOOP |
volume_preset | volume which all calculation are based upon |
type | 3d type: can be CS_SND3D_DISABLE=0. CS_SND3D_RELATIVE=1 or CS_SND3D_ABSOLUTE=2 |
ctrl | SoundControl which controls this Handle |
|
virtual |
Initialize this Handle.
Done within this because its not failsave. Returns true or false.
resname | name of the resource |
loop | LOOP or DONT_LOOP |
volume_preset | volume which all calculation are based upon |
type | 3d type: can be CS_SND3D_DISABLE=0. CS_SND3D_RELATIVE=1 or CS_SND3D_ABSOLUTE=2 |
ctrl | SoundControl which controls this Handle |
dopplerEffect | true to apply the doppler effect to this sound, false otherwise. |
Reimplemented in SongHandle.
bool SoundHandle::Is3D | ( | ) |
Detects if the source of this handle is 3D.
bool SoundHandle::IsDopplerEffectEnabled | ( | ) |
Check if the doppler effect is enabled for this sound.
bool SoundHandle::IsWithinMaximumDistance | ( | csVector3 | listenerPos | ) | const |
Check if the listener is within the maximum distance allowed.
listenerPos | the listener position. |
|
virtual |
This function is called everytime the volume or the toggle change.
sndCtrl | the SoundControl that has been changed. |
Implements iSoundControlListener.
|
virtual |
Unpause the sound after the given delay has elapsed.
void SoundHandle::RemoveCallback | ( | ) |
Remove the callback.
void SoundHandle::RemoveCallback | ( | ) |
Remove the callback.
void SoundHandle::SetAutoRemove | ( | bool | toggle | ) |
Whether to remove this Sound/Handle on pause.
True means it will be removed when Sound is paused (Unamanged Sound). False means it will stay and leak if you dont take care (Managed Sound).
toggle | true or false |
void SoundHandle::SetAutoRemove | ( | bool | toggle | ) |
Whether to remove this Sound/Handle on pause.
True means it will be removed when Sound is paused (Unamanged Sound). False means it will stay and leak if you dont take care (Managed Sound).
toggle | true or false |
void SoundHandle::SetCallback | ( | void * | object, |
void(*)(void *) | function | ||
) |
Sets a Callback to a object function.
object | pointer to the object |
function | pointer to a static void function within the object |
void SoundHandle::SetCallback | ( | void * | object, |
void(*)(void *) | function | ||
) |
Sets a Callback to a object function.
object | pointer to the object |
function | pointer to a static void function within the object |
|
inline |
Unpause the sound stream of this header after the given delay.
delay | the delay in milliseconds. |
|
protected |
|
protected |
int SoundHandle::fade |
bool SoundHandle::fade_stop |
float SoundHandle::fade_volume |
csString SoundHandle::name |
float SoundHandle::preset_volume |
SoundControl * SoundHandle::sndCtrl |
csRef< iSndSysData > SoundHandle::snddata |
csRef< iSndSysSource > SoundHandle::sndsource |
csRef< iSndSysSource3D > SoundHandle::sndsource3d |
csRef< iSndSysSource3DDirectionalSimple > SoundHandle::sndsourcedir |