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

Implementation of USource. More...

#include <simple_source.h>

Inheritance diagram for NLSOUND::CSimpleSource:

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

Public Methods

 CSimpleSource (CSimpleSound *simpleSound=NULL, bool spawn=false, TSpawnEndCallback cb=0, void *cbUserParam=0)
 Constructor. More...

virtual ~CSimpleSource ()
 Destructor. More...

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

CSimpleSoundgetSimpleSound ()
 Return the simple sound bound to the source (or NULL). 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...

virtual void setPitch (float pitch)
 Shift the frequency. More...

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

CTrackgetTrack ()
 Return the track. More...

TSpawnEndCallback getSpawnEndCallback () const
 Return the spawn end callback. More...

virtual IBuffergetBuffer ()
Playback control
virtual void setLooping (bool l)
 Set looping on/off for future playbacks (default: off). More...

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 NLMISC::TTicks getPlayTime ()
virtual uint32 getTime ()
 Returns the number of milliseconds the source has been playing. More...


Private Methods

virtual void onEvent ()
TSOURCE_TYPE getType () const
 Get the type the the source. More...


Private Attributes

CSimpleSound_Sound
float _Alpha
CTrack_Track
bool _PlayMuted

Detailed Description

Implementation of USource.

Author:
Olivier Cado , Nevrax France
Date:
2001

Definition at line 51 of file simple_source.h.


Constructor & Destructor Documentation

NLSOUND::CSimpleSource::CSimpleSource CSimpleSound   simpleSound = NULL,
bool    spawn = false,
TSpawnEndCallback    cb = 0,
void *    cbUserParam = 0
 

Constructor.

Definition at line 44 of file simple_source.cpp.

References _Alpha, NLSOUND::CSourceCommon::_Direction, NLSOUND::CSourceCommon::_Gain, NLSOUND::CSourceCommon::_InitialGain, NLSOUND::CSourceCommon::_Looping, NLSOUND::CSourceCommon::_Pitch, NLSOUND::CSourceCommon::_Priority, _Sound, nlassert, and NLSOUND::TSpawnEndCallback.

NLSOUND::CSimpleSource::~CSimpleSource   [virtual]
 

Destructor.

Definition at line 64 of file simple_source.cpp.

References stop.


Member Function Documentation

IBuffer * NLSOUND::CSimpleSource::getBuffer   [virtual]
 

Definition at line 86 of file simple_source.cpp.

References _Sound.

virtual NLMISC::TTicks NLSOUND::CSimpleSource::getPlayTime   [inline, virtual]
 

Definition at line 83 of file simple_source.h.

References NLSOUND::CSourceCommon::_PlayStart, and NLMISC::CTime::getLocalTime.

CSimpleSound * NLSOUND::CSimpleSource::getSimpleSound  
 

Return the simple sound bound to the source (or NULL).

Definition at line 70 of file simple_source.cpp.

References _Sound.

virtual TSoundId NLSOUND::CSimpleSource::getSound   [inline, virtual]
 

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

Implements NLSOUND::USource.

Definition at line 68 of file simple_source.h.

References _Sound, and NLSOUND::TSoundId.

TSpawnEndCallback NLSOUND::CSimpleSource::getSpawnEndCallback   const [inline]
 

Return the spawn end callback.

Definition at line 126 of file simple_source.h.

References NLSOUND::CSourceCommon::_SpawnEndCb, and NLSOUND::TSpawnEndCallback.

uint32 NLSOUND::CSimpleSource::getTime   [virtual]
 

Returns the number of milliseconds the source has been playing.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 75 of file simple_source.cpp.

References _Track.

CTrack* NLSOUND::CSimpleSource::getTrack   [inline]
 

Return the track.

Definition at line 124 of file simple_source.h.

References _Track.

TSOURCE_TYPE NLSOUND::CSimpleSource::getType   const [inline, private, virtual]
 

Get the type the the source.

Implements NLSOUND::CSourceCommon.

Definition at line 136 of file simple_source.h.

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

bool NLSOUND::CSimpleSource::isPlaying   [virtual]
 

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

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 355 of file simple_source.cpp.

References NLSOUND::CSourceCommon::_Playing.

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

Implements NLSOUND::CAudioMixerUser::IMixerEvent.

Definition at line 182 of file simple_source.cpp.

References NLSOUND::CSourceCommon::_Playing, _PlayMuted, _Track, nlassert, and stop.

void NLSOUND::CSimpleSource::play   [virtual]
 

Play.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 110 of file simple_source.cpp.

References _Alpha, NLSOUND::CSourceCommon::_CbUserParam, NLSOUND::CSourceCommon::_Direction, NLSOUND::CSourceCommon::_Gain, NLSOUND::CSourceCommon::_Looping, NLSOUND::CSourceCommon::_Pitch, _PlayMuted, NLSOUND::CSourceCommon::_Position, NLSOUND::CSourceCommon::_Priority, NLSOUND::CSourceCommon::_RelativeMode, _Sound, NLSOUND::CSourceCommon::_SpawnEndCb, _Track, NLSOUND::CSourceCommon::_Velocity, NLSOUND::HighestPri, nlassert, play, and setDirection.

Referenced by play.

void NLSOUND::CSimpleSource::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 264 of file simple_source.cpp.

References _Sound, _Track, NLMISC::CVector::isNull, and NLMISC::Pi.

Referenced by play.

void NLSOUND::CSimpleSource::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 300 of file simple_source.cpp.

References _Track.

void NLSOUND::CSimpleSource::setLooping bool    l [virtual]
 

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

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 97 of file simple_source.cpp.

References _Track, and NLAISCRIPT::l.

void NLSOUND::CSimpleSource::setPitch float    pitch [virtual]
 

Shift the frequency.

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

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 326 of file simple_source.cpp.

References _Track.

void NLSOUND::CSimpleSource::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 233 of file simple_source.cpp.

References _Track.

void NLSOUND::CSimpleSource::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 311 of file simple_source.cpp.

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

void NLSOUND::CSimpleSource::setSourceRelativeMode bool    mode [virtual]
 

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

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 341 of file simple_source.cpp.

References _Track.

void NLSOUND::CSimpleSource::setVelocity const NLMISC::CVector   vel [virtual]
 

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

If the source is stereo, return the position vector which reference was passed to set3DPositionVector()

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 248 of file simple_source.cpp.

References _Track.

void NLSOUND::CSimpleSource::stop   [virtual]
 

Stop playing.

Reimplemented from NLSOUND::CSourceCommon.

Definition at line 195 of file simple_source.cpp.

References NLSOUND::CSourceCommon::_CbUserParam, NLSOUND::CSourceCommon::_Playing, NLSOUND::CSourceCommon::_SpawnEndCb, _Track, and nlassert.

Referenced by onEvent, and ~CSimpleSource.


Member Data Documentation

float NLSOUND::CSimpleSource::_Alpha [private]
 

Definition at line 142 of file simple_source.h.

Referenced by CSimpleSource, and play.

bool NLSOUND::CSimpleSource::_PlayMuted [private]
 

Definition at line 147 of file simple_source.h.

Referenced by onEvent, and play.

CSimpleSound* NLSOUND::CSimpleSource::_Sound [private]
 

Definition at line 139 of file simple_source.h.

Referenced by CSimpleSource, getBuffer, getSimpleSound, getSound, play, and setDirection.

CTrack* NLSOUND::CSimpleSource::_Track [private]
 

Definition at line 145 of file simple_source.h.

Referenced by getTime, getTrack, onEvent, play, setDirection, setGain, setLooping, setPitch, setPos, setRelativeGain, setSourceRelativeMode, setVelocity, and stop.


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