NLSOUND::CSoundAnimMarker Class Reference

#include <sound_anim_marker.h>


Public Member Functions

virtual void addSound (const NLMISC::TStringId &soundName)
 CSoundAnimMarker (float time=0.0f)
virtual void getSounds (std::vector< NLMISC::TStringId > &sounds)
virtual float getTime () const
virtual void play (UAudioMixer *mixer, NL3D::CCluster *cluster, CSoundContext &context)
virtual void removeSound (const NLMISC::TStringId &soundName)
virtual void setTime (float time)
virtual ~CSoundAnimMarker ()

Protected Attributes

TMarkerSoundSet _Sounds
float _Time


Constructor & Destructor Documentation

NLSOUND::CSoundAnimMarker::CSoundAnimMarker float  time = 0.0f  )  [inline]
 

Definition at line 52 of file sound_anim_marker.h.

00052 : _Time(time) {}

NLSOUND::CSoundAnimMarker::~CSoundAnimMarker  )  [virtual]
 

Definition at line 41 of file sound_anim_marker.cpp.

00042 {
00043 }


Member Function Documentation

void NLSOUND::CSoundAnimMarker::addSound const NLMISC::TStringId soundName  )  [virtual]
 

Add a new sound in the set of to-be-played sounds for this marker

Definition at line 65 of file sound_anim_marker.cpp.

References nlwarning.

Referenced by NLSOUND::CSoundAnimation::load().

00066 {
00067         pair<TMarkerSoundSet::iterator, bool> inserted;
00068         inserted = _Sounds.insert(soundName);
00069         if (inserted.second == false)
00070         {
00071                 nlwarning("Duplicate sound (%s)", CStringMapper::unmap(soundName).c_str());
00072         }
00073 }

void NLSOUND::CSoundAnimMarker::getSounds std::vector< NLMISC::TStringId > &  sounds  )  [virtual]
 

Return the set of sounds of this marker

Definition at line 92 of file sound_anim_marker.cpp.

Referenced by NLSOUND::CSoundAnimation::save().

00093 {
00094         sounds.insert(sounds.end(), _Sounds.begin(), _Sounds.end());
00095 
00096 /*      TMarkerSoundSet::iterator first(_Sounds.begin()), last(_Sounds.end());
00097         for (; first != last; ++first)
00098         {
00099                 sounds.push_back((*first).c_str());
00100         }
00101 */
00102 }

virtual float NLSOUND::CSoundAnimMarker::getTime void   )  const [inline, virtual]
 

Returns the time of this marker

Definition at line 59 of file sound_anim_marker.h.

Referenced by NLSOUND::CSoundAnimation::play(), and NLSOUND::CSoundAnimation::save().

00059 { return _Time; }

void NLSOUND::CSoundAnimMarker::play UAudioMixer mixer,
NL3D::CCluster cluster,
CSoundContext context
[virtual]
 

Play all the sounds of this marker

Definition at line 47 of file sound_anim_marker.cpp.

References NLSOUND::UAudioMixer::createSource(), NLSOUND::USource::play(), NLSOUND::CSoundContext::Position, NLSOUND::CSoundContext::RelativeGain, NLSOUND::USource::setPos(), and NLSOUND::USource::setRelativeGain().

Referenced by NLSOUND::CSoundAnimation::play().

00048 {
00049         TMarkerSoundSet::iterator first(_Sounds.begin()), last(_Sounds.end());
00050 
00051         for (; first != last; ++first)
00052         {
00053                 USource* source = mixer->createSource((*first), true, NULL, NULL, cluster, &context);
00054                 if (source != NULL)
00055                 {
00056                         source->setRelativeGain(context.RelativeGain);
00057                         source->setPos(context.Position);
00058                         source->play();
00059                 }
00060         }
00061 }

void NLSOUND::CSoundAnimMarker::removeSound const NLMISC::TStringId soundName  )  [virtual]
 

Remove a sound

Definition at line 77 of file sound_anim_marker.cpp.

References nlwarning.

00078 {
00079         TMarkerSoundSet::const_iterator iter = _Sounds.find(soundName);
00080     if (iter != _Sounds.end())
00081         {
00082                 _Sounds.erase(iter);
00083         }
00084         else
00085         {
00086                 nlwarning("No sound was removed (%s)", CStringMapper::unmap(soundName).c_str());                
00087         }
00088 }

virtual void NLSOUND::CSoundAnimMarker::setTime float  time  )  [inline, virtual]
 

Set the time of this marker

Definition at line 56 of file sound_anim_marker.h.

Referenced by NLSOUND::CSoundAnimation::load().

00056 { _Time = time; }


Field Documentation

TMarkerSoundSet NLSOUND::CSoundAnimMarker::_Sounds [protected]
 

The set of sounds to be played

Definition at line 77 of file sound_anim_marker.h.

float NLSOUND::CSoundAnimMarker::_Time [protected]
 

The time position of this marker

Definition at line 80 of file sound_anim_marker.h.


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