Planeshift
SoundSectorManager Class Reference

This class handles every sound defined in a sector. More...

#include <sectormngr.h>

Public Member Functions

void AddObjectEntity (iMeshWrapper *mesh, const char *meshName)
 Adds an object entity to be managed from the current sector. More...
 
int GetCombatStance () const
 Gets the current combat stance. More...
 
psSoundSectorGetCommonSector ()
 Gets the common sector. More...
 
int GetTimeOfDay () const
 Gets the time of the day. More...
 
bool Initialize (iObjectRegistry *objectReg)
 Load all sound sectors defined in XML files stored in the areas folder. More...
 
bool IsCombatMusicOn () const
 Checks if the combat music is activated. More...
 
bool IsLoopBGMOn () const
 Checks if the background music loop is allowed. More...
 
virtual void OnSoundChange (SoundControl *sndCtrl)
 This function is called everytime the volume or the toggle change. More...
 
bool ReloadSectors ()
 Reload all sound sectors from XML definition. More...
 
void RemoveObjectEntity (iMeshWrapper *mesh, const char *meshName)
 Removes an object entity managed from the current sector. More...
 
bool SetActiveSector (const char *sectorName)
 Sets the current active sector to the one with the given name and deactivate the previous one (if any). More...
 
void SetCombatMusicToggle (bool toggle)
 Toggles the combat music. More...
 
void SetCombatStance (int newCombatStance)
 Sets the current combat stance. More...
 
void SetEntityState (int state, iMeshWrapper *mesh, const char *meshName, bool forceChange)
 Sets the new state for the entity associated to the given mesh. More...
 
void SetLoopBGMToggle (bool toggle)
 Toggles the background music. More...
 
void SetTimeOfDay (int newTimeOfDay)
 Sets the current time of the day. More...
 
void SetWeather (int newWeather)
 Sets the current weather. More...
 
 SoundSectorManager ()
 Constructor. More...
 
void UnloadSectors ()
 Unload all sound sectors. More...
 
void Update ()
 Update the active sector. More...
 
void UpdateObjectEntity (iMeshWrapper *mesh, const char *meshName)
 Updates an object entity managed from the current sector. More...
 
virtual ~SoundSectorManager ()
 Destructor. More...
 
- Public Member Functions inherited from Singleton< SoundSectorManager >
 Singleton (SoundSectorManager *ptr)
 
 Singleton (void)
 
 ~Singleton ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Singleton< SoundSectorManager >
static SoundSectorManagerGetSingleton (void)
 
static SoundSectorManagerGetSingletonPtr (void)
 

Detailed Description

This class handles every sound defined in a sector.

It basically controls all sounds that comes from the 3D world.

Definition at line 52 of file sectormngr.h.

Constructor & Destructor Documentation

SoundSectorManager::SoundSectorManager ( )

Constructor.

virtual SoundSectorManager::~SoundSectorManager ( )
virtual

Destructor.

Member Function Documentation

void SoundSectorManager::AddObjectEntity ( iMeshWrapper *  mesh,
const char *  meshName 
)

Adds an object entity to be managed from the current sector.

Parameters
meshThe mesh associated to the entity.
meshNamethe name associated to the entity.
int SoundSectorManager::GetCombatStance ( ) const
inline

Gets the current combat stance.

Returns
the current combat stance.

Definition at line 143 of file sectormngr.h.

psSoundSector* SoundSectorManager::GetCommonSector ( )
inline

Gets the common sector.

Returns
the common sector.

Definition at line 126 of file sectormngr.h.

int SoundSectorManager::GetTimeOfDay ( ) const
inline

Gets the time of the day.

Returns
the time of the day.

Definition at line 158 of file sectormngr.h.

bool SoundSectorManager::Initialize ( iObjectRegistry *  objectReg)

Load all sound sectors defined in XML files stored in the areas folder.

Its * path is defined in the option Planeshift.Sound.AreasPath of the configuration file.

Parameters
objectRegthe object registry.
Returns
true if sectors could be loaded, false otherwise.
bool SoundSectorManager::IsCombatMusicOn ( ) const
inline

Checks if the combat music is activated.

Returns
true if the combat music is activated, false otherwise.

Definition at line 111 of file sectormngr.h.

bool SoundSectorManager::IsLoopBGMOn ( ) const
inline

Checks if the background music loop is allowed.

Returns
true if the background music loop is allowed, false otherwise.

Definition at line 96 of file sectormngr.h.

virtual void SoundSectorManager::OnSoundChange ( SoundControl sndCtrl)
virtual

This function is called everytime the volume or the toggle change.

Parameters
sndCtrlthe SoundControl that has been changed.

Implements iSoundControlListener.

bool SoundSectorManager::ReloadSectors ( )

Reload all sound sectors from XML definition.

If SoundSectorManager has not been already initialized nothing happens.

Returns
true if sectors could be loaded again, false otherwise.
void SoundSectorManager::RemoveObjectEntity ( iMeshWrapper *  mesh,
const char *  meshName 
)

Removes an object entity managed from the current sector.

Parameters
meshThe mesh associated to the entity.
meshNamethe name associated to the entity.
bool SoundSectorManager::SetActiveSector ( const char *  sectorName)

Sets the current active sector to the one with the given name and deactivate the previous one (if any).

If no sound sector with that name is found, nothing change.

Returns
true if the given sector exists, false otherwise.
void SoundSectorManager::SetCombatMusicToggle ( bool  toggle)

Toggles the combat music.

Parameters
toggletrue to activate the combat music.
void SoundSectorManager::SetCombatStance ( int  newCombatStance)

Sets the current combat stance.

Parameters
newCombatStancethe new combat stance.
void SoundSectorManager::SetEntityState ( int  state,
iMeshWrapper *  mesh,
const char *  meshName,
bool  forceChange 
)

Sets the new state for the entity associated to the given mesh.

If it is already playing a sound, it is stopped.

Parameters
statethe new state >= 0 for the entity. For negative value the function is not defined.
meshthe mesh associated to the entity.
meshNamethe name associated to the entity.
forceChangeif it is false the entity does not change its state if the new one is not defined. If it is true the entity stops play any sound until a new valid state is defined.
void SoundSectorManager::SetLoopBGMToggle ( bool  toggle)

Toggles the background music.

Parameters
toggletrue to make the background music to loop.
void SoundSectorManager::SetTimeOfDay ( int  newTimeOfDay)

Sets the current time of the day.

Parameters
newTimeOfDaythe new time of the day.
void SoundSectorManager::SetWeather ( int  newWeather)

Sets the current weather.

Parameters
newWeatherthe new weather.
void SoundSectorManager::UnloadSectors ( )

Unload all sound sectors.

void SoundSectorManager::Update ( )

Update the active sector.

This is called every x milliseconds by SoundManager::Update() It updates Emitters and Entities

void SoundSectorManager::UpdateObjectEntity ( iMeshWrapper *  mesh,
const char *  meshName 
)

Updates an object entity managed from the current sector.

Parameters
meshThe mesh associated to the entity.
meshNamethe name associated to the entity.

The documentation for this class was generated from the following file: