# 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::CAmbiantSource Class Reference

Stereo mix of a envsound, seen as a source (see CEnvSoundUser). More...

#include <ambiant_source.h>

List of all members.

Public Methods

 CAmbiantSource ()
 Constructor. More...

virtual ~CAmbiantSource ()
 Destructor. More...

virtual void initPos (const NLMISC::CVector *posvector)
 Init. More...

virtual void update ()
 Update. More...

virtual void enable (bool toplay, float gain)
 Enable (play with high priority) and set general gain, or disable (stop and set low priority). More...

CSimpleSourcegetChannels ()
 Return the stereo channels (EDIT). More...

void setProperties (std::vector< TSoundId > &ambiantsounds, std::vector< TSoundId > &sparsesounds, uint32 crossfadeTimeMs=4000, uint32 sustainTimeMs=16000, uint32 sparseAvgPeriodMs=30000)
 Set properties (EDIT). More...


Static Public Methods

void init ()
 Static init (call at the very beginning). More...


Protected Methods

NLMISC::TTime calcPosInCycle (bool &crossfade, uint32 &leadchannel)
 Calc pos in cycle. More...

TSoundId getRandomSound (const std::vector< CSound * > &bank) const
 Select a random sound in a bank. More...

void calcRandomSparseSoundTime (TSoundId currentsparesound)
 Calculate the next time a sparse sound plays (set NULL for no current sound). More...


Private Attributes

bool _Play
CSimpleSource _StereoChannels [MAX_ENV_CHANNELS]
float _StereoGain
std::vector< CSound * > _AmbiantSounds
std::vector< CSound * > _SparseSounds
NLMISC::TTime _StartTime
bool _Sustain
bool _RandomSoundChosen
NLMISC::TTime _NextSparseSoundTime
uint32 _CrossfadeTime
uint32 _SustainTime
uint32 _SparseAvgPeriod


Detailed Description

Stereo mix of a envsound, seen as a source (see CEnvSoundUser).

Plays a stereo mix made up of two channels for crossfading random ambiant sounds, plus a third channel for random sparse sounds.

Author:
Olivier Cado , Nevrax France
Date:
2001

Definition at line 50 of file ambiant_source.h.


Constructor & Destructor Documentation

NLSOUND::CAmbiantSource::CAmbiantSource  
 

Constructor.

Definition at line 47 of file ambiant_source.cpp.

References _StereoChannels, AMBIANT_CH1, and AMBIANT_CH2.

NLSOUND::CAmbiantSource::~CAmbiantSource   [virtual]
 

Destructor.

Definition at line 67 of file ambiant_source.cpp.

References _StereoChannels, AMBIANT_CH1, AMBIANT_CH2, and SPARSE_CH.


Member Function Documentation

TTime NLSOUND::CAmbiantSource::calcPosInCycle bool &    crossfade,
uint32   leadchannel
[protected]
 

Calc pos in cycle.

Definition at line 212 of file ambiant_source.cpp.

References _CrossfadeTime, _SustainTime, and NLMISC::TTime.

Referenced by enable, and update.

void NLSOUND::CAmbiantSource::calcRandomSparseSoundTime TSoundId    currentsparesound [protected]
 

Calculate the next time a sparse sound plays (set NULL for no current sound).

Definition at line 353 of file ambiant_source.cpp.

References _NextSparseSoundTime, _SparseAvgPeriod, nldebug, and NLSOUND::TSoundId.

Referenced by enable, and update.

void NLSOUND::CAmbiantSource::enable bool    toplay,
float    gain
[virtual]
 

Enable (play with high priority) and set general gain, or disable (stop and set low priority).

Definition at line 130 of file ambiant_source.cpp.

References _AmbiantSounds, _Play, _StereoChannels, _StereoGain, AMBIANT_CH1, calcPosInCycle, calcRandomSparseSoundTime, NLSOUND::HighPri, NLSOUND::LowPri, nldebug, and SPARSE_CH.

CSimpleSource* NLSOUND::CAmbiantSource::getChannels   [inline]
 

Return the stereo channels (EDIT).

Definition at line 79 of file ambiant_source.h.

References NLSOUND::TSoundId.

TSoundId NLSOUND::CAmbiantSource::getRandomSound const std::vector< CSound * > &    bank const [protected]
 

Select a random sound in a bank.

Definition at line 336 of file ambiant_source.cpp.

References nlassert, nldebug, r, and NLSOUND::TSoundId.

Referenced by update.

void NLSOUND::CAmbiantSource::init void    [inline, static]
 

Static init (call at the very beginning).

Definition at line 59 of file ambiant_source.h.

virtual void NLSOUND::CAmbiantSource::initPos const NLMISC::CVector   posvector [virtual]
 

Init.

You can pass a position vector to link to (if the playable has stereo source(s)) When reading from a stream, call init() *after* serial().

void NLSOUND::CAmbiantSource::setProperties std::vector< TSoundId > &    ambiantsounds,
std::vector< TSoundId > &    sparsesounds,
uint32    crossfadeTimeMs = 4000,
uint32    sustainTimeMs = 16000,
uint32    sparseAvgPeriodMs = 30000
 

Set properties (EDIT).

Definition at line 406 of file ambiant_source.cpp.

References _AmbiantSounds, _CrossfadeTime, _SparseAvgPeriod, _SparseSounds, and _SustainTime.

void NLSOUND::CAmbiantSource::update   [virtual]
 

Update.

Definition at line 239 of file ambiant_source.cpp.

References _AmbiantSounds, _CrossfadeTime, _NextSparseSoundTime, _Play, _SparseSounds, _StereoChannels, _StereoGain, _Sustain, AMBIANT_CH1, calcPosInCycle, calcRandomSparseSoundTime, getRandomSound, NLSOUND::HighPri, NLSOUND::MidPri, nlassert, nldebug, SPARSE_CH, NLSOUND::TSoundId, and NLMISC::TTime.


Member Data Documentation

std::vector<CSound*> NLSOUND::CAmbiantSource::_AmbiantSounds [private]
 

Definition at line 105 of file ambiant_source.h.

Referenced by enable, setProperties, and update.

uint32 NLSOUND::CAmbiantSource::_CrossfadeTime [private]
 

Definition at line 114 of file ambiant_source.h.

Referenced by calcPosInCycle, setProperties, and update.

NLMISC::TTime NLSOUND::CAmbiantSource::_NextSparseSoundTime [private]
 

Definition at line 111 of file ambiant_source.h.

Referenced by calcRandomSparseSoundTime, and update.

bool NLSOUND::CAmbiantSource::_Play [private]
 

Definition at line 98 of file ambiant_source.h.

Referenced by enable, and update.

bool NLSOUND::CAmbiantSource::_RandomSoundChosen [private]
 

Definition at line 110 of file ambiant_source.h.

uint32 NLSOUND::CAmbiantSource::_SparseAvgPeriod [private]
 

Definition at line 116 of file ambiant_source.h.

Referenced by calcRandomSparseSoundTime, and setProperties.

std::vector<CSound*> NLSOUND::CAmbiantSource::_SparseSounds [private]
 

Definition at line 105 of file ambiant_source.h.

Referenced by setProperties, and update.

NLMISC::TTime NLSOUND::CAmbiantSource::_StartTime [private]
 

Definition at line 108 of file ambiant_source.h.

CSimpleSource NLSOUND::CAmbiantSource::_StereoChannels[MAX_ENV_CHANNELS] [private]
 

Definition at line 101 of file ambiant_source.h.

Referenced by CAmbiantSource, enable, update, and ~CAmbiantSource.

float NLSOUND::CAmbiantSource::_StereoGain [private]
 

Definition at line 102 of file ambiant_source.h.

Referenced by enable, and update.

bool NLSOUND::CAmbiantSource::_Sustain [private]
 

Definition at line 109 of file ambiant_source.h.

Referenced by update.

uint32 NLSOUND::CAmbiantSource::_SustainTime [private]
 

Definition at line 115 of file ambiant_source.h.

Referenced by calcPosInCycle, and setProperties.


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