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

Implemetation class for Complex source. More...

#include <complex_source.h>

Inheritance diagram for NLSOUND::CComplexSource:

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

Public Methods

 CComplexSource (CComplexSound *soundPattern=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam=0)
 Constructor. More...

 ~CComplexSource ()
 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 setPos (const NLMISC::CVector &pos)
 Set the position vector (default: (0,0,0)). More...

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

virtual 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...

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

virtual 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...

Playback control
virtual void play ()
 Play. More...

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

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

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


Private Methods

TSOURCE_TYPE getType () const
 Get the source relative mode. More...

void onUpdate ()
 Mixer update implementation. More...

void onEvent ()
 Mixer event implementation. More...


Private Attributes

USource_Source1
USource_Source2
std::vector< USource * > _AllSources
NLMISC::TTime _StartTime1
NLMISC::TTime _StartTime2
float _TickPerSecond
uint32 _FadeLength
float _FadeFactor
uint _SoundSeqIndex
uint _DelaySeqIndex
bool _LastSparseEvent
CComplexSound_PatternSound
 The reference Sound. More...


Detailed Description

Implemetation class for Complex source.

Complex source are source that use a CPatternSound object.

Definition at line 41 of file complex_source.h.


Constructor & Destructor Documentation

NLSOUND::CComplexSource::CComplexSource CComplexSound   soundPattern = NULL,
bool    spawn = false,
TSpawnEndCallback    cb = 0,
void *    cbUserParam = 0
 

Constructor.

Definition at line 37 of file complex_source.cpp.

References NLSOUND::CSourceCommon::_Gain, NLSOUND::CSourceCommon::_Looping, _PatternSound, NLSOUND::CSourceCommon::_Pitch, NLSOUND::CSourceCommon::_Priority, _TickPerSecond, nlassert, and NLSOUND::TSpawnEndCallback.

NLSOUND::CComplexSource::~CComplexSource  
 

Destructor.

Definition at line 53 of file complex_source.cpp.

References _AllSources.


Member Function Documentation

TSoundId NLSOUND::CComplexSource::getSound   [virtual]
 

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

Implements NLSOUND::USource.

Definition at line 73 of file complex_source.cpp.

References _PatternSound, and NLSOUND::TSoundId.

uint32 NLSOUND::CComplexSource::getTime   [virtual]
 

Returns the number of milliseconds the source has been playing.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 365 of file complex_source.cpp.

References NLSOUND::CSourceCommon::_Playing, NLSOUND::CSourceCommon::_PlayStart, NLMISC::CTime::getLocalTime, NLMISC::TTime, and uint32.

TSOURCE_TYPE NLSOUND::CComplexSource::getType void    const [inline, private, virtual]
 

Get the source relative mode.

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

Implements NLSOUND::CSourceCommon.

Definition at line 119 of file complex_source.h.

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

bool NLSOUND::CComplexSource::isPlaying   [virtual]
 

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

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 91 of file complex_source.cpp.

References NLSOUND::CSourceCommon::_Playing.

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

Mixer event implementation.

Implements NLSOUND::CAudioMixerUser::IMixerEvent.

Definition at line 493 of file complex_source.cpp.

References _DelaySeqIndex, NLSOUND::CSourceCommon::_Gain, _LastSparseEvent, NLSOUND::CSourceCommon::_Looping, _PatternSound, NLSOUND::CSourceCommon::_Playing, NLSOUND::CSourceCommon::_Position, _SoundSeqIndex, _Source1, _Source2, _StartTime1, _StartTime2, _TickPerSecond, NLMISC::CTime::getLocalTime, nlassert, stop, and uint64.

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

Mixer update implementation.

Implements NLSOUND::CAudioMixerUser::IMixerUpdate.

Definition at line 380 of file complex_source.cpp.

References _FadeFactor, _FadeLength, NLSOUND::CSourceCommon::_Gain, _PatternSound, NLSOUND::CSourceCommon::_Playing, _SoundSeqIndex, _Source1, _Source2, _StartTime1, _StartTime2, _TickPerSecond, NLMISC::CTime::getLocalTime, nlassert, nldebug, NLMISC::TTime, and uint32.

void NLSOUND::CComplexSource::play   [virtual]
 

Play.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 96 of file complex_source.cpp.

References _AllSources, _DelaySeqIndex, _FadeLength, NLSOUND::CSourceCommon::_Gain, _LastSparseEvent, _PatternSound, NLSOUND::CSourceCommon::_Position, _SoundSeqIndex, _Source1, _Source2, _StartTime1, _StartTime2, _TickPerSecond, NLMISC::CTime::getLocalTime, min, nldebug, uint32, uint64, and NLSOUND::USource::USource.

void NLSOUND::CComplexSource::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 294 of file complex_source.cpp.

References _AllSources, _Source1, and _Source2.

void NLSOUND::CComplexSource::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 314 of file complex_source.cpp.

References _AllSources, NLSOUND::CSourceCommon::_Gain, _Source1, and _Source2.

void NLSOUND::CComplexSource::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 259 of file complex_source.cpp.

References _AllSources, _Source1, and _Source2.

void NLSOUND::CComplexSource::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 330 of file complex_source.cpp.

References _AllSources, NLSOUND::CSourceCommon::_Gain, _Source1, and _Source2.

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

Change the sound binded to the source.

Definition at line 69 of file complex_source.cpp.

References id, and NLSOUND::TSoundId.

void NLSOUND::CComplexSource::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 275 of file complex_source.cpp.

References _AllSources, _Source1, and _Source2.

void NLSOUND::CComplexSource::stop   [virtual]
 

Stop playing.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 213 of file complex_source.cpp.

References _AllSources, _PatternSound, _Source1, and _Source2.

Referenced by onEvent.


Member Data Documentation

std::vector<USource *> NLSOUND::CComplexSource::_AllSources [private]
 

Definition at line 129 of file complex_source.h.

Referenced by play, setDirection, setGain, setPos, setRelativeGain, setVelocity, stop, and ~CComplexSource.

uint NLSOUND::CComplexSource::_DelaySeqIndex [private]
 

Definition at line 143 of file complex_source.h.

Referenced by onEvent, and play.

float NLSOUND::CComplexSource::_FadeFactor [private]
 

Definition at line 140 of file complex_source.h.

Referenced by onUpdate.

uint32 NLSOUND::CComplexSource::_FadeLength [private]
 

Definition at line 138 of file complex_source.h.

Referenced by onUpdate, and play.

bool NLSOUND::CComplexSource::_LastSparseEvent [private]
 

Definition at line 145 of file complex_source.h.

Referenced by onEvent, and play.

CComplexSound* NLSOUND::CComplexSource::_PatternSound [private]
 

The reference Sound.

Definition at line 148 of file complex_source.h.

Referenced by CComplexSource, getSound, onEvent, onUpdate, play, and stop.

uint NLSOUND::CComplexSource::_SoundSeqIndex [private]
 

Definition at line 142 of file complex_source.h.

Referenced by onEvent, onUpdate, and play.

USource* NLSOUND::CComplexSource::_Source1 [private]
 

Definition at line 126 of file complex_source.h.

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

USource* NLSOUND::CComplexSource::_Source2 [private]
 

Definition at line 127 of file complex_source.h.

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

NLMISC::TTime NLSOUND::CComplexSource::_StartTime1 [private]
 

Definition at line 134 of file complex_source.h.

Referenced by onEvent, onUpdate, and play.

NLMISC::TTime NLSOUND::CComplexSource::_StartTime2 [private]
 

Definition at line 135 of file complex_source.h.

Referenced by onEvent, onUpdate, and play.

float NLSOUND::CComplexSource::_TickPerSecond [private]
 

Definition at line 137 of file complex_source.h.

Referenced by CComplexSource, onEvent, onUpdate, and play.


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