24 #ifndef _SOUND_HANDLE_H_ 25 #define _SOUND_HANDLE_H_ 31 #include <crystalspace.h> 72 void Fade(
float volume,
int time,
int direction);
89 virtual bool Init(
const char* resname,
bool loop,
90 float volume_preset,
int type,
96 virtual bool Perform(iTimerEvent* );
109 csVector3 pos, csVector3 dir,
141 void SetID(uint identifier) {
id = identifier; }
175 void SetCallback(
void (*
object),
void (*
function) (
void *));
195 void (*callbackobject);
196 void (*callbackfunction) (
void *);
Interface to implement to handle SoundControl's events.
bool GetAutoRemove()
Returns state of AutoRemove.
bool Is3D()
Detects if the source of this handle is 3D.
csRef< iSndSysSource3D > sndsource3d
sndsource if 3D
void SetCallback(void(*object), void(*function)(void *))
Sets a Callback to a object function.
uint GetID() const
Gets the ID of this handle.
void Fade(float volume, int time, int direction)
Does fading calculation for this Handle.
csRef< iSndSysSource3DDirectionalSimple > sndsourcedir
additional source if 3D and directional
virtual void OnSoundChange(SoundControl *sndCtrl)
This function is called everytime the volume or the toggle change.
void FadeStep()
Perform a fading step if it is needed.
csRef< iSndSysStream > sndstream
sound stream
bool autoremove
remove this handle when pause?
void RemoveCallback()
Remove the callback.
void SetID(uint identifier)
Sets the ID of this handle.
bool IsDopplerEffectEnabled()
Check if the doppler effect is enabled for this sound.
bool IsWithinMaximumDistance(csVector3 listenerPos) const
Check if the listener is within the maximum distance allowed.
virtual bool Perform(iTimerEvent *)
Unpause the sound after the given delay has elapsed.
csString name
name of the resource or the file - not unique
A Volume and Sound control class.
csRef< iSndSysData > snddata
pointer to sound data
void ConvertTo3D(float mindist, float maxdist, csVector3 pos, csVector3 dir, float rad)
Converts this Handle to a 3D Handle.
void UnpauseAfterDelay(unsigned int delay)
Unpause the sound stream of this header after the given delay.
bool Init(const char *resname, bool loop, float volume_preset, int type, SoundControl *&ctrl)
Initialize this Handle.
csRef< iSndSysSource > sndsource
sndsource if 2D
bool dopplerEffect
true if the doppler effect is enabled for this sound
This Manager Object is used to play all sounds.
float currentVolume
the volume all calculations are based upon.
void SetAutoRemove(bool toggle)
Whether to remove this Sound/Handle on pause.
csVector3 GetSourcePosition()
Gets the position of the source.