NLSOUND::CBackgroundSource Class Reference

#include <background_source.h>

Inheritance diagram for NLSOUND::CBackgroundSource:

NLSOUND::CSourceCommon NLSOUND::CAudioMixerUser::IMixerUpdate NLSOUND::USource NLMISC::CDbgRefCount< IMixerUpdate >

Detailed Description

Implemetation class for background source. Complex source are source that use a CPatternSound object.
Author:
Boris Boucher.

Nevrax

Definition at line 44 of file background_source.h.

Public Types

enum  TSOURCE_TYPE { SOURCE_SIMPLE, SOURCE_COMPLEX, SOURCE_BACKGROUND }

Public Member Functions

 CBackgroundSource (CBackgroundSound *backgroundSound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam=0, NL3D::CCluster *cluster=0)
 Constructor.

virtual void checkup ()
void * getCallbackUserParam (void) const
 return the user param for the user callback

NL3D::CClustergetCluster () const
virtual void getDirection (NLMISC::CVector &dir) const
 Get the direction vector.

virtual float getGain () const
 Get the gain.

bool getLooping () const
 Return the looping state.

virtual float getPitch () const
 Get the pitch.

const NLMISC::CVectorgetPos () const
 Get the position vector (3D mode only).

TSoundPriority getPriority () const
 Return the priority.

float getRelativeGain () const
 Return the relative gain (see setRelativeGain()), or the absolute gain if getSource() is null.

virtual TSoundId getSound ()
 Return the sound binded to the source (or NULL if there is no sound).

virtual bool getSourceRelativeMode () const
 Get the source relative mode.

virtual uint32 getTime ()
 Returns the number of milliseconds the source has been playing.

TSOURCE_TYPE getType () const
 Get the type the the source.

virtual void getVelocity (NLMISC::CVector &vel) const
 Get the velocity vector.

bool isPlaying ()
 Get playing state. Return false even if the source has stopped on its own.

bool isSpawn () const
 Return the spawn state.

virtual void play ()
 Play.

void set3DPositionVector (const NLMISC::CVector *pos)
 Set the position vector to return for a stereo source (default: NULL).

void setDirection (const NLMISC::CVector &dir)
 Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional).

void setGain (float gain)
void setLooping (bool loop)
 Set looping on/off for future playbacks (default: off).

virtual void setPitch (float pitch)
void setPos (const NLMISC::CVector &pos)
void setPriority (TSoundPriority pr)
 Change the priority of the source.

void setRelativeGain (float gain)
void setSourceRelativeMode (bool mode)
 Set the source relative mode. If true, positions are interpreted relative to the listener position (default: false).

void setVelocity (const NLMISC::CVector &vel)
 Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)).

virtual void stop ()
 Stop playing.

virtual void unregisterSpawnCallBack ()
 Tells this source not to call its callbacks when it ends. This is valid for spawned sources only.

void updateFilterValues (const float *filterValues)
 ~CBackgroundSource ()
 Destructor.


Protected Attributes

const NLMISC::CVector_3DPosition
void * _CbUserParam
NL3D::CCluster_Cluster
NLMISC::CVector _Direction
float _Gain
float _InitialGain
 Gain not affected by setRelativeGain and used to compute _Gain.

bool _Looping
float _Pitch
bool _Playing
NLMISC::TTime _PlayStart
NLMISC::CVector _Position
TSoundPriority _Priority
bool _RelativeMode
const bool _Spawn
TSpawnEndCallback _SpawnEndCb
NLMISC::TStringId _UserVarControler
 An optional user var controler.

NLMISC::CVector _Velocity

Private Types

enum  TSubSourceStatus { SUB_STATUS_PLAY, SUB_STATUS_STOP, SUB_STATUS_PLAY_FAIL }
 Sub source possible status. More...


Private Member Functions

void onUpdate ()
 Mixer update.


Private Attributes

CBackgroundSound_BackgroundSound
 The sound static data.

std::vector< TSubSource_Sources
 The sub sources container.


Member Enumeration Documentation

enum NLSOUND::CSourceCommon::TSOURCE_TYPE [inherited]
 

Enumeration values:
SOURCE_SIMPLE 
SOURCE_COMPLEX 
SOURCE_BACKGROUND 

Definition at line 42 of file source_common.h.

00043         {
00044                 SOURCE_SIMPLE,
00045                 SOURCE_COMPLEX,
00046                 SOURCE_BACKGROUND
00047         };

enum NLSOUND::CBackgroundSource::TSubSourceStatus [private]
 

Sub source possible status.

Enumeration values:
SUB_STATUS_PLAY  The sub source is playing.
SUB_STATUS_STOP  The sub source is stopped : it is masked by environnemt status.
SUB_STATUS_PLAY_FAIL  The sub source have fail to play, either because of distance or no available track...

Definition at line 77 of file background_source.h.

00078         {
00080                 SUB_STATUS_PLAY,
00082                 SUB_STATUS_STOP,
00084                 SUB_STATUS_PLAY_FAIL
00085         };


Constructor & Destructor Documentation

NLSOUND::CBackgroundSource::CBackgroundSource CBackgroundSound backgroundSound = NULL,
bool  spawn = false,
TSpawnEndCallback  cb = 0,
void *  cbUserParam = 0,
NL3D::CCluster cluster = 0
 

Constructor.

Definition at line 38 of file background_source.cpp.

References _BackgroundSound, and NLSOUND::TSpawnEndCallback.

00039 :       CSourceCommon(backgroundSound, spawn, cb, cbUserParam, cluster)
00040 {
00041         _BackgroundSound = backgroundSound;
00042 }

NLSOUND::CBackgroundSource::~CBackgroundSource  ) 
 

Destructor.

Definition at line 44 of file background_source.cpp.

References stop().

00045 {
00046         if (_Playing)
00047                 stop();
00048 }


Member Function Documentation

virtual void NLSOUND::CSourceCommon::checkup  )  [inline, virtual, inherited]
 

This method is called from backgroup sound to check if subsound need to be restarted (ie subsound in loop mode).

Reimplemented in NLSOUND::CComplexSource.

Definition at line 103 of file source_common.h.

Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().

00103 {};

void* NLSOUND::CSourceCommon::getCallbackUserParam void   )  const [inline, inherited]
 

return the user param for the user callback

Definition at line 74 of file source_common.h.

References NLSOUND::CSourceCommon::_CbUserParam.

00074 { return _CbUserParam; }

NL3D::CCluster* NLSOUND::CSourceCommon::getCluster  )  const [inline, inherited]
 

Definition at line 98 of file source_common.h.

References NLSOUND::CSourceCommon::_Cluster.

Referenced by NLSOUND::CSimpleSource::getVirtualPos(), and NLSOUND::CAudioMixerUser::update().

00098 { return _Cluster; } 

virtual void NLSOUND::CSourceCommon::getDirection NLMISC::CVector dir  )  const [inline, virtual, inherited]
 

Get the direction vector.

Implements NLSOUND::USource.

Definition at line 80 of file source_common.h.

00080 { dir = _Direction; }

virtual float NLSOUND::CSourceCommon::getGain void   )  const [inline, virtual, inherited]
 

Get the gain.

Implements NLSOUND::USource.

Definition at line 82 of file source_common.h.

Referenced by NLSOUND::CAudioMixerUser::update().

00082 { return _Gain; }

bool NLSOUND::CSourceCommon::getLooping  )  const [virtual, inherited]
 

Return the looping state.

Implements NLSOUND::USource.

Definition at line 99 of file source_common.cpp.

00100 {
00101         return _Looping;
00102 }

virtual float NLSOUND::CSourceCommon::getPitch void   )  const [inline, virtual, inherited]
 

Get the pitch.

Implements NLSOUND::USource.

Definition at line 84 of file source_common.h.

00084 { return _Pitch; }

const NLMISC::CVector & NLSOUND::CSourceCommon::getPos  )  const [virtual, inherited]
 

Get the position vector (3D mode only).

Implements NLSOUND::USource.

Definition at line 141 of file source_common.cpp.

References NLSOUND::CSourceCommon::_3DPosition.

Referenced by NLSOUND::CAudioMixerUser::getFreeTrack(), NLSOUND::CAudioMixerUser::getPlayingSoundsPos(), NLSOUND::CSimpleSource::getVirtualPos(), NLSOUND::CompareSources::operator()(), and NLSOUND::CAudioMixerUser::update().

00142 {
00143         if ( _3DPosition == NULL )
00144         {
00145                 return _Position;
00146         }
00147         else
00148         {
00149                 return *_3DPosition;
00150         }
00151         
00152 }

TSoundPriority NLSOUND::CSourceCommon::getPriority void   )  const [inline, inherited]
 

Return the priority.

Definition at line 59 of file source_common.h.

References NLSOUND::TSoundPriority.

Referenced by NLSOUND::CAudioMixerUser::freeTrack(), NLSOUND::CAudioMixerUser::getFreeTrack(), and NLSOUND::CompareSources::operator()().

00059 { return _Priority; }

float NLSOUND::CSourceCommon::getRelativeGain  )  const [virtual, inherited]
 

Return the relative gain (see setRelativeGain()), or the absolute gain if getSource() is null.

Implements NLSOUND::USource.

Definition at line 205 of file source_common.cpp.

References NLSOUND::CSourceCommon::_InitialGain.

Referenced by NLSOUND::CAudioMixerUser::addUserControledSource(), and NLSOUND::CAudioMixerUser::update().

00206 {
00207         if (_InitialGain == 0.0f)
00208                 return 0.0f;
00209         else
00210                 return _Gain / _InitialGain;
00211 }

TSoundId NLSOUND::CBackgroundSource::getSound  )  [virtual]
 

Return the sound binded to the source (or NULL if there is no sound).

Implements NLSOUND::USource.

Definition at line 50 of file background_source.cpp.

References NLSOUND::TSoundId.

00051 {
00052         return NULL;
00053 }

virtual bool NLSOUND::CSourceCommon::getSourceRelativeMode  )  const [inline, virtual, inherited]
 

Get the source relative mode.

Implements NLSOUND::USource.

Definition at line 86 of file source_common.h.

References NLSOUND::CSourceCommon::_RelativeMode.

00086 { return _RelativeMode; }

uint32 NLSOUND::CSourceCommon::getTime  )  [virtual, inherited]
 

Returns the number of milliseconds the source has been playing.

Implements NLSOUND::USource.

Reimplemented in NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.

Definition at line 222 of file source_common.cpp.

References NLSOUND::CSourceCommon::_PlayStart, and uint32.

00223 {
00224         if (!_Playing)
00225                 return 0;
00226         // default implementation
00227         return uint32(CTime::getLocalTime() - _PlayStart);
00228 }

TSOURCE_TYPE NLSOUND::CBackgroundSource::getType  )  const [inline, virtual]
 

Get the type the the source.

Implements NLSOUND::CSourceCommon.

Definition at line 59 of file background_source.h.

00059 {return SOURCE_BACKGROUND;}

virtual void NLSOUND::CSourceCommon::getVelocity NLMISC::CVector vel  )  const [inline, virtual, inherited]
 

Get the velocity vector.

Implements NLSOUND::USource.

Definition at line 78 of file source_common.h.

References NLSOUND::CSourceCommon::_Velocity.

00078 { vel = _Velocity; }

bool NLSOUND::CSourceCommon::isPlaying  )  [inline, virtual, inherited]
 

Get playing state. Return false even if the source has stopped on its own.

Implements NLSOUND::USource.

Reimplemented in NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.

Definition at line 64 of file source_common.h.

Referenced by NLSOUND::CAudioMixerUser::reset(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().

00064 { return _Playing; }

bool NLSOUND::CSourceCommon::isSpawn  )  const [inline, inherited]
 

Return the spawn state.

Definition at line 90 of file source_common.h.

00090 { return _Spawn; }

void NLSOUND::CBackgroundSource::onUpdate  )  [private, virtual]
 

Mixer update.

Implements NLSOUND::CAudioMixerUser::IMixerUpdate.

Definition at line 222 of file background_source.cpp.

References NLSOUND::USource::isPlaying(), NLSOUND::USource::play(), NLSOUND::CBackgroundSource::TSubSource::Source, NLSOUND::CBackgroundSource::TSubSource::Status, SUB_STATUS_PLAY, and SUB_STATUS_PLAY_FAIL.

00223 {
00224         bool needUpdate = false;
00225         // Some sub source are distance clipped, so retry to start them.
00226         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00227         for (; first != last; ++first)
00228         {
00229                 TSubSource &ss = *first;
00230                 if (ss.Status == SUB_STATUS_PLAY_FAIL)
00231                 {
00232                         ss.Source->play();
00233                         // some sub sound can be too far from the listener, 
00234                         // we must handle this in order to start them when the listener
00235                         // is closer
00236                         ss.Status = ss.Source->isPlaying() ? SUB_STATUS_PLAY : SUB_STATUS_PLAY_FAIL;
00237 
00238                         needUpdate |= (ss.Status == SUB_STATUS_PLAY_FAIL);
00239                 }
00240         }
00241 
00242         // no more update needed ?
00243         if (!needUpdate)
00244                 CAudioMixerUser::instance()->unregisterUpdate(this);
00245 }

void NLSOUND::CBackgroundSource::play  )  [virtual]
 

Play.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 119 of file background_source.cpp.

References _BackgroundSound, NLSOUND::CAudioMixerUser::createSource(), NLSOUND::CBackgroundSource::TSubSource::Filter, NLSOUND::CAudioMixerUser::getBackgroundSoundManager(), NLSOUND::CBackgroundSoundManager::getFilterValues(), NLSOUND::CBackgroundSound::getSounds(), NLSOUND::USource::setPriority(), NLSOUND::CBackgroundSource::TSubSource::Source, NLSOUND::CBackgroundSource::TSubSource::Status, stop(), SUB_STATUS_STOP, and updateFilterValues().

00120 {
00121         if (_Playing)
00122                 stop();
00123 
00124         CAudioMixerUser *mixer = CAudioMixerUser::instance();
00125                 
00126         const vector<CBackgroundSound::TSoundInfo> &sounds = _BackgroundSound->getSounds();
00127         vector<CBackgroundSound::TSoundInfo>::const_iterator first(sounds.begin()), last(sounds.end());
00128 
00129         for (; first != last; ++first)
00130         {
00131                 TSubSource subSource;
00132                 subSource.Source = mixer->createSource(first->SoundName, false, 0, 0, _Cluster, 0);
00133                 if (subSource.Source != NULL)
00134                         subSource.Source->setPriority(_Priority);
00135                 subSource.Filter = first->Filter;
00136                 subSource.Status = SUB_STATUS_STOP;
00137                 _Sources.push_back(subSource);
00138         }
00139 
00140         updateFilterValues(mixer->getBackgroundSoundManager()->getFilterValues());
00141 
00142         CSourceCommon::play();
00143 }

void NLSOUND::CSourceCommon::set3DPositionVector const NLMISC::CVector pos  )  [inline, inherited]
 

Set the position vector to return for a stereo source (default: NULL).

Definition at line 88 of file source_common.h.

References NLSOUND::CSourceCommon::_3DPosition.

Referenced by NLSOUND::CAudioMixerUser::createSource(), and NLSOUND::CAmbiantSource::initPos().

00088 { _3DPosition = pos; }

void NLSOUND::CBackgroundSource::setDirection const NLMISC::CVector dir  )  [virtual]
 

Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional).

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 105 of file background_source.cpp.

00106 {
00107         CSourceCommon::setDirection(dir);
00108 
00109         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00110         for (; first != last; ++first)
00111         {
00112                 if (first->Source != 0)
00113                         first->Source->setDirection(dir);
00114         }
00115 }

void NLSOUND::CBackgroundSource::setGain float  gain  )  [virtual]
 

Set the gain (volume value inside [0 , 1]). (default: 1) 0.0 -> silence 0.5 -> -6dB 1.0 -> no attenuation values > 1 (amplification) not supported by most drivers

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 55 of file background_source.cpp.

00056 {
00057         CSourceCommon::setGain(gain);
00058 
00059         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00060         for (; first != last; ++first)
00061         {
00062                 if (first->Source != 0)
00063                 {
00064                         first->Source->setGain(first->Source->getSound()->getGain() * gain);
00065                         first->Source->setRelativeGain(_Gain);
00066                 }
00067 //                      first->Source->setRelativeGain(_Gain);
00068         }
00069 }

void NLSOUND::CSourceCommon::setLooping bool  loop  )  [virtual, inherited]
 

Set looping on/off for future playbacks (default: off).

Implements NLSOUND::USource.

Reimplemented in NLSOUND::CSimpleSource.

Definition at line 91 of file source_common.cpp.

00092 {
00093         _Looping = l;
00094 }

void NLSOUND::CSourceCommon::setPitch float  pitch  )  [virtual, inherited]
 

Shift the frequency. 1.0f equals identity, each reduction of 50% equals a pitch shift of one octave. 0 is not a legal value.

Implements NLSOUND::USource.

Reimplemented in NLSOUND::CSimpleSource.

Definition at line 157 of file source_common.cpp.

Referenced by NLSOUND::CAudioMixerUser::addUserControledSource().

00158 {
00159 //      nlassert( (pitch > 0) && (pitch <= 1.0f ) );
00160         _Pitch = pitch;
00161 }

void NLSOUND::CBackgroundSource::setPos const NLMISC::CVector pos  )  [virtual]
 

Set the position vector (default: (0,0,0)). 3D mode -> 3D position st mode -> x is the pan value (from left (-1) to right (1)), set y and z to 0

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 82 of file background_source.cpp.

00083 {
00084         CSourceCommon::setPos(pos);
00085 
00086         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00087         for (; first != last; ++first)
00088         {
00089                 if (first->Source != 0)
00090                         first->Source->setPos(pos);
00091         }
00092 }

void NLSOUND::CSourceCommon::setPriority TSoundPriority  pr  )  [virtual, inherited]
 

Change the priority of the source.

Implements NLSOUND::USource.

Definition at line 76 of file source_common.cpp.

Referenced by NLSOUND::CAmbiantSource::enable(), NLSOUND::CAmbiantSource::initPos(), and NLSOUND::CAmbiantSource::update().

00077 {
00078         _Priority = pr;
00079 
00080         // The AudioMixer redispatches as necessary in the update() function [PH]
00081         // Redispatch the tracks if needed
00082         //if ( redispatch )
00083         //{
00084         //      CAudioMixerUser::instance()->balanceSources();
00085         //}
00086 }

void NLSOUND::CBackgroundSource::setRelativeGain float  gain  )  [virtual]
 

Set the gain amount (value inside [0, 1]) to map between 0 and the nominal gain (which is getSource()->getGain()). Does nothing if getSource() is null.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 70 of file background_source.cpp.

00071 {
00072         CSourceCommon::setRelativeGain(gain);
00073 
00074         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00075         for (; first != last; ++first)
00076         {
00077                 if (first->Source != 0)
00078                         first->Source->setRelativeGain(_Gain);
00079         }
00080 }

void NLSOUND::CSourceCommon::setSourceRelativeMode bool  mode  )  [virtual, inherited]
 

Set the source relative mode. If true, positions are interpreted relative to the listener position (default: false).

Implements NLSOUND::USource.

Reimplemented in NLSOUND::CSimpleSource.

Definition at line 216 of file source_common.cpp.

References NLSOUND::CSourceCommon::_RelativeMode.

00217 {
00218         _RelativeMode = mode;
00219 }

void NLSOUND::CBackgroundSource::setVelocity const NLMISC::CVector vel  )  [virtual]
 

Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)).

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 94 of file background_source.cpp.

00095 {
00096         CSourceCommon::setVelocity(vel);
00097 
00098         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00099         for (; first != last; ++first)
00100         {
00101                 if (first->Source != 0)
00102                         first->Source->setVelocity(vel);
00103         }
00104 }

void NLSOUND::CBackgroundSource::stop  )  [virtual]
 

Stop playing.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 145 of file background_source.cpp.

References NLSOUND::CBackgroundSource::TSubSource::Source.

Referenced by play(), and ~CBackgroundSource().

00146 {
00147         if (_Playing)
00148         {
00149                 while (!_Sources.empty())
00150                 {
00151                         TSubSource &subSource = _Sources.back();
00152                         if (subSource.Source != NULL)
00153                         {
00154                                 delete subSource.Source;
00155                         }
00156                         _Sources.pop_back();
00157                 }
00158         }
00159 
00160         CSourceCommon::stop();
00161 
00162         CAudioMixerUser::instance()->unregisterUpdate(this);
00163 }

virtual void NLSOUND::CSourceCommon::unregisterSpawnCallBack  )  [inline, virtual, inherited]
 

Tells this source not to call its callbacks when it ends. This is valid for spawned sources only.

Implements NLSOUND::USource.

Definition at line 76 of file source_common.h.

References NLSOUND::CSourceCommon::_SpawnEndCb.

00076 { _SpawnEndCb = NULL; }

void NLSOUND::CBackgroundSource::updateFilterValues const float *  filterValues  ) 
 

Definition at line 165 of file background_source.cpp.

References NLSOUND::CBackgroundSource::TSubSource::Filter, NLSOUND::UAudioMixer::TBackgroundFlags::Flags, NLSOUND::CSound::getGain(), NLSOUND::CSound::getPitch(), NLSOUND::USource::getSound(), NLSOUND::USource::isPlaying(), NLSOUND::USource::play(), NLSOUND::USource::setGain(), NLSOUND::USource::setPitch(), NLSOUND::USource::setPos(), NLSOUND::USource::setRelativeGain(), NLSOUND::CBackgroundSource::TSubSource::Source, NLSOUND::CBackgroundSource::TSubSource::Status, NLSOUND::USource::stop(), SUB_STATUS_PLAY, SUB_STATUS_PLAY_FAIL, SUB_STATUS_STOP, and uint.

Referenced by play().

00166 {
00167         bool needUpdate = false;
00168         std::vector<TSubSource>::iterator first(_Sources.begin()), last(_Sources.end());
00169         for (; first != last; ++first)
00170         {
00171                 TSubSource &ss = *first;
00172                 if (ss.Source != 0)
00173                 {
00174                         float gain = 1.0f;
00175                         for (uint i=0; i<UAudioMixer::TBackgroundFlags::NB_BACKGROUND_FLAGS; ++i)
00176                         {
00177                                 if (ss.Filter.Flags[i])
00178                                 {
00179                                         // this filter is used
00180                                         gain *= filterValues[i];
00181                                 }
00182                         }
00183 
00184                         if (gain == 0 && ss.Status != SUB_STATUS_STOP)
00185                         {
00186                                 // need to completely stop the sound
00187                                 if (ss.Source->isPlaying())
00188                                         ss.Source->stop();
00189                                 ss.Status = SUB_STATUS_STOP;
00190                         }
00191                         else if (gain > 0 && ss.Status != SUB_STATUS_PLAY)
00192                         {
00193                                 // need to restard the sound
00194 //                              ss.Source->setRelativeGain(gain * _Gain);
00195                                 ss.Source->setGain(ss.Source->getSound()->getGain() * gain);
00196                                 ss.Source->setRelativeGain(_Gain);
00197                                 ss.Source->setPitch(ss.Source->getSound()->getPitch() * _Pitch);
00198                                 ss.Source->setPos(_Position);
00199                                 ss.Source->play();
00200                                 // some sub sound can be too far from the listener, 
00201                                 // we must handle this in order to start them when the listener
00202                                 // is closer
00203                                 ss.Status = ss.Source->isPlaying() ? SUB_STATUS_PLAY : SUB_STATUS_PLAY_FAIL;
00204 
00205                                 needUpdate |= (ss.Status == SUB_STATUS_PLAY_FAIL);
00206                         }
00207                         else //if (ss.Status == SUB_STATUS_PLAY)
00208                         {
00209                                 // just update the gain
00210                                 ss.Source->setGain(ss.Source->getSound()->getGain() * gain);
00211                                 ss.Source->setRelativeGain(_Gain);
00212                         }
00213                 }
00214         }
00215 
00216         // if some some sub sound fail to play...
00217         if (needUpdate)
00218                 CAudioMixerUser::instance()->registerUpdate(this);
00219 
00220 }


Field Documentation

const NLMISC::CVector* NLSOUND::CSourceCommon::_3DPosition [protected, inherited]
 

Definition at line 125 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::getPos(), and NLSOUND::CSourceCommon::set3DPositionVector().

CBackgroundSound* NLSOUND::CBackgroundSource::_BackgroundSound [private]
 

The sound static data.

Definition at line 99 of file background_source.h.

Referenced by CBackgroundSource(), and play().

void* NLSOUND::CSourceCommon::_CbUserParam [protected, inherited]
 

Definition at line 130 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::getCallbackUserParam().

NL3D::CCluster* NLSOUND::CSourceCommon::_Cluster [protected, inherited]
 

Definition at line 131 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::getCluster().

NLMISC::CVector NLSOUND::CSourceCommon::_Direction [protected, inherited]
 

Definition at line 113 of file source_common.h.

float NLSOUND::CSourceCommon::_Gain [protected, inherited]
 

Definition at line 114 of file source_common.h.

float NLSOUND::CSourceCommon::_InitialGain [protected, inherited]
 

Gain not affected by setRelativeGain and used to compute _Gain.

Definition at line 119 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::CSourceCommon(), NLSOUND::CSourceCommon::getRelativeGain(), NLSOUND::CSourceCommon::setGain(), and NLSOUND::CSourceCommon::setRelativeGain().

bool NLSOUND::CSourceCommon::_Looping [protected, inherited]
 

Definition at line 109 of file source_common.h.

float NLSOUND::CSourceCommon::_Pitch [protected, inherited]
 

Definition at line 115 of file source_common.h.

bool NLSOUND::CSourceCommon::_Playing [protected, inherited]
 

Definition at line 108 of file source_common.h.

NLMISC::TTime NLSOUND::CSourceCommon::_PlayStart [protected, inherited]
 

Definition at line 122 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::getTime(), and NLSOUND::CSourceCommon::play().

NLMISC::CVector NLSOUND::CSourceCommon::_Position [protected, inherited]
 

Definition at line 111 of file source_common.h.

TSoundPriority NLSOUND::CSourceCommon::_Priority [protected, inherited]
 

Definition at line 107 of file source_common.h.

bool NLSOUND::CSourceCommon::_RelativeMode [protected, inherited]
 

Definition at line 116 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::getSourceRelativeMode(), and NLSOUND::CSourceCommon::setSourceRelativeMode().

std::vector<TSubSource> NLSOUND::CBackgroundSource::_Sources [private]
 

The sub sources container.

Definition at line 102 of file background_source.h.

const bool NLSOUND::CSourceCommon::_Spawn [protected, inherited]
 

Definition at line 128 of file source_common.h.

TSpawnEndCallback NLSOUND::CSourceCommon::_SpawnEndCb [protected, inherited]
 

Definition at line 129 of file source_common.h.

Referenced by NLSOUND::CSimpleSource::play(), NLSOUND::CSimpleSource::stop(), and NLSOUND::CSourceCommon::unregisterSpawnCallBack().

NLMISC::TStringId NLSOUND::CSourceCommon::_UserVarControler [protected, inherited]
 

An optional user var controler.

Definition at line 134 of file source_common.h.

NLMISC::CVector NLSOUND::CSourceCommon::_Velocity [protected, inherited]
 

Definition at line 112 of file source_common.h.

Referenced by NLSOUND::CSourceCommon::getVelocity(), and NLSOUND::CSourceCommon::setVelocity().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 14:33:21 2004 for NeL by doxygen 1.3.6