Planeshift
pssoundsector.h
Go to the documentation of this file.
1 /*
2  * pssoundsector.h
3  *
4  * Copyright (C) 2001-2010 Atomic Blue (info@planeshift.it, http://www.planeshift.it)
5  *
6  * Credits : Mathias 'AgY' Voeroes <agy@operswithoutlife.net>
7  * and all past and present planeshift coders
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation (version 2 of the License.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  */
22 
23 #ifndef _PSSOUNDSECTOR_H_
24 #define _PSSOUNDSECTOR_H_
25 
26 //====================================================================================
27 // Crystal Space Includes
28 //====================================================================================
29 #include <csutil/hash.h>
30 #include <csutil/csstring.h>
31 #include <csgeom/vector3.h>
32 
33 //------------------------------------------------------------------------------------
34 // Forward Declarations
35 //------------------------------------------------------------------------------------
36 class psMusic;
37 class psEntity;
38 class psEmitter;
39 class SoundControl;
40 class GEMClientActor;
41 struct iMeshWrapper;
42 struct iDocumentNode;
43 
49 {
50 public:
51  csString name;
52  bool active;
55  csArray<psMusic*> ambientarray;
56  csArray<psMusic*> musicarray;
57  csArray<psEmitter*> emitterarray;
58  csHash<psEntity*, csString> factories;
59  csHash<psEntity*, csString> meshes;
60  csHash<psEntity*, uint> tempEntities;
61 
66  psSoundSector(iObjectRegistry* objectReg);
67 
74  psSoundSector(csRef<iDocumentNode> sectorNode, iObjectRegistry* objectReg);
75 
81  void AddAmbient(csRef<iDocumentNode> Node);
82  void UpdateAmbient(int type, SoundControl* &ctrl);
83  void DeleteAmbient(psMusic* &ambient);
84  void AddMusic(csRef<iDocumentNode> Node);
85  void UpdateMusic(bool loopToggle, int type, SoundControl* &ctrl);
86  void DeleteMusic(psMusic* &music);
87 
92  void AddEmitter(csRef<iDocumentNode> Node);
93 
98  void UpdateAllEmitters(SoundControl* &ctrl);
99 
104  void UpdateAllEntities(SoundControl* &ctrl);
105 
110  void DeleteEmitter(psEmitter* &emitter);
115  void AddEntityDefinition(csRef<iDocumentNode> entityNode);
116 
123  void UpdateEntity(iMeshWrapper* mesh, const char* meshName, SoundControl* &ctrl);
124  void DeleteEntity(psEntity* &entity);
125 
131  void AddObjectEntity(iMeshWrapper* mesh, const char* meshName);
132 
138  void RemoveObjectEntity(iMeshWrapper* mesh, const char* meshName);
139 
140 
141 
154  void SetEntityState(int state, iMeshWrapper* mesh, const char* actorName, bool forceChange);
155 
162  void Load(csRef<iDocumentNode> sectorNode);
163  void Reload(csRef<iDocumentNode> sector);
164  void Delete();
165 
166 private:
167  iObjectRegistry* objectReg;
168 
178  psEntity* GetAssociatedEntity(iMeshWrapper* mesh, const char* meshName) const;
179 };
180 
181 #endif /*_PSSOUNDSECTOR_H_*/
psMusic * activemusic
active music
Definition: pssoundsector.h:54
psSoundSector(iObjectRegistry *objectReg)
Create an empty psSoundSector with no musics, ambients, emitters and entities.
void UpdateAmbient(int type, SoundControl *&ctrl)
This is a player or another &#39;alive&#39; entity on the client.
Definition: pscelclient.h:554
void AddAmbient(csRef< iDocumentNode > Node)
void Reload(csRef< iDocumentNode > sector)
bool active
is this sector active?
Definition: pssoundsector.h:52
void UpdateAllEntities(SoundControl *&ctrl)
Update all entities times, and based on their status generate a sound.
void AddObjectEntity(iMeshWrapper *mesh, const char *meshName)
Adds an object entity to be managed from the sector.
work in progress - Looks like a mishap.
Definition: pssoundsector.h:48
void UpdateAllEmitters(SoundControl *&ctrl)
Start/stops all emitters based on distance and time of the day.
csString name
name of this sector
Definition: pssoundsector.h:51
void AddEmitter(csRef< iDocumentNode > Node)
Adds one emitter from the current array of known emitters.
void UpdateEntity(iMeshWrapper *mesh, const char *meshName, SoundControl *&ctrl)
Updates an object entity managed from the sector.
csArray< psEmitter * > emitterarray
array of emitters
Definition: pssoundsector.h:57
psMusic * activeambient
active ambient music
Definition: pssoundsector.h:53
csArray< psMusic * > ambientarray
array of available ambients
Definition: pssoundsector.h:55
csHash< psEntity *, csString > meshes
hash of mesh entities
Definition: pssoundsector.h:59
This namespace contains a set of functions that are usefull for the processing of music and musical s...
Definition: musicutil.h:215
csArray< psMusic * > musicarray
array of available musics
Definition: pssoundsector.h:56
A Volume and Sound control class.
Definition: control.h:40
csHash< psEntity *, uint > tempEntities
hash of all the temporary psEntites (i.e. associated to a specific mesh)
Definition: pssoundsector.h:60
void AddEntityDefinition(csRef< iDocumentNode > entityNode)
Loads an ENTITY entry from an xml file and generates an entity sound definition.
void DeleteAmbient(psMusic *&ambient)
void SetEntityState(int state, iMeshWrapper *mesh, const char *actorName, bool forceChange)
Sets the new state for the entity associated to the given mesh.
~psSoundSector()
Destructor.
void UpdateMusic(bool loopToggle, int type, SoundControl *&ctrl)
void RemoveObjectEntity(iMeshWrapper *mesh, const char *meshName)
Removes an object entity managed from the sector.
This object represents a planeshift soundEmitter.
Definition: psemitter.h:36
void AddMusic(csRef< iDocumentNode > Node)
csHash< psEntity *, csString > factories
hash of factory entities
Definition: pssoundsector.h:58
void DeleteEmitter(psEmitter *&emitter)
Deletes one emitter from the current array of known emitters.
void DeleteEntity(psEntity *&entity)
void Load(csRef< iDocumentNode > sectorNode)
Loads the sector&#39;s definition from the given node.
void DeleteMusic(psMusic *&music)
This object represents a planeshift entity sound.
Definition: psentity.h:39