From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03413.html | 951 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 951 insertions(+) create mode 100644 docs/doxygen/nel/a03413.html (limited to 'docs/doxygen/nel/a03413.html') diff --git a/docs/doxygen/nel/a03413.html b/docs/doxygen/nel/a03413.html new file mode 100644 index 00000000..81625f1f --- /dev/null +++ b/docs/doxygen/nel/a03413.html @@ -0,0 +1,951 @@ + + +NeL: NLSOUND::CSoundAnimation class Reference + + + +
+

NLSOUND::CSoundAnimation Class Reference

#include <sound_animation.h> +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  { NoId = -1 + }

Public Member Functions

virtual void addMarker (CSoundAnimMarker *marker)
virtual uint32 countMarkers ()
 CSoundAnimation (std::string &name, TSoundAnimId id)
virtual std::string & getFilename ()
virtual CSoundAnimMarkergetMarker (uint32 i)
virtual std::string & getName ()
virtual bool isDirty ()
virtual void load ()
virtual void play (UAudioMixer *mixer, float lastTime, float curTime, NL3D::CCluster *cluster, CSoundContext &context)
virtual void removeMarker (CSoundAnimMarker *marker)
virtual void save ()
virtual void setDirty (bool b)
virtual void setFilename (std::string &name)
virtual ~CSoundAnimation ()

Protected Member Functions

virtual void sort ()
 Sort all the markers according to their time.


Protected Attributes

bool _Dirty
std::string _Filename
TSoundAnimId _Id
TMarkerVector _Markers
std::string _Name
+


Member Enumeration Documentation

+

+ + + + +
+ + +
anonymous enum +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + +
NoId  +
+
+ +

+Definition at line 49 of file sound_animation.h. +

+

00050         { 
+00051                 NoId = -1
+00052         };
+
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
NLSOUND::CSoundAnimation::CSoundAnimation std::string &  name,
TSoundAnimId  id
[inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 54 of file sound_animation.h. +

+References id, and NLSOUND::TSoundAnimId. +

+

00054 : _Name(name), _Id(id), _Dirty(false) {}
+
+

+ + + + +
+ + + + + + + + + +
virtual NLSOUND::CSoundAnimation::~CSoundAnimation  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Definition at line 56 of file sound_animation.h. +

+

00056 {}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CSoundAnimation::addMarker CSoundAnimMarker marker  )  [virtual]
+
+ + + + + +
+   + + +

+Add a new marker +

+Definition at line 43 of file sound_animation.cpp. +

+References _Markers, and sort(). +

+Referenced by load(). +

+

00044 {
+00045         if (marker == NULL)
+00046                 return;
+00047 
+00048         _Dirty = true;
+00049         _Markers.push_back(marker);
+00050         sort();
+00051 }
+
+

+ + + + +
+ + + + + + + + + +
virtual uint32 NLSOUND::CSoundAnimation::countMarkers  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Return the number of markers in this track +

+Definition at line 66 of file sound_animation.h. +

+References _Markers, and uint32. +

+

00066 { return _Markers.size(); }
+
+

+ + + + +
+ + + + + + + + + +
virtual std::string& NLSOUND::CSoundAnimation::getFilename  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Return the filename of the animation +

+Definition at line 82 of file sound_animation.h. +

+

00082 { return _Filename; }
+
+

+ + + + +
+ + + + + + + + + + +
virtual CSoundAnimMarker* NLSOUND::CSoundAnimation::getMarker uint32  i  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Return a marker of this track given its index +

+Definition at line 69 of file sound_animation.h. +

+References _Markers, and uint32. +

+

00069 { return _Markers[i]; }
+
+

+ + + + +
+ + + + + + + + + + +
virtual std::string& NLSOUND::CSoundAnimation::getName void   )  [inline, virtual]
+
+ + + + + +
+   + + +

+Return the name of the animation +

+Definition at line 72 of file sound_animation.h. +

+Referenced by NLSOUND::CSoundAnimManager::createAnimation(). +

+

00072 { return _Name; }
+
+

+ + + + +
+ + + + + + + + + +
virtual bool NLSOUND::CSoundAnimation::isDirty  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Returns whether the sound animation changed since the last save. (Editing support) +

+Definition at line 89 of file sound_animation.h. +

+

00089 { return _Dirty; }
+
+

+ + + + +
+ + + + + + + + + +
void NLSOUND::CSoundAnimation::load  )  [virtual]
+
+ + + + + +
+   + + +

+Load from an xml file +

+Definition at line 159 of file sound_animation.cpp. +

+References addMarker(), NLSOUND::CSoundAnimMarker::addSound(), file, and NLSOUND::CSoundAnimMarker::setTime(). +

+Referenced by NLSOUND::CSoundAnimManager::loadAnimation(). +

+

00160 {
+00161         NL_ALLOC_CONTEXT(NLSOUND_CSoundAnimation);
+00162         CIFile file;
+00163 
+00164         // Open the file
+00165         if (!file.open(_Filename.c_str()))
+00166         {
+00167                 throw exception("Can't open the file for reading");
+00168         }
+00169 
+00170         // Create the XML stream
+00171         CIXml input;
+00172 
+00173         // Init
+00174         if (input.init (file))
+00175         {
+00176                 xmlNodePtr animNode = input.getRootNode ();
+00177                 xmlNodePtr markerNode = input.getFirstChildNode(animNode, "MARKER");
+00178 
+00179                 while (markerNode != 0)
+00180                 {
+00181                         CSoundAnimMarker* marker = new CSoundAnimMarker();
+00182 
+00183                         const char *time = (const char*) xmlGetProp(markerNode, (xmlChar*) "time");
+00184                         if (time == 0)
+00185                         {
+00186                                 throw exception("Invalid sound animation marker");
+00187                         }
+00188 
+00189                         marker->setTime((float) atof(time));
+00190                         xmlFree ((void*)time);
+00191 
+00192 
+00193                         xmlNodePtr soundNode = input.getFirstChildNode(markerNode, "SOUND");
+00194 
+00195                         while (soundNode != 0)
+00196                         {
+00197                                 char *name = (char*) xmlGetProp(soundNode, (xmlChar*) "name");
+00198                                 if (name == 0)
+00199                                 {
+00200                                         throw exception("Invalid sound animation marker");
+00201                                 }
+00202 
+00203                                 marker->addSound(CStringMapper::map(string(name)));
+00204 
+00205                                 xmlFree ((void*)name);
+00206 
+00207                                 soundNode = input.getNextChildNode(soundNode, "SOUND");
+00208                         }
+00209 
+00210                         addMarker(marker);
+00211 
+00212                         markerNode = input.getNextChildNode(markerNode, "MARKER");
+00213                 }
+00214         }
+00215 
+00216         // Close the file
+00217         file.close ();
+00218         _Dirty = false;
+00219 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLSOUND::CSoundAnimation::play UAudioMixer mixer,
float  lastTime,
float  curTime,
NL3D::CCluster cluster,
CSoundContext context
[virtual]
+
+ + + + + +
+   + + +

+Play the sounds of the markers that fall within the specified time interval. +

+Definition at line 142 of file sound_animation.cpp. +

+References _Markers, NLSOUND::CSoundAnimMarker::getTime(), nlassert, and NLSOUND::CSoundAnimMarker::play(). +

+Referenced by NLSOUND::CSoundAnimManager::playAnimation(). +

+

00143 {
+00144         vector<CSoundAnimMarker*>::iterator iter;
+00145         for (iter = _Markers.begin(); iter != _Markers.end(); iter++)
+00146         {
+00147                 CSoundAnimMarker* marker = *iter;
+00148                 nlassert(marker);
+00149 
+00150                 if ((lastTime <= marker->getTime()) && (marker->getTime() < curTime))
+00151                 {
+00152                         marker->play(mixer, cluster, context);
+00153                 }
+00154         }
+00155 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CSoundAnimation::removeMarker CSoundAnimMarker marker  )  [virtual]
+
+ + + + + +
+   + + +

+Remove a marker +

+Definition at line 55 of file sound_animation.cpp. +

+References _Markers. +

+

00056 {
+00057         if (marker == NULL)
+00058                 return;
+00059 
+00060         _Dirty = true;
+00061         vector<CSoundAnimMarker*>::iterator iter;
+00062         for (iter = _Markers.begin(); iter != _Markers.end(); iter++)
+00063         {
+00064                 if (*iter == marker)
+00065                 {
+00066                         _Markers.erase(iter);
+00067                         break;
+00068                 }
+00069         }
+00070 }
+
+

+ + + + +
+ + + + + + + + + +
void NLSOUND::CSoundAnimation::save  )  [virtual]
+
+ + + + + +
+   + + +

+Save to an xml document +

+Definition at line 81 of file sound_animation.cpp. +

+References _Markers, file, NLMISC::COXml::flush(), NLMISC::COXml::getDocument(), NLSOUND::CSoundAnimMarker::getSounds(), NLSOUND::CSoundAnimMarker::getTime(), NLMISC::COXml::init(), s, and NLMISC::smprintf(). +

+Referenced by NLSOUND::CSoundAnimManager::saveAnimation(). +

+

00082 {
+00083         // File stream
+00084         COFile file;
+00085         vector<NLMISC::TStringId>       sounds;
+00086 
+00087         // Open the file
+00088         if (!file.open(_Filename.c_str()))
+00089         {
+00090                 throw exception("Can't open the file for writing");
+00091         }
+00092 
+00093         // Create the XML stream
+00094         COXml output;
+00095 
+00096         // Init
+00097         if (output.init (&file, "1.0"))
+00098         {
+00099                 xmlDocPtr xmlDoc = output.getDocument();
+00100 
+00101                 // Create the first node
+00102                 xmlNodePtr root = xmlNewDocNode (xmlDoc, NULL, (const xmlChar*)"SOUNDANIMATION", NULL);
+00103                 xmlDocSetRootElement (xmlDoc, root);
+00104 
+00105                 vector<CSoundAnimMarker*>::iterator iter;
+00106                 for (iter = _Markers.begin(); iter != _Markers.end(); iter++)
+00107                 {
+00108                         CSoundAnimMarker* marker = (*iter);
+00109                 
+00110                         set<string>::iterator iter;
+00111 
+00112                         char s[64];
+00113                         smprintf(s, 64, "%f", marker->getTime());
+00114 
+00115                         xmlNodePtr markerNode = xmlNewChild (root, NULL, (const xmlChar*)"MARKER", NULL);
+00116                         xmlSetProp (markerNode, (const xmlChar*) "time", (const xmlChar*) s);
+00117 
+00118                         marker->getSounds(sounds);
+00119 
+00120                         vector<NLMISC::TStringId>::iterator iter2;
+00121                         for (iter2 = sounds.begin(); iter2 != sounds.end(); iter2++)
+00122                         {
+00123                                 xmlNodePtr soundNode = xmlNewChild ( markerNode, NULL, (const xmlChar*)"SOUND", NULL );
+00124                                 xmlSetProp (soundNode, (const xmlChar*)"name", (const xmlChar*) CStringMapper::unmap(*iter2).c_str());
+00125                         }
+00126 
+00127                         sounds.clear();
+00128                 }
+00129 
+00130                 // Flush the stream, write all the output file
+00131                 output.flush ();
+00132         }
+00133 
+00134         // Close the file
+00135         file.close ();
+00136 
+00137         _Dirty = false;
+00138 }
+
+

+ + + + +
+ + + + + + + + + + +
virtual void NLSOUND::CSoundAnimation::setDirty bool  b  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Set the dirty flag (Editing support) +

+Definition at line 92 of file sound_animation.h. +

+

00092 { _Dirty = b; }
+
+

+ + + + +
+ + + + + + + + + + +
virtual void NLSOUND::CSoundAnimation::setFilename std::string &  name  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Set the filename of the animation +

+Definition at line 86 of file sound_animation.h. +

+Referenced by NLSOUND::CSoundAnimManager::loadAnimation(), and NLSOUND::CSoundAnimManager::saveAnimation(). +

+

00086 { _Filename = name; }
+
+

+ + + + +
+ + + + + + + + + +
void NLSOUND::CSoundAnimation::sort  )  [protected, virtual]
+
+ + + + + +
+   + + +

+Sort all the markers according to their time. +

+ +

+Definition at line 74 of file sound_animation.cpp. +

+Referenced by addMarker(). +

+

00075 {
+00076         //std::sort<CSoundAnimMarker*, eqmarker>(_Markers.begin(), _Markers.end(), eqmarker());
+00077 }
+
+


Field Documentation

+

+ + + + +
+ + +
bool NLSOUND::CSoundAnimation::_Dirty [protected] +
+
+ + + + + +
+   + + +

+Has the sound animation changed since the last save? (Editing support) +

+Definition at line 115 of file sound_animation.h.

+

+ + + + +
+ + +
std::string NLSOUND::CSoundAnimation::_Filename [protected] +
+
+ + + + + +
+   + + +

+The filename +

+Definition at line 112 of file sound_animation.h.

+

+ + + + +
+ + +
TSoundAnimId NLSOUND::CSoundAnimation::_Id [protected] +
+
+ + + + + +
+   + + +

+The unique ID of the animation +

+Definition at line 103 of file sound_animation.h.

+

+ + + + +
+ + +
TMarkerVector NLSOUND::CSoundAnimation::_Markers [protected] +
+
+ + + + + +
+   + + +

+The set of markers +

+Definition at line 109 of file sound_animation.h. +

+Referenced by addMarker(), countMarkers(), getMarker(), play(), removeMarker(), and save().

+

+ + + + +
+ + +
std::string NLSOUND::CSoundAnimation::_Name [protected] +
+
+ + + + + +
+   + + +

+The name of the animation +

+Definition at line 106 of file sound_animation.h.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 14:42:31 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1