24 #ifndef _SOUND_MANAGER_H_ 25 #define _SOUND_MANAGER_H_ 32 #include <iutil/objreg.h> 33 #include <csgeom/vector3.h> 34 #include <csutil/hash.h> 35 #include <iutil/timer.h> 36 #include <csutil/timer.h> 37 #include <csutil/randomgen.h> 59 #define VOLUME_ZERO 0.0f 60 #define VOLUME_MIN 0.0f 61 #define VOLUME_NORM 1.0f 62 #define VOLUME_MAX 2.0f 64 #define DEFAULT_SNDSYS_UPDATE_TIME 100 65 #define DEFAULT_SPEED_OF_SOUND 331 66 #define DEFAULT_DOPPLER_FACTOR 0.0 67 #define DEFAULT_SOUNDLIB_PATH "/planeshift/art/soundlib.xml" 133 bool Play2DSound(
const char* name,
bool loop,
size_t loopstart,
134 size_t loopend,
float volume_preset,
154 bool Play3DSound(
const char* name,
bool loop,
size_t loopstart,
155 size_t loopend,
float volume_preset,
157 float mindist,
float maxdist,
float rad,
int type3d,
230 csHash<SoundHandle*, uint> soundHandles;
231 csHash<SoundControl*, uint> soundControllers;
235 csTicks LastUpdateTime;
237 csVector3 playerPosition;
238 csVector3 playerVelocity;
254 void RemoveHandle(uint handleID);
279 bool InitSoundHandle(
const char* name,
bool loop,
size_t loopstart,
280 size_t loopend,
float volume_preset,
int type3d,
~SoundSystemManager()
Destructor will remove everything this SoundManager created.
SoundDataCache * GetSoundDataCache() const
bool Play3DSound(const char *name, bool loop, size_t loopstart, size_t loopend, float volume_preset, SoundControl *&sndCtrl, csVector3 pos, csVector3 dir, float mindist, float maxdist, float rad, int type3d, SoundHandle *&handle)
Plays a 3D sound.
csVector3 GetListenerPos() const
Gets the listener position.
bool Initialize(iObjectRegistry *objectReg)
Initializes this SoundSystemManager.
SoundSystemManager()
Constructor.
void RemoveSoundControl(uint sndCtrlID)
void StopSound(SoundHandle *handle)
Stops and removes a SoundHandle.
void SetPlayerPosition(csVector3 &pos)
Sets the current player's position.
SoundSystem * GetSoundSystem() const
bool Play2DSound(const char *name, bool loop, size_t loopstart, size_t loopend, float volume_preset, SoundControl *&sndCtrl, SoundHandle *&handle)
Plays a 2D sound (Cannot be converted to 3D).
void UpdateSound()
Checks all SoundHandles alters Volume, does fading and removes them if Unmanaged (Autoremove true)...
SoundDataCache is the data-keeper of SoundSystemManager.
void UpdateListener(csVector3 v, csVector3 f, csVector3 t)
Update listener position.
A Volume and Sound control class.
void Update()
Updates this SoundManager and everything its driving.
SoundControl * GetSoundControl()
Returns a NEW SoundControl.
bool SetSoundSource(uint handleID, csVector3 position)
Set the position of the sound source of the handle with the given ID.
SoundControl * mainSndCtrl
sound control for this manager
bool Initialised
is initialized ?
csRef< iEventTimer > eventTimer
timer event used by all the sound handle to play after a delay
SoundControl * AddSoundControl(uint sndCtrlID)
Returns a NEW SoundControl.
This Manager Object is used to play all sounds.
csVector3 & GetPlayerPosition()
Gets the current player's position.
void SetPlayerVelocity(csVector3 vel)
Sets the player velocity.
bool IsHandleValid(uint handleID) const
Check if the given handle ID exists.
This is an Interface Class to the Crystalspace Soundrenderer.