Planeshift
|
This Manager Object is used to play all sounds. More...
#include <manager.h>
Public Member Functions | |
SoundControl * | AddSoundControl (uint sndCtrlID) |
Returns a NEW SoundControl. | |
csVector3 | GetListenerPos () const |
Gets the listener position. | |
csVector3 & | GetPlayerPosition () |
Gets the current player's position. | |
SoundControl * | GetSoundControl () |
Returns a NEW SoundControl. | |
SoundControl * | GetSoundControl (uint sndCtrlID) const |
SoundData * | GetSoundData () |
SoundDataCache * | GetSoundDataCache () const |
SoundSystem * | GetSoundSystem () |
SoundSystem * | GetSoundSystem () const |
bool | Initialize (iObjectRegistry *objectReg) |
Initializes this SoundSystemManager. | |
bool | IsHandleValid (uint handleID) const |
Check if the given handle ID exists. | |
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). | |
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). | |
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. | |
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, bool dopplerEffect=true) |
Plays a 3D sound. | |
void | RemoveSoundControl (uint sndCtrlID) |
void | SetPlayerPosition (csVector3 &pos) |
Sets the current player's position. | |
void | SetPlayerVelocity (csVector3 vel) |
Sets the player velocity. | |
bool | SetSoundSource (uint handleID, csVector3 position) |
Set the position of the sound source of the handle with the given ID. | |
SoundSystemManager (iObjectRegistry *objectReg) | |
Constructor initializes this SoundSystemManager. | |
SoundSystemManager () | |
Constructor. | |
bool | StopSound (uint handleID) |
Pause a sound and set the autoremove. | |
void | StopSound (SoundHandle *handle) |
Stops and removes a SoundHandle. | |
void | Update () |
Updates this SoundManager and everything its driving. | |
void | Update () |
Updates this SoundManager and everything its driving. | |
void | UpdateListener (csVector3 v, csVector3 f, csVector3 t) |
Update listener position. | |
void | UpdateListener (csVector3 v, csVector3 f, csVector3 t) |
Update listener position. | |
void | UpdateSound () |
Checks all SoundHandles alters Volume, does fading, applies the Doppler effect and removes them if Unmanaged (Autoremove true). | |
void | UpdateSound () |
Checks all SoundHandles alters Volume, does fading and removes them if Unmanaged (Autoremove true). | |
~SoundSystemManager () | |
Destructor will remove everything this SoundManager created. | |
~SoundSystemManager () | |
Destructor will remove everything this SoundManager created. | |
Public Attributes | |
SoundControl * | effectSndCtrl |
sound control for effects / actions | |
csRef< iEventTimer > | eventTimer |
timer event used by all the sound handle to play after a delay | |
SoundControl * | guiSndCtrl |
sound control for paws / gui | |
bool | Initialised |
is initialized ? | |
SoundControl * | mainSndCtrl |
sound control for this manager |
This Manager Object is used to play all sounds.
It keeps track of Data/Sounds and does fading, sets volume and removes sounds which are no longer needed. You may use the Play*Sound methods to play a sound. You need a
TODO merge Play* functions
It keeps track of Data/Sounds and does fading, sets volume and removes sounds which are no longer needed. You may use the Play*Sound methods to play a sound. You need a
SoundSystemManager::SoundSystemManager | ( | iObjectRegistry * | objectReg | ) |
Constructor initializes this SoundSystemManager.
Also initializes a
SoundSystemManager::~SoundSystemManager | ( | ) |
Destructor will remove everything this SoundManager created.
It will stop and delete all Handles, removes
SoundSystemManager::SoundSystemManager | ( | ) |
Constructor.
SoundSystemManager::~SoundSystemManager | ( | ) |
Destructor will remove everything this SoundManager created.
It will stop and delete all Handles, removes
SoundControl* SoundSystemManager::AddSoundControl | ( | uint | sndCtrlID | ) |
Returns a NEW SoundControl.
It creates a new SoundControl and returns it. Also keeps a internal list of all existing SoundControls. But atm there is no way to recover a lost SoundControl.
csVector3 SoundSystemManager::GetListenerPos | ( | ) | const |
Gets the listener position.
csVector3& SoundSystemManager::GetPlayerPosition | ( | ) |
Gets the current player's position.
SoundControl* SoundSystemManager::GetSoundControl | ( | ) |
Returns a NEW SoundControl.
It creates a new SoundControl and returns it. Also keeps a internal list of all existing SoundControls. But atm there is no way to recover a lost SoundControl.
SoundControl* SoundSystemManager::GetSoundControl | ( | uint | sndCtrlID | ) | const |
SoundDataCache* SoundSystemManager::GetSoundDataCache | ( | ) | const [inline] |
SoundSystem* SoundSystemManager::GetSoundSystem | ( | ) | [inline] |
SoundSystem* SoundSystemManager::GetSoundSystem | ( | ) | const [inline] |
bool SoundSystemManager::Initialize | ( | iObjectRegistry * | objectReg | ) |
Initializes this SoundSystemManager.
Also initializes a
objectReg | the object registry. |
bool SoundSystemManager::IsHandleValid | ( | uint | handleID | ) | const |
Check if the given handle ID exists.
handleID | the handle ID to check. |
bool SoundSystemManager::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).
name | name of the resource you want to play |
loop | LOOP or DONT_LOOP |
loopstart | startframe when looping |
loopend | when reach it will jump to startframe |
volume_preset | volume for this sound, all volume calculations are based upon this |
sndCtrl | SoundControl to control this sound |
handle | a Handle you have to supply. You may discard it if you dont want to manage this sound. |
bool SoundSystemManager::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).
name | name of the resource you want to play |
loop | LOOP or DONT_LOOP |
loopstart | startframe when looping |
loopend | when reach it will jump to startframe |
volume_preset | volume for this sound, all volume calculations are based upon this |
sndCtrl | SoundControl to control this sound |
handle | a Handle you have to supply. If the handle is null a new one is created. You may discard it if you dont want to manage this sound. |
bool SoundSystemManager::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.
name | name of the resource you want to play |
loop | LOOP or DONT_LOOP |
loopstart | startframe when looping |
loopend | when reach it will jump to startframe |
volume_preset | volume for this sound, all volume calculations are based upon this |
sndCtrl | the sound controller |
pos | Sound 3d position of the sound, keep type3d in mind because it can be ABSOLUTE or RELATIVE |
dir | direction this sound is emitting to |
mindist | distance when maxvolume should be reached |
maxdist | distance when minvolume is applied |
rad | radiation of the directional cone. Set it to 0 if you dont want a directional sound. |
type3d | Either ABSOLUTE or RELATIVE. |
handle | a Handle you have to supply. You may discard it if you dont want to manage this sound. |
bool SoundSystemManager::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, | ||
bool | dopplerEffect = true |
||
) |
Plays a 3D sound.
name | name of the resource you want to play |
loop | LOOP or DONT_LOOP |
loopstart | startframe when looping |
loopend | when reach it will jump to startframe |
volume_preset | volume for this sound, all volume calculations are based upon this |
pos | Sound 3d position of the sound, keep type3d in mind because it can be ABSOLUTE or RELATIVE |
dir | direction this sound is emitting to |
mindist | distance when maxvolume should be reached |
maxdist | distance when minvolume is applied |
rad | radiation of the directional cone. Set it to 0 if you dont want a directional sound. |
handle | a Handle you have to supply. If the handle is null a new one is created. You may discard it if you dont want to manage this sound. |
dopplerEffect | true to apply the doppler effect to this sound, false otherwise. |
void SoundSystemManager::RemoveSoundControl | ( | uint | sndCtrlID | ) |
void SoundSystemManager::SetPlayerPosition | ( | csVector3 & | pos | ) |
Sets the current player's position.
pos | the new player's position. |
void SoundSystemManager::SetPlayerVelocity | ( | csVector3 | vel | ) |
Sets the player velocity.
vel | the player's velocity. |
bool SoundSystemManager::SetSoundSource | ( | uint | handleID, |
csVector3 | position | ||
) |
Set the position of the sound source of the handle with the given ID.
handleID | the ID of the handle to stop. |
position | the new position of the sound's source. |
void SoundSystemManager::StopSound | ( | SoundHandle * | handle | ) |
Stops and removes a SoundHandle.
Use with caution. It doesnt care if its still in use.
handle | A valid soundhandle |
bool SoundSystemManager::StopSound | ( | uint | handleID | ) |
Pause a sound and set the autoremove.
The handle is picked up in the next update.
handleID | the ID of the handle to stop. |
void SoundSystemManager::Update | ( | ) |
Updates this SoundManager and everything its driving.
Consider this as its Mainloop. It does ten updates per second. It calls UpdateSound and updates SoundData.
void SoundSystemManager::Update | ( | ) |
Updates this SoundManager and everything its driving.
Consider this as its Mainloop. It does ten updates per second. It calls UpdateSound and updates SoundDataCache.
void SoundSystemManager::UpdateListener | ( | csVector3 | v, |
csVector3 | f, | ||
csVector3 | t | ||
) |
Update listener position.
v | viewpoint or for that matter hearpoint |
f | front |
t | top |
void SoundSystemManager::UpdateListener | ( | csVector3 | v, |
csVector3 | f, | ||
csVector3 | t | ||
) |
Update listener position.
v | viewpoint or for that matter hearpoint |
f | front |
t | top |
void SoundSystemManager::UpdateSound | ( | ) |
Checks all SoundHandles alters Volume, does fading, applies the Doppler effect and removes them if Unmanaged (Autoremove true).
void SoundSystemManager::UpdateSound | ( | ) |
Checks all SoundHandles alters Volume, does fading and removes them if Unmanaged (Autoremove true).
csRef<iEventTimer> SoundSystemManager::eventTimer |