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

Implemetation class for background source. More...

#include <background_source.h>

Inheritance diagram for NLSOUND::CBackgroundSource:

NLSOUND::CSourceCommon NLSOUND::CAudioMixerUser::IMixerEvent NLSOUND::CAudioMixerUser::IMixerUpdate NLSOUND::USource List of all members.

Public Methods

 CBackgroundSource (CBackgroundSound *backgroundSource=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam=0)
 Constructor. More...

 ~CBackgroundSource ()
 Destructor. More...

void setSound (TSoundId id, CSoundContext *context=0)
 Change the sound binded to the source. More...

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

virtual void play ()
 Play. More...

virtual void stop ()
 Stop playing. More...

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

void setGain (float gain)
 Set the gain (volume value inside [0 , 1]). More...

void setRelativeGain (float gain)
 Set the gain amount (value inside [0, 1]) to map between 0 and the nominal gain (which is getSource()->getGain()). More...

void setPos (const NLMISC::CVector &pos)
 Set the position vector (default: (0,0,0)). More...

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

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


Private Types

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


Private Methods

bool checkFilter (const UAudioMixer::TBackgroundFlags &filter)
 Check the given filter agains current environnment status, return false is masking. More...

void onUpdate ()
 Mixer update implementation (for fade in/out). More...

void onEvent ()
 Mixer event for env checking. More...


Private Attributes

CBackgroundSound_BackgroundSound
 The sound static data. More...

std::vector< TSubSource_Sources
 The sub sources container. More...

NLMISC::TTime _LastCheck
 Last time we check env variable. More...


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.


Member Enumeration Documentation

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 mask by environnemt status.
SUB_STATUS_FADEOUT  the sub source is being faded out then stop (masked by filter).
SUB_STATUS_FADEIN  The sub source is being faded in, then play (unmasked by filter).

Definition at line 82 of file background_source.h.


Constructor & Destructor Documentation

NLSOUND::CBackgroundSource::CBackgroundSource CBackgroundSound   backgroundSource = NULL,
bool    spawn = false,
TSpawnEndCallback    cb = 0,
void *    cbUserParam = 0
 

Constructor.

Definition at line 40 of file background_source.cpp.

References _BackgroundSound, and NLSOUND::TSpawnEndCallback.

NLSOUND::CBackgroundSource::~CBackgroundSource  
 

Destructor.

Definition at line 46 of file background_source.cpp.

References stop.


Member Function Documentation

bool NLSOUND::CBackgroundSource::checkFilter const UAudioMixer::TBackgroundFlags   filter [private]
 

Check the given filter agains current environnment status, return false is masking.

Definition at line 312 of file background_source.cpp.

Referenced by onEvent, and play.

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 57 of file background_source.cpp.

References NLSOUND::TSoundId.

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

Get the type the the source.

Implements NLSOUND::CSourceCommon.

Definition at line 61 of file background_source.h.

References NLSOUND::CSourceCommon::SOURCE_BACKGROUND, and NLSOUND::CSourceCommon::TSOURCE_TYPE.

void NLSOUND::CBackgroundSource::onEvent   [private, virtual]
 

Mixer event for env checking.

Implements NLSOUND::CAudioMixerUser::IMixerEvent.

Definition at line 246 of file background_source.cpp.

References _LastCheck, NLSOUND::CSourceCommon::_Position, _Sources, checkFilter, NLSOUND::ENV_CHK_INTERVAL, NLMISC::CTime::getLocalTime, SUB_STATUS_FADEIN, SUB_STATUS_FADEOUT, SUB_STATUS_PLAY, SUB_STATUS_STOP, and NLMISC::TTime.

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

Mixer update implementation (for fade in/out).

Implements NLSOUND::CAudioMixerUser::IMixerUpdate.

Definition at line 189 of file background_source.cpp.

References NLSOUND::CSourceCommon::_Gain, _Sources, NLMISC::CTime::getLocalTime, SUB_STATUS_FADEIN, SUB_STATUS_FADEOUT, SUB_STATUS_PLAY, SUB_STATUS_STOP, and NLMISC::TTime.

void NLSOUND::CBackgroundSource::play   [virtual]
 

Play.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 122 of file background_source.cpp.

References _BackgroundSound, NLSOUND::CSourceCommon::_Gain, _LastCheck, NLSOUND::CSourceCommon::_Position, _Sources, checkFilter, NLSOUND::ENV_CHK_INTERVAL, NLMISC::CTime::getLocalTime, stop, SUB_STATUS_PLAY, and SUB_STATUS_STOP.

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 108 of file background_source.cpp.

References _Sources.

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 62 of file background_source.cpp.

References NLSOUND::CSourceCommon::_Gain, and _Sources.

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 85 of file background_source.cpp.

References _Sources.

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 73 of file background_source.cpp.

References NLSOUND::CSourceCommon::_Gain, and _Sources.

void NLSOUND::CBackgroundSource::setSound TSoundId    id,
CSoundContext   context = 0
 

Change the sound binded to the source.

Definition at line 52 of file background_source.cpp.

References id, nlassert, and NLSOUND::TSoundId.

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 97 of file background_source.cpp.

References _Sources.

void NLSOUND::CBackgroundSource::stop   [virtual]
 

Stop playing.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 164 of file background_source.cpp.

References _Sources.

Referenced by play, and ~CBackgroundSource.


Member Data Documentation

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

The sound static data.

Definition at line 112 of file background_source.h.

Referenced by CBackgroundSource, and play.

NLMISC::TTime NLSOUND::CBackgroundSource::_LastCheck [private]
 

Last time we check env variable.

Definition at line 118 of file background_source.h.

Referenced by onEvent, and play.

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

The sub sources container.

Definition at line 115 of file background_source.h.

Referenced by onEvent, onUpdate, play, setDirection, setGain, setPos, setRelativeGain, setVelocity, and stop.


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