Planeshift
psemitter.h
Go to the documentation of this file.
1 /*
2  * psemitter.h
3  *
4  * Copyright (C) 2001-2010 Atomic Blue (info@planeshift.it, http://www.planeshift.it)
5  *
6  * Credits : Saul Leite <leite@engineer.com>
7  * Mathias 'AgY' Voeroes <agy@operswithoutlife.net>
8  * and all past and present planeshift coders
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation (version 2 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  *
22  */
23 
24 
25 #ifndef _PSEMITTER_H_
26 #define _PSEMITTER_H_
27 
36 class psEmitter
37 {
38 public:
39  csString resource;
40  float minvol;
41  float maxvol;
42  int fadedelay;
43  float minrange;
44  float maxrange;
45  float probability;
46  csString factory;
47  float factory_prob;
48  bool loop;
49  csVector3 position;
50  csVector3 direction;
51  bool active;
53  int timeofday;
56 
60  psEmitter();
65  ~psEmitter();
72  psEmitter(psEmitter* const &emitter);
79  bool CheckRange(csVector3 listenerPos);
86  bool CheckTimeOfDay(int time);
92  bool Play(SoundControl* &ctrl);
96  void Stop();
102  static void StopCallback(void* object);
103 };
104 
105 #endif /*_PSEMITTER_H_*/
float minvol
vol at maxrange
Definition: psemitter.h:40
csString resource
name of the resource
Definition: psemitter.h:39
csVector3 position
position of the emitter
Definition: psemitter.h:49
float maxrange
range when it should have minvol
Definition: psemitter.h:44
static void StopCallback(void *object)
Callback function for Stop.
void Stop()
Stops this emitter.
bool CheckTimeOfDay(int time)
Check time of day.
bool dopplerEffect
true if the doppler effect must be applied for this emitter
Definition: psemitter.h:52
psEmitter()
Constructor.
A Volume and Sound control class.
Definition: control.h:40
csVector3 direction
direction were emitting to
Definition: psemitter.h:50
bool active
is this emitter active?
Definition: psemitter.h:51
bool loop
true if the sound if the sound has to loop
Definition: psemitter.h:48
float probability
probability that this emitter play the sound
Definition: psemitter.h:45
int fadedelay
how long fading should take in milliseconds
Definition: psemitter.h:42
int timeofdayrange
time when this emitter stops
Definition: psemitter.h:54
This object represents a planeshift soundEmitter.
Definition: psemitter.h:36
~psEmitter()
Destructor Removes our Callback from the Handle if its still playing.
int timeofday
time when this emitter starts playing
Definition: psemitter.h:53
float minrange
range when it should reach maxvol
Definition: psemitter.h:43
SoundHandle * handle
Definition: psemitter.h:55
float factory_prob
probability that this emitter attaches to the factory
Definition: psemitter.h:47
float maxvol
vol at minrange
Definition: psemitter.h:41
bool CheckRange(csVector3 listenerPos)
Check range to the given position.
csString factory
name of the factory this emitter should attach to
Definition: psemitter.h:46
bool Play(SoundControl *&ctrl)
Play this emitter.