# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLSOUND::CEnvSoundUser Class Reference

Implementation of UEnvSound. More...

#include <env_sound_user.h>

Inheritance diagram for NLSOUND::CEnvSoundUser:

NLSOUND::UEnvSound List of all members.

Public Methods

 CEnvSoundUser ()
 Constructor. More...

virtual ~CEnvSoundUser ()
 Destructor. More...

virtual const NLMISC::CVectorgetPos () const
 Return the position. More...

virtual void setPos (const NLMISC::CVector &pos)
 Moves the envsound (and its transition envsound if it has one). More...

virtual void selectEnv (const char *tag, bool children_too=false)
 Select the current env for this node, and for all descendants if children_too is true. More...

virtual std::vector< UEnvSound * > & getChildren ()
 Return the children envsounds. More...

void recompute ()
 Recompute the EnvSound. Call this method after having moved the 3D source (call only on the root env). More...

void update ()
 Update the stereo mixes (call evenly on the root) (recursive). More...

virtual void play (bool children_too=false)
 Play this node, and all descendants if children_too is true. More...

virtual void stop (bool children_too=false)
 Stop playing this node, and all descendants if children_too is true. More...

bool mustPlay () const
 Return the play flag. More...

void setProperties (bool transition, IBoundingShape *bshape)
 Set properties (EDIT) (set a NULL shape for all world). More...

void addChild (CEnvSoundUser *child)
 Add a child (EDIT). More...

void addEnvTag (IPlayable *source, const std::string &tag="")
 Add an environment source/tag (EDIT) (set a NULL source for no source at all). More...

IBoundingShape * getBoundingShape ()
 Return the bounding shape (EDIT). More...

IPlayable * getSource ()
 Return the source (EDIT). More...

CEnvSoundUser * getParent ()
 Return the parent (EDIT). More...


Protected Methods

bool isRoot () const
 Return true if the envsound is the root of the hierarchy tree. More...

void applySourcesMarks ()
CEnvSoundUser * findCurrentEnv (const NLMISC::CVector &listenerpos)
 Find the area where the listener is located (recursive). More...

void markSources (const NLMISC::CVector &listenerpos, float gain)
 Prepare the related sources to play (recursive). More...

uint32 getCount () const
 Count the envs in the tree (call on the root). More...

void playSub (bool children_too=false)
 Play this node, and all descendants if children_too is true, but do not recompute. More...

void stopSub (bool children_too=false)
 Stop playing this node, and all descendants if children_too is true, but do not recompute. More...


Private Attributes

bool _Play
IPlayable * _Source
std::vector< IPlayable * > _SrcBank
std::vector< std::string > _Tags
IBoundingShape * _BoundingShape
bool _Transition
CEnvSoundUser * _Parent
std::vector< CEnvSoundUser * > _Children
bool _Mark
float _Gain

Detailed Description

Implementation of UEnvSound.

An envsound object is a node of an envsound tree, the root of which is returned by CAudioMixerUser::loadEnvSounds() and getEnvSounds(). The root is the world envsound: it has no bounds. The areas of children envsounds have bounds and they must be totally included in the area of their parent envsound.

Here is an example of an envsound tree:

 *                       Root (world envsound)
 *                       /                   \
 *                Transition               Transition
 *                    |                        |
 *                  Cave1                    City
 *                                           /  \
 *                                 Transition    Transition
 *                                     |             |
 *                                  Building1     Building2
 * 

In a transition, the _Source object is the center source played when the listener not in the child area (CSimpleSource). In a non-transition envsound, the _Source object is the ambiant source (CAmbiantSource) which plays a stereo mix.

Author:
Olivier Cado , Nevrax France
Date:
2001

Definition at line 82 of file env_sound_user.h.


Constructor & Destructor Documentation

NLSOUND::CEnvSoundUser::CEnvSoundUser  
 

Constructor.

Definition at line 43 of file env_sound_user.cpp.

Referenced by findCurrentEnv, and recompute.

NLSOUND::CEnvSoundUser::~CEnvSoundUser   [virtual]
 

Destructor.

Definition at line 51 of file env_sound_user.cpp.

References _BoundingShape, _Children, and _SrcBank.


Member Function Documentation

void NLSOUND::CEnvSoundUser::addChild CEnvSoundUser *    child
 

Add a child (EDIT).

Definition at line 588 of file env_sound_user.cpp.

References _Children.

void NLSOUND::CEnvSoundUser::addEnvTag IPlayable *    source,
const std::string &    tag = ""
 

Add an environment source/tag (EDIT) (set a NULL source for no source at all).

The current source always becomes the first one.

Definition at line 487 of file env_sound_user.cpp.

References _Source, _SrcBank, and _Tags.

void NLSOUND::CEnvSoundUser::applySourcesMarks   [protected]
 

Definition at line 452 of file env_sound_user.cpp.

References _Children, _Gain, _Mark, _Play, and _Source.

Referenced by recompute.

CEnvSoundUser * NLSOUND::CEnvSoundUser::findCurrentEnv const NLMISC::CVector   listenerpos [protected]
 

Find the area where the listener is located (recursive).

Definition at line 303 of file env_sound_user.cpp.

References _BoundingShape, _Children, and CEnvSoundUser.

Referenced by recompute.

IBoundingShape* NLSOUND::CEnvSoundUser::getBoundingShape   [inline]
 

Return the bounding shape (EDIT).

Definition at line 136 of file env_sound_user.h.

std::vector< UEnvSound * > & NLSOUND::CEnvSoundUser::getChildren   [virtual]
 

Return the children envsounds.

Implements NLSOUND::UEnvSound.

Definition at line 376 of file env_sound_user.cpp.

uint32 NLSOUND::CEnvSoundUser::getCount   const [protected]
 

Count the envs in the tree (call on the root).

Definition at line 248 of file env_sound_user.cpp.

References _Children.

CEnvSoundUser* NLSOUND::CEnvSoundUser::getParent   [inline]
 

Return the parent (EDIT).

Definition at line 140 of file env_sound_user.h.

virtual const NLMISC::CVector& NLSOUND::CEnvSoundUser::getPos   const [virtual]
 

Return the position.

IPlayable* NLSOUND::CEnvSoundUser::getSource   [inline]
 

Return the source (EDIT).

Definition at line 138 of file env_sound_user.h.

bool NLSOUND::CEnvSoundUser::isRoot   const [inline, protected]
 

Return true if the envsound is the root of the hierarchy tree.

Definition at line 148 of file env_sound_user.h.

References _Parent.

Referenced by recompute.

void NLSOUND::CEnvSoundUser::markSources const NLMISC::CVector   listenerpos,
float    gain
[protected]
 

Prepare the related sources to play (recursive).

In each children branch, there must be an env which is not a transition, for the recursion to stop

Definition at line 408 of file env_sound_user.cpp.

References _BoundingShape, _Children, _Gain, _Mark, _Parent, and nlassert.

bool NLSOUND::CEnvSoundUser::mustPlay   const [inline]
 

Return the play flag.

Definition at line 122 of file env_sound_user.h.

References _Play.

void NLSOUND::CEnvSoundUser::play bool    children_too = false [virtual]
 

Play this node, and all descendants if children_too is true.

Implements NLSOUND::UEnvSound.

Definition at line 516 of file env_sound_user.cpp.

References playSub.

void NLSOUND::CEnvSoundUser::playSub bool    children_too = false [protected]
 

Play this node, and all descendants if children_too is true, but do not recompute.

Definition at line 538 of file env_sound_user.cpp.

References _Children, _Parent, and _Play.

Referenced by play.

void NLSOUND::CEnvSoundUser::recompute  
 

Recompute the EnvSound. Call this method after having moved the 3D source (call only on the root env).

Definition at line 385 of file env_sound_user.cpp.

References applySourcesMarks, CEnvSoundUser, findCurrentEnv, isRoot, and nlassert.

void NLSOUND::CEnvSoundUser::selectEnv const char *    tag,
bool    children_too = false
[virtual]
 

Select the current env for this node, and for all descendants if children_too is true.

Implements NLSOUND::UEnvSound.

Definition at line 190 of file env_sound_user.cpp.

References _Children, _Source, _SrcBank, _Tags, and nldebug.

void NLSOUND::CEnvSoundUser::setPos const NLMISC::CVector   pos [virtual]
 

Moves the envsound (and its transition envsound if it has one).

Implements NLSOUND::UEnvSound.

Definition at line 341 of file env_sound_user.cpp.

References _BoundingShape, and _Parent.

void NLSOUND::CEnvSoundUser::setProperties bool    transition,
IBoundingShape *    bshape
 

Set properties (EDIT) (set a NULL shape for all world).

Definition at line 476 of file env_sound_user.cpp.

References _BoundingShape, and _Transition.

void NLSOUND::CEnvSoundUser::stop bool    children_too = false [virtual]
 

Stop playing this node, and all descendants if children_too is true.

Implements NLSOUND::UEnvSound.

Definition at line 527 of file env_sound_user.cpp.

References stopSub.

void NLSOUND::CEnvSoundUser::stopSub bool    children_too = false [protected]
 

Stop playing this node, and all descendants if children_too is true, but do not recompute.

Definition at line 563 of file env_sound_user.cpp.

References _Children, _Parent, and _Play.

Referenced by stop.

void NLSOUND::CEnvSoundUser::update  
 

Update the stereo mixes (call evenly on the root) (recursive).

Definition at line 286 of file env_sound_user.cpp.

References _Children, and _Source.


Member Data Documentation

IBoundingShape* NLSOUND::CEnvSoundUser::_BoundingShape [private]
 

Definition at line 182 of file env_sound_user.h.

Referenced by findCurrentEnv, markSources, setPos, setProperties, and ~CEnvSoundUser.

std::vector<CEnvSoundUser*> NLSOUND::CEnvSoundUser::_Children [private]
 

Definition at line 189 of file env_sound_user.h.

Referenced by addChild, applySourcesMarks, findCurrentEnv, getCount, markSources, playSub, selectEnv, stopSub, update, and ~CEnvSoundUser.

float NLSOUND::CEnvSoundUser::_Gain [private]
 

Definition at line 193 of file env_sound_user.h.

Referenced by applySourcesMarks, and markSources.

bool NLSOUND::CEnvSoundUser::_Mark [private]
 

Definition at line 192 of file env_sound_user.h.

Referenced by applySourcesMarks, and markSources.

CEnvSoundUser* NLSOUND::CEnvSoundUser::_Parent [private]
 

Definition at line 188 of file env_sound_user.h.

Referenced by isRoot, markSources, playSub, setPos, and stopSub.

bool NLSOUND::CEnvSoundUser::_Play [private]
 

Definition at line 174 of file env_sound_user.h.

Referenced by applySourcesMarks, mustPlay, playSub, and stopSub.

IPlayable* NLSOUND::CEnvSoundUser::_Source [private]
 

Definition at line 177 of file env_sound_user.h.

Referenced by addEnvTag, applySourcesMarks, selectEnv, and update.

std::vector<IPlayable*> NLSOUND::CEnvSoundUser::_SrcBank [private]
 

Definition at line 178 of file env_sound_user.h.

Referenced by addEnvTag, selectEnv, and ~CEnvSoundUser.

std::vector<std::string> NLSOUND::CEnvSoundUser::_Tags [private]
 

Definition at line 179 of file env_sound_user.h.

Referenced by addEnvTag, and selectEnv.

bool NLSOUND::CEnvSoundUser::_Transition [private]
 

Definition at line 185 of file env_sound_user.h.

Referenced by setProperties.


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