Planeshift
psEmitter Class Reference

This object represents a planeshift soundEmitter. More...

#include <psemitter.h>

Public Member Functions

bool CheckRange (csVector3 listenerPos)
 Check range to the given position. More...
 
bool CheckTimeOfDay (int time)
 Check time of day. More...
 
bool Play (SoundControl *&ctrl)
 Play this emitter. More...
 
 psEmitter ()
 Constructor. More...
 
 psEmitter (psEmitter *const &emitter)
 Copy Constructor copies resource volume range and time parameters everything else remains uninitialized! More...
 
void Stop ()
 Stops this emitter. More...
 
 ~psEmitter ()
 Destructor Removes our Callback from the Handle if its still playing. More...
 

Static Public Member Functions

static void StopCallback (void *object)
 Callback function for Stop. More...
 

Public Attributes

bool active
 is this emitter active? More...
 
csVector3 direction
 direction were emitting to More...
 
bool dopplerEffect
 true if the doppler effect must be applied for this emitter More...
 
csString factory
 name of the factory this emitter should attach to More...
 
float factory_prob
 probability that this emitter attaches to the factory More...
 
int fadedelay
 how long fading should take in milliseconds More...
 
SoundHandlehandle
 
bool loop
 true if the sound if the sound has to loop More...
 
float maxrange
 range when it should have minvol More...
 
float maxvol
 vol at minrange More...
 
float minrange
 range when it should reach maxvol More...
 
float minvol
 vol at maxrange More...
 
csVector3 position
 position of the emitter More...
 
float probability
 probability that this emitter play the sound More...
 
csString resource
 name of the resource More...
 
int timeofday
 time when this emitter starts playing More...
 
int timeofdayrange
 time when this emitter stops More...
 

Detailed Description

This object represents a planeshift soundEmitter.

Everything is in this object public and you can modify it at any time. Make sure that you call Stop and Play after doing that. Keep in mind that you have to be carefull when changing the SoundHandle and its "active" status.

Definition at line 36 of file psemitter.h.

Constructor & Destructor Documentation

psEmitter::psEmitter ( )

Constructor.

psEmitter::~psEmitter ( )

Destructor Removes our Callback from the Handle if its still playing.

psEmitter::psEmitter ( psEmitter *const &  emitter)

Copy Constructor copies resource volume range and time parameters everything else remains uninitialized!

Parameters
emittera existing emitter

Member Function Documentation

bool psEmitter::CheckRange ( csVector3  listenerPos)

Check range to the given position.

Calculates the distance to the given position and returns true if this emitter is in range.

Parameters
listenerPosposition used for calculation
bool psEmitter::CheckTimeOfDay ( int  time)

Check time of day.

Checks if time is within this emitters timewindow. Returns true if it is.

Parameters
time<24 && >0 is resonable but can be any valid int
bool psEmitter::Play ( SoundControl *&  ctrl)

Play this emitter.

Makes this emitter play - you need to provide a SoundControl.

Parameters
ctrlSoundControl for this emitter
void psEmitter::Stop ( )

Stops this emitter.

static void psEmitter::StopCallback ( void *  object)
static

Callback function for Stop.

SoundHandles callback will point to this and inform us if it gets destroyed. It sets active to false and Handle to NULL

Member Data Documentation

bool psEmitter::active

is this emitter active?

Definition at line 51 of file psemitter.h.

csVector3 psEmitter::direction

direction were emitting to

Definition at line 50 of file psemitter.h.

bool psEmitter::dopplerEffect

true if the doppler effect must be applied for this emitter

Definition at line 52 of file psemitter.h.

csString psEmitter::factory

name of the factory this emitter should attach to

Definition at line 46 of file psemitter.h.

float psEmitter::factory_prob

probability that this emitter attaches to the factory

Definition at line 47 of file psemitter.h.

int psEmitter::fadedelay

how long fading should take in milliseconds

Definition at line 42 of file psemitter.h.

SoundHandle* psEmitter::handle
See also
SoundHandle if it is active

Definition at line 55 of file psemitter.h.

bool psEmitter::loop

true if the sound if the sound has to loop

Definition at line 48 of file psemitter.h.

float psEmitter::maxrange

range when it should have minvol

Definition at line 44 of file psemitter.h.

float psEmitter::maxvol

vol at minrange

Definition at line 41 of file psemitter.h.

float psEmitter::minrange

range when it should reach maxvol

Definition at line 43 of file psemitter.h.

float psEmitter::minvol

vol at maxrange

Definition at line 40 of file psemitter.h.

csVector3 psEmitter::position

position of the emitter

Definition at line 49 of file psemitter.h.

float psEmitter::probability

probability that this emitter play the sound

Definition at line 45 of file psemitter.h.

csString psEmitter::resource

name of the resource

Definition at line 39 of file psemitter.h.

int psEmitter::timeofday

time when this emitter starts playing

Definition at line 53 of file psemitter.h.

int psEmitter::timeofdayrange

time when this emitter stops

Definition at line 54 of file psemitter.h.


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