aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/env__sound__user_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/env__sound__user_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/env__sound__user_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/env__sound__user_8cpp-source.html660
1 files changed, 660 insertions, 0 deletions
diff --git a/docs/doxygen/nel/env__sound__user_8cpp-source.html b/docs/doxygen/nel/env__sound__user_8cpp-source.html
new file mode 100644
index 00000000..e522e0c7
--- /dev/null
+++ b/docs/doxygen/nel/env__sound__user_8cpp-source.html
@@ -0,0 +1,660 @@
+<!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>env_sound_user.cpp</h1><a href="env__sound__user_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="env__sound__user_8h.html">env_sound_user.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="sound_8h.html">sound.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="bounding__shape_8h.html">bounding_shape.h</a>"</font>
+00031 <font class="preprocessor">#include &lt;stdlib.h&gt;</font>
+00032
+00033 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
+00034 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00035
+00036
+00037 <font class="keyword">namespace </font>NLSOUND {
+00038
+00039
+00040 <font class="comment">/*</font>
+00041 <font class="comment"> * Constructor</font>
+00042 <font class="comment"> */</font>
+<a name="l00043"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a0">00043</a> CEnvSoundUser::CEnvSoundUser() : _Play(false), _Source(NULL), _BoundingShape(NULL), _Transition(false), _Parent(NULL), _Mark(false), _Gain(1.0f)
+00044 {
+00045 }
+00046
+00047
+00048 <font class="comment">/*</font>
+00049 <font class="comment"> * Destructor</font>
+00050 <font class="comment"> */</font>
+<a name="l00051"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a1">00051</a> CEnvSoundUser::~CEnvSoundUser()
+00052 {
+00053 vector&lt;CEnvSoundUser*&gt;::iterator ipe;
+00054 <font class="keywordflow">for</font> ( ipe=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipe!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipe )
+00055 {
+00056 <font class="keyword">delete</font> (*ipe);
+00057 }
+00058
+00059 vector&lt;IPlayable*&gt;::iterator ipp;
+00060 <font class="keywordflow">for</font> ( ipp=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.begin(); ipp!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.end(); ++ipp )
+00061 {
+00062 <font class="comment">// An IPlayable object can be a CAmbiantSource or a CSourceUser.</font>
+00063 <font class="comment">// A CAmbiantSource removes its source (channels) in destructor, but not a CSourceUser</font>
+00064 <font class="keywordflow">if</font> ( dynamic_cast&lt;CSourceUser*&gt;(*ipp) )
+00065 {
+00066 CAudioMixerUser::instance()-&gt;removeSource( static_cast&lt;CSourceUser*&gt;(*ipp) );
+00067 }
+00068 <font class="keywordflow">else</font>
+00069 {
+00070 <font class="keywordflow">if</font> ( (*ipp) != NULL )
+00071 {
+00072 <font class="keyword">delete</font> (*ipp);
+00073 }
+00074 }
+00075 }
+00076
+00077 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> != NULL )
+00078 {
+00079 <font class="keyword">delete</font> <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>;
+00080 }
+00081 }
+00082
+00083
+00084 <font class="comment">/*</font>
+00085 <font class="comment"> * Serialize (recursive)</font>
+00086 <font class="comment"> */</font>
+<a name="l00087"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a2">00087</a> <font class="keywordtype">void</font> CEnvSoundUser::serial( <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a244">s</a> )
+00088 {
+00089 <font class="comment">// If you change this, increment the version number in CEnvSoundUser::load() !</font>
+00090
+00091 s.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o5">_Transition</a> );
+00092 s.<a class="code" href="classNLMISC_1_1IStream.html#a28">serialPolyPtr</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> );
+00093 s.<a class="code" href="classNLMISC_1_1IStream.html#a22">serialContPolyPtr</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a> ); <font class="comment">// serializes sound and looping state only</font>
+00094
+00095 <a class="code" href="types__nl_8h.html#a7">uint16</a> srcindex;
+00096
+00097 <font class="keywordflow">if</font> ( s.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() )
+00098 {
+00099 <font class="comment">// Select the source in the bank</font>
+00100 s.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>( srcindex );
+00101 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.empty() )
+00102 {
+00103 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> = <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>[srcindex];
+00104 }
+00105 <font class="keywordflow">else</font>
+00106 {
+00107 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> = NULL;
+00108 }
+00109
+00110 <font class="comment">// Set the position which was not serialized</font>
+00111 <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a>!=NULL) &amp;&amp; (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> != NULL) )
+00112 {
+00113 vector&lt;IPlayable*&gt;::iterator ipp;
+00114 <font class="keywordflow">for</font> ( ipp=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.begin(); ipp!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.end(); ++ipp )
+00115 {
+00116 (*ipp)-&gt;moveTo( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;getCenter() );
+00117 }
+00118 }
+00119
+00120 <font class="comment">// Init the source (not transition)</font>
+00121 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o5">_Transition</a> )
+00122 {
+00123 <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> != NULL) )
+00124 {
+00125 vector&lt;IPlayable*&gt;::iterator ipp;
+00126 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> != NULL )
+00127 {
+00128 <font class="keywordflow">for</font> ( ipp=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.begin(); ipp!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.end(); ++ipp )
+00129 {
+00130 (*ipp)-&gt;initPos( const_cast&lt;CVector*&gt;(&amp;(<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;getCenter())) );
+00131 }
+00132 }
+00133 <font class="keywordflow">else</font>
+00134 {
+00135 <font class="comment">// The world envsound will be heard at the listener</font>
+00136 <font class="keywordflow">for</font> ( ipp=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.begin(); ipp!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.end(); ++ipp )
+00137 {
+00138 (*ipp)-&gt;initPos( &amp;CAudioMixerUser::instance()-&gt;getListenPosVector() );
+00139 }
+00140 }
+00141 }
+00142 }
+00143 }
+00144 <font class="keywordflow">else</font>
+00145 {
+00146 <a class="code" href="types__nl_8h.html#a13">uint</a> i;
+00147 <font class="comment">// Find the index of the current source in the bank and serialize it out</font>
+00148 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.size() != 0 )
+00149 {
+00150 <font class="keywordflow">for</font> ( i=0; i!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.size(); i++ )
+00151 {
+00152 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>[i] == <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> )
+00153 {
+00154 <font class="keywordflow">break</font>;
+00155 }
+00156 }
+00157 <a class="code" href="debug_8h.html#a6">nlassert</a>( i != <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.size() );
+00158 <a class="code" href="debug_8h.html#a6">nlassert</a>( i &lt; 0x10000 ); <font class="comment">// 16-bit value</font>
+00159 srcindex = i;
+00160 }
+00161 <font class="keywordflow">else</font>
+00162 {
+00163 srcindex = 0;
+00164 }
+00165 s.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>( srcindex );
+00166 }
+00167
+00168 <font class="comment">// Tags</font>
+00169 s.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o3">_Tags</a> );
+00170 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00171 <font class="preprocessor"></font> <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;display( <font class="stringliteral">"Envsound tags:"</font>);
+00172 vector&lt;string&gt;::iterator ist;
+00173 <font class="keywordflow">for</font> ( ist=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o3">_Tags</a>.begin(); ist!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o3">_Tags</a>.end(); ++ist )
+00174 {
+00175 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;displayRaw( (<font class="stringliteral">" "</font> + (*ist)).c_str() );
+00176 }
+00177 <a class="code" href="namespaceNLMISC.html#a11">DebugLog</a>-&gt;displayRawNL(<font class="stringliteral">""</font>);
+00178 <font class="preprocessor">#endif</font>
+00179 <font class="preprocessor"></font>
+00180 <font class="comment">// Children envsounds</font>
+00181 s.<a class="code" href="classNLMISC_1_1IStream.html#a27">serialPtr</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a> );
+00182 s.<a class="code" href="classNLMISC_1_1IStream.html#a17">serialContPtr</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a> );
+00183 }
+00184
+00185
+00186 <font class="comment">/*</font>
+00187 <font class="comment"> * Select current env</font>
+00188 <font class="comment"> */</font>
+<a name="l00189"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a5">00189</a> <font class="keywordtype">void</font> CEnvSoundUser::selectEnv( <font class="keyword">const</font> <font class="keywordtype">char</font> *tag, <font class="keywordtype">bool</font> children_too )
+00190 {
+00191 <a class="code" href="types__nl_8h.html#a13">uint</a> i;
+00192 <font class="keywordflow">for</font> ( i=0; i!= <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o3">_Tags</a>.size(); i++ )
+00193 {
+00194 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o3">_Tags</a>[i] == string(tag) )
+00195 {
+00196 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> != NULL )
+00197 {
+00198 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a>-&gt;enable( <font class="keyword">false</font>, 1.0f );
+00199 }
+00200 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> = <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>[i];
+00201 <a class="code" href="debug_8h.html#a0">nldebug</a>( <font class="stringliteral">"AM: EnvSound: Environment changed to %s"</font>, tag );
+00202 CAudioMixerUser::instance()-&gt;getEnvSounds()-&gt;recompute();
+00203 <font class="keywordflow">break</font>;
+00204 }
+00205 }
+00206 <font class="comment">//nldebug( "AM: EnvSound: Environment %s not found", tag );</font>
+00207 <font class="comment">// Don't change _Source if not found</font>
+00208
+00209 <font class="comment">// Apply to descendants</font>
+00210 <font class="keywordflow">if</font> ( children_too )
+00211 {
+00212 vector&lt;CEnvSoundUser*&gt;::iterator ipc;
+00213 <font class="keywordflow">for</font> ( ipc=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipc!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipc )
+00214 {
+00215 (*ipc)-&gt;selectEnv( tag, children_too );
+00216 }
+00217 }
+00218 }
+00219
+00220
+00221 <font class="comment">/*</font>
+00222 <font class="comment"> * Serialize file header</font>
+00223 <font class="comment"> */</font>
+<a name="l00224"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#d0">00224</a> <font class="keywordtype">void</font> CEnvSoundUser::serialFileHeader( <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a244">s</a> )
+00225 {
+00226 <font class="comment">// Envsounds file header</font>
+00227 s.<a class="code" href="classNLMISC_1_1IStream.html#a30">serialCheck</a>( (<a class="code" href="types__nl_8h.html#a9">uint32</a>)'SEN' ); <font class="comment">// NeL Environment Sounds</font>
+00228 <font class="keywordflow">if</font> ( s.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>( 2 ) &lt; 2 )
+00229 {
+00230 <font class="keywordflow">throw</font> EOlderStream(s);
+00231 }
+00232
+00233 <font class="comment">// Check CSound version (and prepare CSound::serial() backward compatibility)</font>
+00234 CSound::FileVersion = s.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>( CSound::CurrentVersion );
+00235 <font class="keywordflow">if</font> ( CSound::FileVersion == 0 ) <font class="comment">// warning: not multithread-compliant</font>
+00236 {
+00237 <font class="comment">// Not supporting version 0 anymore</font>
+00238 <font class="keywordflow">throw</font> EOlderStream(s);
+00239 }
+00240 }
+00241
+00242
+00243 <font class="comment">/*</font>
+00244 <font class="comment"> * Count the envs in the tree (call on the root)</font>
+00245 <font class="comment"> */</font>
+<a name="l00246"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b4">00246</a> <a class="code" href="types__nl_8h.html#a9">uint32</a> CEnvSoundUser::getCount()<font class="keyword"> const</font>
+00247 <font class="keyword"></font>{
+00248 <a class="code" href="types__nl_8h.html#a9">uint32</a> cnt=1;
+00249 vector&lt;CEnvSoundUser*&gt;::const_iterator ipe;
+00250 <font class="keywordflow">for</font> ( ipe=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipe!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipe )
+00251 {
+00252 cnt += (*ipe)-&gt;getCount();
+00253 }
+00254 <font class="keywordflow">return</font> cnt;
+00255 }
+00256
+00257
+00258 <font class="comment">/*</font>
+00259 <font class="comment"> * Load several envsounds and return the number of envsounds loaded</font>
+00260 <font class="comment"> */</font>
+<a name="l00261"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#d1">00261</a> <a class="code" href="types__nl_8h.html#a9">uint32</a> CEnvSoundUser::load( CEnvSoundUser* &amp;envSoundTreeRoot, <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a244">s</a> )
+00262 {
+00263 <font class="keywordflow">if</font> ( s.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() )
+00264 {
+00265 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#d0">serialFileHeader</a>( s );
+00266 s.<a class="code" href="classNLMISC_1_1IStream.html#a27">serialPtr</a>( envSoundTreeRoot );
+00267 <font class="keywordflow">return</font> envSoundTreeRoot-&gt;getCount();
+00268
+00269 <font class="comment">// Reset CSound version</font>
+00270 CSound::FileVersion = CSound::CurrentVersion; <font class="comment">// warning: not multithread-compliant : do not serialize in different threads !</font>
+00271 }
+00272 <font class="keywordflow">else</font>
+00273 {
+00274 <a class="code" href="debug_8h.html#a12">nlstop</a>;
+00275 <font class="keywordflow">return</font> 0;
+00276 }
+00277 }
+00278
+00279
+00280 <font class="comment">/*</font>
+00281 <font class="comment"> * Update the stereo mixes (call evenly on the root) (recursive)</font>
+00282 <font class="comment"> */</font>
+<a name="l00283"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a8">00283</a> <font class="keywordtype">void</font> CEnvSoundUser::update()
+00284 {
+00285 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> != NULL )
+00286 {
+00287 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a>-&gt;update();
+00288 }
+00289 vector&lt;CEnvSoundUser*&gt;::iterator ipe;
+00290 <font class="keywordflow">for</font> ( ipe=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipe!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipe )
+00291 {
+00292 (*ipe)-&gt;update();
+00293 }
+00294 }
+00295
+00296
+00297 <font class="comment">/*</font>
+00298 <font class="comment"> * Find the area where the listener is located (recursive)</font>
+00299 <font class="comment"> */</font>
+<a name="l00300"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b2">00300</a> CEnvSoundUser *CEnvSoundUser::findCurrentEnv( <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>&amp; listenerpos )
+00301 {
+00302 <font class="comment">// Find in children first (check from leaves to root)</font>
+00303 vector&lt;CEnvSoundUser*&gt;::iterator ipe = <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin();
+00304 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a0">CEnvSoundUser</a> *found = NULL;
+00305 <font class="keywordflow">while</font> ( ! ( (found) || (ipe==<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end()) ) )
+00306 {
+00307 found = (*ipe)-&gt;findCurrentEnv( listenerpos );
+00308 ipe++;
+00309 }
+00310 <font class="keywordflow">if</font> ( found )
+00311 <font class="keywordflow">return</font> found;
+00312 <font class="keywordflow">else</font> <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> == NULL) || (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;include( listenerpos )) )
+00313 <font class="keywordflow">return</font> <font class="keyword">this</font>;
+00314 <font class="keywordflow">else</font>
+00315 <font class="keywordflow">return</font> NULL;
+00316 }
+00317
+00318
+00319 <font class="comment">/*</font>
+00320 <font class="comment"> * Return the position</font>
+00321 <font class="comment"> */</font>
+<a name="l00322"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a3">00322</a> <font class="keywordtype">void</font> CEnvSoundUser::getPos( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>&amp; pos )<font class="keyword"> const</font>
+00323 <font class="keyword"></font>{
+00324 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> == NULL )
+00325 {
+00326 pos = CVector::Null;
+00327 }
+00328 <font class="keywordflow">else</font>
+00329 {
+00330 pos = <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;getCenter();
+00331 }
+00332 }
+00333
+00334
+00335 <font class="comment">/*</font>
+00336 <font class="comment"> * Moves the envsound (and its transition envsound if it has one)</font>
+00337 <font class="comment"> */</font>
+<a name="l00338"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a4">00338</a> <font class="keywordtype">void</font> CEnvSoundUser::setPos( <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>&amp; pos )
+00339 {
+00340 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> != NULL )
+00341 {
+00342 <font class="comment">// Get the vector between the pos of this envsound and the pos of its transition envsound</font>
+00343 CVector newpos;
+00344 <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a> != NULL) &amp;&amp; ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Transition ) )
+00345 {
+00346 newpos = pos + <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_BoundingShape-&gt;getCenter() - <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;getCenter();
+00347 }
+00348 <font class="keywordflow">else</font>
+00349 {
+00350 newpos = pos;
+00351 }
+00352
+00353 <font class="comment">// Set the new pos</font>
+00354 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;setCenter( pos );
+00355 <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a> != NULL) &amp;&amp; ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Transition ) )
+00356 {
+00357 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_BoundingShape-&gt;setCenter( newpos );
+00358 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Source != NULL )
+00359 {
+00360 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Source-&gt;moveTo( newpos );
+00361 }
+00362 }
+00363
+00364 <font class="comment">// Recompute the entire tree</font>
+00365 CAudioMixerUser::instance()-&gt;getEnvSounds()-&gt;recompute();
+00366 }
+00367 }
+00368
+00369
+00370 <font class="comment">/*</font>
+00371 <font class="comment"> * Return the children envsounds</font>
+00372 <font class="comment"> */</font>
+<a name="l00373"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a6">00373</a> std::vector&lt;UEnvSound*&gt;&amp; CEnvSoundUser::getChildren()
+00374 {
+00375 <font class="keywordflow">return</font> (vector&lt;UEnvSound*&gt;&amp;)(_Children);
+00376 }
+00377
+00378
+00379 <font class="comment">/*</font>
+00380 <font class="comment"> * Play or stop the sources (call only on the root env)</font>
+00381 <font class="comment"> */</font>
+<a name="l00382"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a7">00382</a> <font class="keywordtype">void</font> CEnvSoundUser::recompute()
+00383 {
+00384 <a class="code" href="debug_8h.html#a6">nlassert</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b0">isRoot</a>() );
+00385
+00386 <font class="comment">// Find the area of the listener</font>
+00387 CVector listenerpos;
+00388 CAudioMixerUser::instance()-&gt;getListener()-&gt;getPos( listenerpos );
+00389 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a0">CEnvSoundUser</a> *current = <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b2">findCurrentEnv</a>( listenerpos );
+00390
+00391 <font class="comment">// Mark the envs that have to play their source</font>
+00392 <font class="keywordflow">if</font> ( current != NULL )
+00393 {
+00394 current-&gt;markSources( listenerpos, 1.0f );
+00395 }
+00396
+00397 <font class="comment">// Enable/disable the sources in the hierarchy, and reset the marks</font>
+00398 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b1">applySourcesMarks</a>();
+00399 }
+00400
+00401
+00402 <font class="comment">/* Prepare the related sources to play (recursive).</font>
+00403 <font class="comment"> * In each children branch, there must be an env which is not a transition, for the recursion to stop</font>
+00404 <font class="comment"> */</font>
+<a name="l00405"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b3">00405</a> <font class="keywordtype">void</font> CEnvSoundUser::markSources( <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>&amp; listenerpos, <font class="keywordtype">float</font> gain )
+00406 {
+00407 <font class="comment">// Is the listener in a transition area ?</font>
+00408 <font class="keywordflow">if</font> ( _Transition )
+00409 {
+00410 <font class="comment">//nldebug( "AM: EnvSound: Marking sources for transition between child and parent" );</font>
+00411
+00412 <font class="comment">// Compute the listener position to find the ratio between up and down envs</font>
+00413 <a class="code" href="debug_8h.html#a6">nlassert</a>( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.size() == 1) &amp;&amp; (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>[0] != NULL) &amp;&amp; (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a> != NULL) );
+00414 <a class="code" href="debug_8h.html#a6">nlassert</a>( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> &amp;&amp; <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>[0]-&gt;<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> );
+00415 <font class="keywordtype">float</font> ratio = <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a>-&gt;getRatio( listenerpos, <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>[0]-&gt;<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> );
+00416 <a class="code" href="debug_8h.html#a6">nlassert</a>( ratio &gt;= 0.0f &amp;&amp; ratio &lt;= 1.0f );
+00417
+00418 <font class="comment">// The child env plays at gain*ratio</font>
+00419 <font class="comment">// The recursion stops because the child env is not a transition area</font>
+00420 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>[0]-&gt;markSources( listenerpos, gain * ratio );
+00421
+00422 <font class="comment">// The parent env (therefore the 3d source of the current env as well) plays at gain*(1-ratio)</font>
+00423 <font class="comment">// The recursion stops because the parent env is not a transition area</font>
+00424 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;markSources( listenerpos, gain * (1.0f-ratio) );
+00425 }
+00426 <font class="keywordflow">else</font>
+00427 {
+00428 <font class="comment">//nldebug( "AM: EnvSound: Marking sources for environnement" );</font>
+00429
+00430 <font class="comment">// The listener in an environment, containing other environments (e.g. a town) or not (e.g. a room).</font>
+00431 <font class="comment">// The current env plays</font>
+00432 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o8">_Mark</a> = <font class="keyword">true</font>;
+00433 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o9">_Gain</a> = gain;
+00434
+00435 <font class="comment">// The children env (next level only) play</font>
+00436 vector&lt;CEnvSoundUser*&gt;::iterator ipe;
+00437 <font class="keywordflow">for</font>( ipe=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipe!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipe )
+00438 {
+00439 (*ipe)-&gt;_Mark = <font class="keyword">true</font>;
+00440 (*ipe)-&gt;_Gain = gain;
+00441 }
+00442 }
+00443 }
+00444
+00445
+00446 <font class="comment">/*</font>
+00447 <font class="comment"> * Enable/disable the source and set general gain if enabled, and reset the source mark (recursive)</font>
+00448 <font class="comment"> */</font>
+<a name="l00449"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b1">00449</a> <font class="keywordtype">void</font> CEnvSoundUser::applySourcesMarks()
+00450 {
+00451 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o0">_Play</a> )
+00452 {
+00453 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o8">_Mark</a> = <font class="keyword">false</font>;
+00454 }
+00455 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> != NULL )
+00456 {
+00457 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a>-&gt;enable( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o8">_Mark</a>, <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o9">_Gain</a> );
+00458 }
+00459 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o8">_Mark</a> = <font class="keyword">false</font>;
+00460
+00461 <font class="comment">// Apply on children</font>
+00462 vector&lt;CEnvSoundUser*&gt;::iterator ipe;
+00463 <font class="keywordflow">for</font> ( ipe=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipe!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipe )
+00464 {
+00465 (*ipe)-&gt;applySourcesMarks();
+00466 }
+00467 }
+00468
+00469
+00470 <font class="comment">/*</font>
+00471 <font class="comment"> * Set properties (EDIT)</font>
+00472 <font class="comment"> */</font>
+<a name="l00473"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a12">00473</a> <font class="keywordtype">void</font> CEnvSoundUser::setProperties( <font class="keywordtype">bool</font> transition, IBoundingShape *bshape )
+00474 {
+00475 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o5">_Transition</a> = transition;
+00476 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o4">_BoundingShape</a> = bshape;
+00477 }
+00478
+00479
+00480 <font class="comment">/*</font>
+00481 <font class="comment"> * Add an environment source/tag (EDIT) (set a NULL source for no source at all)</font>
+00482 <font class="comment"> * The current source always becomes the first one.</font>
+00483 <font class="comment"> */</font>
+<a name="l00484"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a14">00484</a> <font class="keywordtype">void</font> CEnvSoundUser::addEnvTag( IPlayable *source, <font class="keyword">const</font> std::string&amp; tag )
+00485 {
+00486 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o2">_SrcBank</a>.push_back( source );
+00487 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o3">_Tags</a>.push_back( tag );
+00488
+00489 <font class="keywordflow">if</font> ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> == NULL ) <font class="comment">// becomes the first one and stays there</font>
+00490 {
+00491 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o1">_Source</a> = source;
+00492 }
+00493 }
+00494
+00495
+00496 <font class="comment">/*</font>
+00497 <font class="comment"> * Save (output stream only) (EDIT)</font>
+00498 <font class="comment"> */</font>
+<a name="l00499"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#d2">00499</a> <font class="keywordtype">void</font> CEnvSoundUser::save( CEnvSoundUser *envSoundTreeRoot, <a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a244">s</a> )
+00500 {
+00501 <a class="code" href="debug_8h.html#a6">nlassert</a>( ! s.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>() );
+00502 <a class="code" href="debug_8h.html#a6">nlassert</a>( envSoundTreeRoot-&gt;isRoot() );
+00503
+00504 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#d0">serialFileHeader</a>( s );
+00505 s.<a class="code" href="classNLMISC_1_1IStream.html#a27">serialPtr</a>( envSoundTreeRoot );
+00506 }
+00507
+00508
+00509 <font class="comment">/*</font>
+00510 <font class="comment"> * Play</font>
+00511 <font class="comment"> */</font>
+<a name="l00512"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a9">00512</a> <font class="keywordtype">void</font> CEnvSoundUser::play( <font class="keywordtype">bool</font> children_too )
+00513 {
+00514 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b5">playSub</a>( children_too );
+00515
+00516 CAudioMixerUser::instance()-&gt;getEnvSounds()-&gt;recompute();
+00517 }
+00518
+00519
+00520 <font class="comment">/*</font>
+00521 <font class="comment"> * Stop playing</font>
+00522 <font class="comment"> */</font>
+<a name="l00523"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a10">00523</a> <font class="keywordtype">void</font> CEnvSoundUser::stop( <font class="keywordtype">bool</font> children_too )
+00524 {
+00525 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b6">stopSub</a>( children_too );
+00526
+00527 CAudioMixerUser::instance()-&gt;getEnvSounds()-&gt;recompute();
+00528 }
+00529
+00530
+00531 <font class="comment">/*</font>
+00532 <font class="comment"> * Play this node, and all descendants if children_too is true, but do not recompute</font>
+00533 <font class="comment"> */</font>
+<a name="l00534"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b5">00534</a> <font class="keywordtype">void</font> CEnvSoundUser::playSub( <font class="keywordtype">bool</font> children_too )
+00535 {
+00536 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o0">_Play</a> = <font class="keyword">true</font>;
+00537
+00538 <font class="comment">// Start transition as well</font>
+00539 <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a> != NULL) &amp;&amp; ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Transition ) )
+00540 {
+00541 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Play = <font class="keyword">true</font>;
+00542 }
+00543
+00544 <font class="comment">// Apply to descendants</font>
+00545 <font class="keywordflow">if</font> ( children_too )
+00546 {
+00547 vector&lt;CEnvSoundUser*&gt;::iterator ipc;
+00548 <font class="keywordflow">for</font> ( ipc=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipc!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipc )
+00549 {
+00550 (*ipc)-&gt;playSub( children_too );
+00551 }
+00552 }
+00553 }
+00554
+00555
+00556 <font class="comment">/*</font>
+00557 <font class="comment"> * Stop playing this node, and all descendants if children_too is true, but do not recompute</font>
+00558 <font class="comment"> */</font>
+<a name="l00559"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#b6">00559</a> <font class="keywordtype">void</font> CEnvSoundUser::stopSub( <font class="keywordtype">bool</font> children_too )
+00560 {
+00561 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o0">_Play</a> = <font class="keyword">false</font>;
+00562
+00563 <font class="comment">// Stop transition as well</font>
+00564 <font class="keywordflow">if</font> ( (<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a> != NULL) &amp;&amp; ( <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Transition ) )
+00565 {
+00566 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o6">_Parent</a>-&gt;_Play = <font class="keyword">false</font>;
+00567 }
+00568
+00569 <font class="comment">// Apply to descendants</font>
+00570 <font class="keywordflow">if</font> ( children_too )
+00571 {
+00572 vector&lt;CEnvSoundUser*&gt;::iterator ipc;
+00573 <font class="keywordflow">for</font> ( ipc=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.begin(); ipc!=<a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.end(); ++ipc )
+00574 {
+00575 (*ipc)-&gt;stopSub( children_too );
+00576 }
+00577 }
+00578 }
+00579
+00580
+00581 <font class="comment">/*</font>
+00582 <font class="comment"> * Add a child (EDIT)</font>
+00583 <font class="comment"> */</font>
+<a name="l00584"></a><a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#a13">00584</a> <font class="keywordtype">void</font> CEnvSoundUser::addChild( CEnvSoundUser *child )
+00585 {
+00586 child-&gt;_Parent = <font class="keyword">this</font>;
+00587 <a class="code" href="classNLSOUND_1_1CEnvSoundUser.html#o7">_Children</a>.push_back( child );
+00588 }
+00589
+00590
+00591 } <font class="comment">// NLSOUND</font>
+</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>