aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/sound__bank_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/sound__bank_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/sound__bank_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/sound__bank_8cpp-source.html409
1 files changed, 409 insertions, 0 deletions
diff --git a/docs/doxygen/nel/sound__bank_8cpp-source.html b/docs/doxygen/nel/sound__bank_8cpp-source.html
new file mode 100644
index 00000000..b64dda63
--- /dev/null
+++ b/docs/doxygen/nel/sound__bank_8cpp-source.html
@@ -0,0 +1,409 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>sound_bank.cpp</h1><a href="sound__bank_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#include "<a class="code" href="stdsound_8h.html">stdsound.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="sound__bank_8h.html">sound_bank.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="simple__sound_8h.html">simple_sound.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="complex__sound_8h.html">complex_sound.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="context__sound_8h.html">context_sound.h</a>"</font>
+00032 <font class="preprocessor">#include "<a class="code" href="background__sound_8h.html">background_sound.h</a>"</font>
+00033
+00034 <font class="preprocessor">#include "<a class="code" href="u__form__loader_8h.html">nel/georges/u_form_loader.h</a>"</font>
+00035 <font class="preprocessor">#include "<a class="code" href="u__form__elm_8h.html">nel/georges/u_form_elm.h</a>"</font>
+00036 <font class="preprocessor">#include "<a class="code" href="u__form_8h.html">nel/georges/u_form.h</a>"</font>
+00037 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
+00038 <font class="preprocessor">#include "<a class="code" href="buffer_8h.html">driver/buffer.h</a>"</font>
+00039
+00040 <font class="preprocessor">#include "<a class="code" href="load__form_8h.html">nel/georges/load_form.h</a>"</font>
+00041
+00042 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00043 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00044 <font class="keyword">using</font> <font class="keyword">namespace </font>NLGEORGES;
+00045
+00046
+00047 <font class="keyword">namespace </font>NLSOUND {
+00048
+<a name="l00049"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">00049</a> CSoundBank *CSoundBank::_Instance;
+00050
+00051
+00052
+<a name="l00053"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#d0">00053</a> CSoundBank *CSoundBank::instance()
+00054 {
+00055 <font class="keywordflow">if</font> (<a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">_Instance</a> == 0)
+00056 <a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">_Instance</a> = <font class="keyword">new</font> <a class="code" href="classNLSOUND_1_1CSoundBank.html#c0">CSoundBank</a>();
+00057 <font class="keywordflow">return</font> <a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">_Instance</a>;
+00058 }
+00059
+<a name="l00060"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#d1">00060</a> <font class="keywordtype">void</font> CSoundBank::release()
+00061 {
+00062 <font class="keywordflow">if</font> (<a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">_Instance</a> != 0)
+00063 <font class="keyword">delete</font> <a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">_Instance</a>;
+00064 <a class="code" href="classNLSOUND_1_1CSoundBank.html#r0">_Instance</a> = 0;
+00065 }
+00066
+00067
+<a name="l00068"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a2">00068</a> <font class="keywordtype">void</font> CSoundBank::bufferUnloaded(<font class="keyword">const</font> std::string bufferName)
+00069 {
+00070 TBufferAssocContainer::iterator it(<a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.find(bufferName));
+00071
+00072 <font class="keywordflow">if</font> (it != <a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.end())
+00073 {
+00074 <font class="comment">// ok, found some sound associated with this buffer.</font>
+00075 <font class="comment">// update all sounds.</font>
+00076 TSimpleSoundContainer::iterator first(it-&gt;second.begin()), last(it-&gt;second.end());
+00077 <font class="keywordflow">for</font> (; first != last; ++first)
+00078 {
+00079 <font class="comment">// remove the associated buffer.</font>
+00080 CSimpleSound *ss = const_cast&lt;CSimpleSound*&gt;(*(first));
+00081 ss-&gt;setBuffer(NULL);
+00082 }
+00083 }
+00084 }
+00085
+<a name="l00086"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a3">00086</a> <font class="keywordtype">void</font> CSoundBank::bufferLoaded(<font class="keyword">const</font> std::string bufferName, IBuffer *buffer)
+00087 {
+00088 <font class="comment">// std::map&lt;std::string, std::vector&lt;TBufferAssoc&gt; &gt;::iterator it(_BufferAssoc.find(buffer-&gt;getName()));</font>
+00089 TBufferAssocContainer::iterator it(<a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.find(buffer-&gt;getName()));
+00090
+00091 <font class="keywordflow">if</font> (it != <a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.end())
+00092 {
+00093 <font class="comment">// ok, found some sound associated with this buffer.</font>
+00094 <font class="comment">// update all sounds.</font>
+00095 TSimpleSoundContainer::iterator first(it-&gt;second.begin()), last(it-&gt;second.end());
+00096 <font class="keywordflow">for</font> (; first != last; ++first)
+00097 {
+00098 CSimpleSound *ss = const_cast&lt;CSimpleSound*&gt;(*(it-&gt;second.begin()));
+00099 <font class="comment">// restore the associated buffer.</font>
+00100 ss-&gt;setBuffer(buffer);
+00101 }
+00102 }
+00103
+00104 }
+00105
+<a name="l00106"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a0">00106</a> <font class="keywordtype">void</font> CSoundBank::registerBufferAssoc(CSimpleSound *sound, IBuffer *buffer)
+00107 {
+00108 <font class="keywordflow">if</font> (buffer != NULL)
+00109 {
+00110 <font class="keyword">const</font> std::string &amp;bufferName = buffer-&gt;getName();
+00111 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>[bufferName].insert(sound);
+00112 }
+00113 }
+00114
+<a name="l00115"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a1">00115</a> <font class="keywordtype">void</font> CSoundBank::unregisterBufferAssoc(CSimpleSound *sound, IBuffer * buffer)
+00116 {
+00117 <font class="keywordflow">if</font> (buffer != NULL)
+00118 {
+00119 <font class="keyword">const</font> std::string &amp;bufferName = buffer-&gt;getName();
+00120 TBufferAssocContainer::iterator it(<a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.find(bufferName));
+00121
+00122 <font class="keywordflow">if</font> (it != <a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.end())
+00123 {
+00124 TSimpleSoundContainer::iterator it2(it-&gt;second.find(sound));
+00125
+00126 <a class="code" href="debug_8h.html#a6">nlassert</a>(it2 != it-&gt;second.end())
+00127 it-&gt;second.erase(it2);
+00128
+00129 <font class="keywordflow">if</font> (it-&gt;second.empty())
+00130 {
+00131 <font class="comment">// last sound refenrecing this buffer</font>
+00132 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o0">_BufferAssoc</a>.erase(it);
+00133 }
+00134
+00135 }
+00136 }
+00137 }
+00138
+00139
+00140 <font class="comment">/*</font>
+00141 <font class="comment"> * Destructor</font>
+00142 <font class="comment"> */</font>
+<a name="l00143"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a4">00143</a> CSoundBank::~CSoundBank()
+00144 {
+00145 <a class="code" href="classNLSOUND_1_1CSoundBank.html#a6">unload</a>();
+00146 }
+00147
+<a name="l00148"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a11">00148</a> <font class="keywordtype">void</font> CSoundBank::addSound(CSound *sound)
+00149 {
+00150 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.insert(make_pair(sound-&gt;getName(), sound));
+00151 }
+00152
+<a name="l00153"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a12">00153</a> <font class="keywordtype">void</font> CSoundBank::removeSound(<font class="keyword">const</font> std::string &amp;name)
+00154 {
+00155 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.erase(name);
+00156 }
+00157
+00158
+<a name="l00165"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html">00165</a> <font class="keyword">class </font>CSoundSerializer
+00166 {
+00167 <font class="keyword">public</font>:
+<a name="l00169"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">00169</a> CSound *<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>;
+00170
+<a name="l00172"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a0">00172</a> <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a0">CSoundSerializer</a>()
+00173 : <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>(0)
+00174 {}
+00175
+00176 <font class="comment">// load the values using the george sheet (called by GEORGE::loadForm)</font>
+<a name="l00177"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a1">00177</a> <font class="keywordtype">void</font> <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a1">readGeorges</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CSmartPtr.html">NLMISC::CSmartPtr&lt;NLGEORGES::UForm&gt;</a> &amp;form, <font class="keyword">const</font> std::string &amp;name)
+00178 {
+00179 <font class="comment">// just call the sound creation method with the xml form.</font>
+00180 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> = CSound::createSound(name, form-&gt;getRootNode());
+00181
+00182 <font class="comment">// success ?</font>
+00183 <font class="keywordflow">if</font> (<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> != 0)
+00184 CSoundBank::instance()-&gt;addSound(<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>);
+00185 }
+00186
+00187 <font class="comment">// load/save the values using the serial system (called by GEORGE::loadForm)</font>
+<a name="l00188"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a2">00188</a> <font class="keywordtype">void</font> <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a2">serial</a> (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)
+00189 {
+00190 <font class="keywordflow">if</font> (s.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
+00191 {
+00192 <font class="comment">// read the first item to find the type</font>
+00193 CSound::TSOUND_TYPE <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>;
+00194 s.<a class="code" href="classNLMISC_1_1IStream.html#a6">serialEnum</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>);
+00195 <font class="comment">// read the sound name</font>
+00196 std::string name;
+00197 s.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(name);
+00198
+00199 <font class="comment">// Instantiate the corresponding sound.</font>
+00200 <font class="keywordflow">switch</font>(CSound::TSOUND_TYPE(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>))
+00201 {
+00202 <font class="keywordflow">case</font> CSound::SOUND_SIMPLE:
+00203 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> = <font class="keyword">new</font> CSimpleSound();
+00204 <font class="keywordflow">break</font>;
+00205 <font class="keywordflow">case</font> CSound::SOUND_COMPLEX:
+00206 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> = <font class="keyword">new</font> CComplexSound();
+00207 <font class="keywordflow">break</font>;
+00208 <font class="keywordflow">case</font> CSound::SOUND_CONTEXT:
+00209 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> = <font class="keyword">new</font> CContextSound();
+00210 <font class="keywordflow">break</font>;
+00211 <font class="keywordflow">case</font> CSound::SOUND_BACKGROUND:
+00212 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> = <font class="keyword">new</font> CBackgroundSound();
+00213 <font class="keywordflow">break</font>;
+00214 <font class="keywordflow">default</font>:
+00215 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> = 0;
+00216 }
+00217
+00218 <font class="comment">// nlassert(_Sound != 0);</font>
+00219 <font class="keywordflow">if</font> (_Sound)
+00220 {
+00221 <font class="comment">// read the sound data</font>
+00222 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>-&gt;serial(s);
+00223 CSoundBank::instance()-&gt;addSound(<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>);
+00224 }
+00225 }
+00226 <font class="keywordflow">else</font>
+00227 {
+00228 <font class="keywordflow">if</font> (<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> == 0)
+00229 {
+00230 <font class="comment">// the sound doesn't exist</font>
+00231 uint32 i = -1;
+00232 s.<a class="code" href="classNLMISC_1_1IStream.html#a6">serialEnum</a>(i);
+00233 s.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(std::string(<font class="stringliteral">"bad sound"</font>));
+00234 }
+00235 <font class="keywordflow">else</font>
+00236 {
+00237 <font class="comment">// write the sound type.</font>
+00238 CSound::TSOUND_TYPE <a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a> = <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>-&gt;getSoundType();
+00239 s.<a class="code" href="classNLMISC_1_1IStream.html#a6">serialEnum</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a373">type</a>);
+00240 <font class="comment">// write the sound name</font>
+00241 s.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(const_cast&lt;std::string&amp;&gt;(<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>-&gt;getName()));
+00242
+00243 <font class="comment">// and write the sound data</font>
+00244 <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>-&gt;serial(s);
+00245 }
+00246 }
+00247 }
+00248
+<a name="l00252"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a3">00252</a> <font class="keywordtype">void</font> <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#a3">removed</a>()
+00253 {
+00254 <font class="keywordflow">if</font> (<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a> != 0)
+00255 {
+00256 <font class="comment">// we remove the sound from the bank and delete it.</font>
+00257 CSoundBank::instance()-&gt;removeSound(<a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>-&gt;getName());
+00258 <font class="keyword">delete</font> <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#m0">_Sound</a>;
+00259 }
+00260 }
+00261
+00262 <font class="comment">// return the version of this class, increments this value when the content of this class changed</font>
+<a name="l00263"></a><a class="code" href="classNLSOUND_1_1CSoundSerializer.html#d0">00263</a> <font class="keyword">static</font> uint <a class="code" href="classNLSOUND_1_1CSoundSerializer.html#d0">getVersion</a> () { <font class="keywordflow">return</font> 1; }
+00264 };
+00265
+00266 <font class="comment">// this structure is fill by the loadForm() function and will contain all you need</font>
+00267 std::map&lt;std::string, CSoundSerializer&gt; <a class="code" href="namespaceNLSOUND.html#a74">Container</a>;
+00268
+<a name="l00273"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a5">00273</a> <font class="keywordtype">void</font> CSoundBank::load()
+00274 {
+00275 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNLSOUND_1_1CSoundBank.html#o2">_Loaded</a>);
+00276 <font class="comment">// Just call the GEORGE::loadFrom method to read all available sounds</font>
+00277 ::loadForm(<font class="stringliteral">"sound"</font>, <font class="stringliteral">"sounds.packed_sheets"</font>, <a class="code" href="namespaceNLSOUND.html#a74">Container</a>, <font class="keyword">true</font>);
+00278 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o2">_Loaded</a> = <font class="keyword">true</font>;
+00279 }
+00280
+00281
+00282 <font class="comment">/*</font>
+00283 <font class="comment"> * Unload all the sound samples in this bank.</font>
+00284 <font class="comment"> */</font>
+<a name="l00285"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a6">00285</a> <font class="keywordtype">void</font> CSoundBank::unload()
+00286 {
+00287 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNLSOUND_1_1CSoundBank.html#o2">_Loaded</a>);
+00288 vector&lt;CSound*&gt; vec;
+00289 TSoundTable::iterator map_iter;
+00290
+00291 <font class="keywordflow">for</font> (map_iter = <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.begin(); map_iter != <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.end(); ++map_iter)
+00292 {
+00293 <font class="comment">// We can't delete directly second because the map is based on second-&gt;getName()</font>
+00294 vec.push_back( (*map_iter).second );
+00295 }
+00296
+00297 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.clear();
+00298
+00299 vector&lt;CSound*&gt;::iterator vec_iter;
+00300
+00301 <font class="keywordflow">for</font> (vec_iter = vec.begin(); vec_iter != vec.end(); ++vec_iter)
+00302 {
+00303 CSound *sound = *vec_iter;
+00304 <font class="keyword">delete</font> sound;
+00305 }
+00306
+00307 <a class="code" href="classNLSOUND_1_1CSoundBank.html#o2">_Loaded</a> = <font class="keyword">false</font>;
+00308 }
+00309
+00310 <font class="comment">/*</font>
+00311 <font class="comment"> * Returns true if the samples in this bank have been loaded.</font>
+00312 <font class="comment"> */</font>
+<a name="l00313"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a7">00313</a> <font class="keywordtype">bool</font> CSoundBank::isLoaded()
+00314 {
+00315 <font class="keywordflow">return</font> <a class="code" href="classNLSOUND_1_1CSoundBank.html#o2">_Loaded</a>;
+00316 }
+00317
+00318 <font class="comment">/*</font>
+00319 <font class="comment"> * Return a sound sample corresponding to a name.</font>
+00320 <font class="comment"> */</font>
+<a name="l00321"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a8">00321</a> CSound* CSoundBank::getSound(<font class="keyword">const</font> std::string &amp;name)
+00322 {
+00323 <font class="comment">// Find sound</font>
+00324 TSoundTable::iterator iter = <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.find(name);
+00325 <font class="keywordflow">if</font> ( iter == <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.end() )
+00326 {
+00327 <font class="keywordflow">return</font> 0;
+00328 }
+00329 <font class="keywordflow">else</font>
+00330 {
+00331 <font class="keywordflow">return</font> (*iter).second;
+00332 }
+00333 }
+00334
+<a name="l00338"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a9">00338</a> <font class="keywordtype">void</font> CSoundBank::getNames( std::vector&lt;std::string&gt;&amp; names )
+00339 {
+00340 TSoundTable::const_iterator iter;
+00341 <font class="keywordflow">for</font> (iter = <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.begin(); iter != <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.end(); ++iter)
+00342 {
+00343 names.push_back((*iter).first);
+00344 <font class="comment">//nlwarning("getting sound %s", (*iter).first);</font>
+00345 }
+00346 }
+00347
+00348 <font class="comment">/*</font>
+00349 <font class="comment"> * Return the number of buffers in this bank.</font>
+00350 <font class="comment"> */</font>
+<a name="l00351"></a><a class="code" href="classNLSOUND_1_1CSoundBank.html#a10">00351</a> uint CSoundBank::countSounds()
+00352 {
+00353 <font class="keywordflow">return</font> <a class="code" href="classNLSOUND_1_1CSoundBank.html#o1">_Sounds</a>.size();
+00354 }
+00355
+00356
+00357 } <font class="comment">// namespace NLSOUND</font>
+00358
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>