#include <source_common.h>
Inherits NLSOUND::USource.
Inherited by NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, NLSOUND::CMusicSource, and NLSOUND::CSimpleSource.
Public Types | |
| enum | TSOURCE_TYPE { SOURCE_SIMPLE, SOURCE_COMPLEX, SOURCE_BACKGROUND, SOURCE_MUSIC } |
Public Member Functions | |
| CSourceCommon (TSoundId id, bool spawn, TSpawnEndCallback cb, void *cbUserParam, NL3D::CCluster *cluster) | |
| ~CSourceCommon () | |
| virtual TSOURCE_TYPE | getType () const =0 |
| Get the type the the source. | |
| void | setPriority (TSoundPriority pr) |
| Change the priority of the source. | |
| TSoundPriority | getPriority () const |
| Return the priority. | |
| void | setLooping (bool loop) |
| Set looping on/off for future playbacks (default: off). | |
| bool | getLooping () const |
| Return the looping state. | |
| void | play () |
| Play. | |
| void | stop () |
| Stop playing. | |
| bool | isPlaying () |
| Get playing state. Return false even if the source has stopped on its own. | |
| void | setPos (const NLMISC::CVector &pos) |
| Set the position vector (default: (0,0,0)). | |
| const NLMISC::CVector & | getPos () const |
| Get the position vector (3D mode only). | |
| void | setVelocity (const NLMISC::CVector &vel) |
| Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)). | |
| 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) |
| Set the gain (volume value inside [0 , 1]). | |
| void | setRelativeGain (float gain) |
| Set the gain amount (value inside [0, 1]) to map between 0 and the nominal gain (which is getSource()->getGain()). | |
| float | getRelativeGain () const |
| Return the relative gain (see setRelativeGain()), or the absolute gain if getSource() is null. | |
| void | setSourceRelativeMode (bool mode) |
| Set the source relative mode. If true, positions are interpreted relative to the listener position (default: false). | |
| void * | getCallbackUserParam (void) const |
| return the user param for the user callback | |
| virtual void | unregisterSpawnCallBack () |
| Tells this source not to call its callbacks when it ends. This is valid for spawned sources only. | |
| virtual void | getVelocity (NLMISC::CVector &vel) const |
| Get the velocity vector. | |
| virtual void | getDirection (NLMISC::CVector &dir) const |
| Get the direction vector. | |
| virtual float | getGain () const |
| Get the gain. | |
| virtual float | getPitch () const |
| Get the pitch. | |
| virtual bool | getSourceRelativeMode () const |
| Get the source relative mode. | |
| void | set3DPositionVector (const NLMISC::CVector *pos) |
| Set the position vector to return for a stereo source (default: NULL). | |
| bool | isSpawn () const |
| Return the spawn state. | |
| virtual void | setPitch (float pitch) |
| Shift the frequency. | |
| virtual uint32 | getTime () |
| Returns the number of milliseconds the source has been playing. | |
| NL3D::CCluster * | getCluster () const |
| virtual void | checkup () |
| This method is called from backgroup sound to check if subsound need to be restarted (ie subsound in loop mode). | |
Protected Attributes | |
| TSoundPriority | _Priority |
| bool | _Playing |
| bool | _Looping |
| NLMISC::CVector | _Position |
| NLMISC::CVector | _Velocity |
| NLMISC::CVector | _Direction |
| float | _Gain |
| float | _Pitch |
| bool | _RelativeMode |
| float | _InitialGain |
| Gain not affected by setRelativeGain and used to compute _Gain. | |
| NLMISC::TTime | _PlayStart |
| const NLMISC::CVector * | _3DPosition |
| const bool | _Spawn |
| TSpawnEndCallback | _SpawnEndCb |
| void * | _CbUserParam |
| NL3D::CCluster * | _Cluster |
| NLMISC::TStringId | _UserVarControler |
| An optional user var controler. | |
Friends | |
| class | CAudioMixerUser |
Definition at line 35 of file source_common.h.
Definition at line 40 of file source_common.h.
| NLSOUND::CSourceCommon::CSourceCommon | ( | TSoundId | id, | |
| bool | spawn, | |||
| TSpawnEndCallback | cb, | |||
| void * | cbUserParam, | |||
| NL3D::CCluster * | cluster | |||
| ) |
Definition at line 35 of file source_common.cpp.
References _Direction, _Gain, _InitialGain, _Looping, _Pitch, _Priority, NLSOUND::CAudioMixerUser::addSource(), and NLSOUND::CAudioMixerUser::instance().
| NLSOUND::CSourceCommon::~CSourceCommon | ( | ) |
Definition at line 65 of file source_common.cpp.
References NLSOUND::CAudioMixerUser::instance(), and NLSOUND::CAudioMixerUser::removeSource().
| virtual void NLSOUND::CSourceCommon::checkup | ( | ) | [inline, virtual] |
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 102 of file source_common.h.
Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
| void* NLSOUND::CSourceCommon::getCallbackUserParam | ( | void | ) | const [inline] |
return the user param for the user callback
Definition at line 73 of file source_common.h.
References _CbUserParam.
| NL3D::CCluster* NLSOUND::CSourceCommon::getCluster | ( | ) | const [inline] |
Definition at line 97 of file source_common.h.
References _Cluster.
Referenced by NLSOUND::CSimpleSource::getVirtualPos(), and NLSOUND::CAudioMixerUser::update().
| virtual void NLSOUND::CSourceCommon::getDirection | ( | NLMISC::CVector & | dir | ) | const [inline, virtual] |
Get the direction vector.
Implements NLSOUND::USource.
Definition at line 79 of file source_common.h.
References _Direction.
| virtual float NLSOUND::CSourceCommon::getGain | ( | void | ) | const [inline, virtual] |
Get the gain.
Implements NLSOUND::USource.
Definition at line 81 of file source_common.h.
References _Gain.
Referenced by NLSOUND::CAudioMixerUser::update().
| bool NLSOUND::CSourceCommon::getLooping | ( | ) | const [virtual] |
Return the looping state.
Implements NLSOUND::USource.
Definition at line 97 of file source_common.cpp.
References _Looping.
| virtual float NLSOUND::CSourceCommon::getPitch | ( | void | ) | const [inline, virtual] |
Get the pitch.
Implements NLSOUND::USource.
Definition at line 83 of file source_common.h.
References _Pitch.
| const NLMISC::CVector & NLSOUND::CSourceCommon::getPos | ( | ) | const [virtual] |
Get the position vector (3D mode only).
Implements NLSOUND::USource.
Definition at line 139 of file source_common.cpp.
References _3DPosition, and _Position.
Referenced by NLSOUND::CAudioMixerUser::getFreeTrack(), NLSOUND::CSimpleSource::getVirtualPos(), NLSOUND::CompareSources::operator()(), and NLSOUND::CAudioMixerUser::update().
| TSoundPriority NLSOUND::CSourceCommon::getPriority | ( | void | ) | const [inline] |
Return the priority.
Definition at line 58 of file source_common.h.
References _Priority.
Referenced by NLSOUND::CAudioMixerUser::freeTrack(), NLSOUND::CAudioMixerUser::getFreeTrack(), and NLSOUND::CompareSources::operator()().
| float NLSOUND::CSourceCommon::getRelativeGain | ( | ) | const [virtual] |
Return the relative gain (see setRelativeGain()), or the absolute gain if getSource() is null.
Implements NLSOUND::USource.
Definition at line 203 of file source_common.cpp.
References _Gain, and _InitialGain.
Referenced by NLSOUND::CAudioMixerUser::addUserControledSource(), and NLSOUND::CAudioMixerUser::update().
| virtual bool NLSOUND::CSourceCommon::getSourceRelativeMode | ( | ) | const [inline, virtual] |
Get the source relative mode.
Implements NLSOUND::USource.
Definition at line 85 of file source_common.h.
References _RelativeMode.
| uint32 NLSOUND::CSourceCommon::getTime | ( | ) | [virtual] |
Returns the number of milliseconds the source has been playing.
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.
Definition at line 220 of file source_common.cpp.
References _Playing, and _PlayStart.
| virtual TSOURCE_TYPE NLSOUND::CSourceCommon::getType | ( | ) | const [pure virtual] |
Get the type the the source.
Implemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, NLSOUND::CMusicSource, and NLSOUND::CSimpleSource.
Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
| virtual void NLSOUND::CSourceCommon::getVelocity | ( | NLMISC::CVector & | vel | ) | const [inline, virtual] |
Get the velocity vector.
Implements NLSOUND::USource.
Definition at line 77 of file source_common.h.
References _Velocity.
| bool NLSOUND::CSourceCommon::isPlaying | ( | ) | [inline, virtual] |
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 63 of file source_common.h.
References _Playing.
Referenced by NLSOUND::CMusicSource::play(), NLSOUND::CAudioMixerUser::reset(), NLSOUND::CMusicSource::stop(), NLSOUND::CBackgroundSoundManager::updateBackgroundStatus(), and NLSOUND::CMusicSource::~CMusicSource().
| bool NLSOUND::CSourceCommon::isSpawn | ( | ) | const [inline] |
| void NLSOUND::CSourceCommon::play | ( | ) | [virtual] |
Play.
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, NLSOUND::CMusicSource, and NLSOUND::CSimpleSource.
Definition at line 105 of file source_common.cpp.
References _Playing, _PlayStart, _UserVarControler, NLSOUND::CAudioMixerUser::addUserControledSource(), NLSOUND::CAudioMixerUser::incPlayingSource(), and NLSOUND::CAudioMixerUser::instance().
Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
| void NLSOUND::CSourceCommon::set3DPositionVector | ( | const NLMISC::CVector * | pos | ) | [inline] |
Set the position vector to return for a stereo source (default: NULL).
Definition at line 87 of file source_common.h.
References _3DPosition.
Referenced by NLSOUND::CAudioMixerUser::createSource().
| void NLSOUND::CSourceCommon::setDirection | ( | const NLMISC::CVector & | dir | ) | [virtual] |
Set the direction vector (3D mode only, ignored in stereo mode) (default: (0,0,0) as non-directional).
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.
Definition at line 173 of file source_common.cpp.
References _Direction.
| void NLSOUND::CSourceCommon::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
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.
Definition at line 184 of file source_common.cpp.
References _Gain, _InitialGain, and NLMISC::clamp().
Referenced by NLSOUND::CAudioMixerUser::addUserControledSource().
| void NLSOUND::CSourceCommon::setLooping | ( | bool | l | ) | [virtual] |
Set looping on/off for future playbacks (default: off).
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CSimpleSource.
Definition at line 89 of file source_common.cpp.
References _Looping.
| void NLSOUND::CSourceCommon::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.
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CSimpleSource.
Definition at line 155 of file source_common.cpp.
References _Pitch.
Referenced by NLSOUND::CAudioMixerUser::addUserControledSource().
| void NLSOUND::CSourceCommon::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
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.
Definition at line 131 of file source_common.cpp.
References _Position.
Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
| void NLSOUND::CSourceCommon::setPriority | ( | TSoundPriority | pr | ) | [virtual] |
Change the priority of the source.
Implements NLSOUND::USource.
Definition at line 74 of file source_common.cpp.
References _Priority.
| void NLSOUND::CSourceCommon::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.
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.
Definition at line 193 of file source_common.cpp.
References _Gain, _InitialGain, and NLMISC::clamp().
Referenced by NLSOUND::CAudioMixerUser::addUserControledSource(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
| void NLSOUND::CSourceCommon::setSourceRelativeMode | ( | bool | mode | ) | [virtual] |
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 214 of file source_common.cpp.
References _RelativeMode.
| void NLSOUND::CSourceCommon::setVelocity | ( | const NLMISC::CVector & | vel | ) | [virtual] |
Set the velocity vector (3D mode only, ignored in stereo mode) (default: (0,0,0)).
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, and NLSOUND::CSimpleSource.
Definition at line 165 of file source_common.cpp.
References _Velocity.
| void NLSOUND::CSourceCommon::stop | ( | ) | [virtual] |
Stop playing.
Implements NLSOUND::USource.
Reimplemented in NLSOUND::CBackgroundSource, NLSOUND::CComplexSource, NLSOUND::CMusicSource, and NLSOUND::CSimpleSource.
Definition at line 118 of file source_common.cpp.
References _Playing, _UserVarControler, NLSOUND::CAudioMixerUser::decPlayingSource(), NLSOUND::CAudioMixerUser::instance(), and NLSOUND::CAudioMixerUser::removeUserControledSource().
Referenced by NLSOUND::CAudioMixerUser::reset(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
| virtual void NLSOUND::CSourceCommon::unregisterSpawnCallBack | ( | ) | [inline, virtual] |
Tells this source not to call its callbacks when it ends. This is valid for spawned sources only.
Implements NLSOUND::USource.
Definition at line 75 of file source_common.h.
References _SpawnEndCb.
friend class CAudioMixerUser [friend] |
Definition at line 37 of file source_common.h.
const NLMISC::CVector* NLSOUND::CSourceCommon::_3DPosition [protected] |
Definition at line 124 of file source_common.h.
Referenced by getPos(), and set3DPositionVector().
void* NLSOUND::CSourceCommon::_CbUserParam [protected] |
Definition at line 129 of file source_common.h.
Referenced by getCallbackUserParam(), NLSOUND::CSimpleSource::play(), and NLSOUND::CSimpleSource::stop().
NL3D::CCluster* NLSOUND::CSourceCommon::_Cluster [protected] |
Definition at line 130 of file source_common.h.
Referenced by getCluster(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CBackgroundSource::play(), and NLSOUND::CComplexSource::playStuf().
NLMISC::CVector NLSOUND::CSourceCommon::_Direction [protected] |
Definition at line 112 of file source_common.h.
Referenced by CSourceCommon(), getDirection(), NLSOUND::CSimpleSource::play(), and setDirection().
float NLSOUND::CSourceCommon::_Gain [protected] |
Definition at line 113 of file source_common.h.
Referenced by NLSOUND::CComplexSource::CComplexSource(), CSourceCommon(), getGain(), getRelativeGain(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CSimpleSource::play(), NLSOUND::CComplexSource::play(), NLSOUND::CComplexSource::playStuf(), setGain(), NLSOUND::CComplexSource::setGain(), NLSOUND::CBackgroundSource::setGain(), setRelativeGain(), NLSOUND::CSimpleSource::setRelativeGain(), NLSOUND::CComplexSource::setRelativeGain(), NLSOUND::CBackgroundSource::setRelativeGain(), and NLSOUND::CBackgroundSource::updateFilterValues().
float NLSOUND::CSourceCommon::_InitialGain [protected] |
Gain not affected by setRelativeGain and used to compute _Gain.
Definition at line 118 of file source_common.h.
Referenced by CSourceCommon(), getRelativeGain(), setGain(), and setRelativeGain().
bool NLSOUND::CSourceCommon::_Looping [protected] |
Definition at line 108 of file source_common.h.
Referenced by NLSOUND::CComplexSource::CComplexSource(), CSourceCommon(), getLooping(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CSimpleSource::play(), NLSOUND::CComplexSource::playStuf(), and setLooping().
float NLSOUND::CSourceCommon::_Pitch [protected] |
Definition at line 114 of file source_common.h.
Referenced by NLSOUND::CComplexSource::CComplexSource(), CSourceCommon(), getPitch(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CSimpleSource::play(), NLSOUND::CComplexSource::playStuf(), setPitch(), and NLSOUND::CBackgroundSource::updateFilterValues().
bool NLSOUND::CSourceCommon::_Playing [protected] |
Definition at line 107 of file source_common.h.
Referenced by getTime(), NLSOUND::CComplexSource::getTime(), isPlaying(), NLSOUND::CSimpleSource::isPlaying(), NLSOUND::CComplexSource::isPlaying(), NLSOUND::CSimpleSource::onEvent(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), play(), NLSOUND::CBackgroundSource::play(), NLSOUND::CComplexSource::setGain(), NLSOUND::CComplexSource::setRelativeGain(), stop(), NLSOUND::CSimpleSource::stop(), NLSOUND::CBackgroundSource::stop(), NLSOUND::CBackgroundSource::~CBackgroundSource(), and NLSOUND::CSimpleSource::~CSimpleSource().
NLMISC::TTime NLSOUND::CSourceCommon::_PlayStart [protected] |
Definition at line 121 of file source_common.h.
Referenced by getTime(), NLSOUND::CComplexSource::getTime(), and play().
NLMISC::CVector NLSOUND::CSourceCommon::_Position [protected] |
Definition at line 110 of file source_common.h.
Referenced by getPos(), NLSOUND::CSimpleSource::getVirtualPos(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CSimpleSource::play(), NLSOUND::CComplexSource::playStuf(), setPos(), and NLSOUND::CBackgroundSource::updateFilterValues().
TSoundPriority NLSOUND::CSourceCommon::_Priority [protected] |
Definition at line 106 of file source_common.h.
Referenced by NLSOUND::CComplexSource::CComplexSource(), CSourceCommon(), getPriority(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CSimpleSource::play(), NLSOUND::CBackgroundSource::play(), NLSOUND::CComplexSource::playStuf(), and setPriority().
bool NLSOUND::CSourceCommon::_RelativeMode [protected] |
Definition at line 115 of file source_common.h.
Referenced by getSourceRelativeMode(), NLSOUND::CSimpleSource::play(), and setSourceRelativeMode().
const bool NLSOUND::CSourceCommon::_Spawn [protected] |
Definition at line 127 of file source_common.h.
Referenced by isSpawn(), NLSOUND::CSimpleSource::play(), and NLSOUND::CSimpleSource::stop().
TSpawnEndCallback NLSOUND::CSourceCommon::_SpawnEndCb [protected] |
Definition at line 128 of file source_common.h.
Referenced by NLSOUND::CSimpleSource::getSpawnEndCallback(), NLSOUND::CSimpleSource::play(), NLSOUND::CSimpleSource::stop(), and unregisterSpawnCallBack().
An optional user var controler.
Definition at line 133 of file source_common.h.
NLMISC::CVector NLSOUND::CSourceCommon::_Velocity [protected] |
Definition at line 111 of file source_common.h.
Referenced by getVelocity(), NLSOUND::CSimpleSource::play(), and setVelocity().
1.6.1