aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/ps__sound_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/ps__sound_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/ps__sound_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/ps__sound_8cpp-source.html442
1 files changed, 442 insertions, 0 deletions
diff --git a/docs/doxygen/nel/ps__sound_8cpp-source.html b/docs/doxygen/nel/ps__sound_8cpp-source.html
new file mode 100644
index 00000000..71a35432
--- /dev/null
+++ b/docs/doxygen/nel/ps__sound_8cpp-source.html
@@ -0,0 +1,442 @@
+<!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>ps_sound.cpp</h1><a href="ps__sound_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2000, 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="std3d_8h.html">std3d.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="ps__sound_8h.html">3d/ps_sound.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="particle__system_8h.html">3d/particle_system.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="u__ps__sound__interface_8h.html">nel/3d/u_ps_sound_interface.h</a>"</font>
+00031 <font class="preprocessor">#include "<a class="code" href="ps__attrib__maker_8h.html">3d/ps_attrib_maker.h</a>"</font>
+00032
+00033
+00034 <font class="keyword">namespace </font>NL3D
+00035 {
+00036
+00037
+00038 <font class="comment">// we batch computation of Gains and frequencies. Here is the buffer size:</font>
+00039 <font class="keyword">static</font> <font class="keyword">const</font> uint <a class="code" href="namespaceNL3D.html#a220">SoundBufSize</a> = 1024;
+00040
+00041
+<a name="l00042"></a><a class="code" href="classNL3D_1_1CPSSound.html#z735_0">00042</a> CPSSound::CPSSound() : _Gain(1.f),
+00043 _GainScheme(NULL),
+00044 _Pitch(1.f),
+00045 _PitchScheme(NULL),
+00046 _EmissionPercent(1),
+00047 _SpawnSounds(false),
+00048 _Mute(false),
+00049 _SoundStopped(false),
+00050 _SoundReactivated(false)
+00051 {
+00052 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n3">_Name</a> = std::string(<font class="stringliteral">"sound"</font>);
+00053 }
+00054
+00055
+00056
+<a name="l00057"></a><a class="code" href="classNL3D_1_1CPSSound.html#a21">00057</a> <font class="keywordtype">void</font> CPSSound::stopSound()
+00058 {
+00059
+00060 <font class="keywordflow">if</font> (_SoundStopped) <font class="keywordflow">return</font>;
+00061 CPSAttrib&lt;UPSSoundInstance *&gt;::iterator it = <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.begin()
+00062 , endIt = <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.end();
+00063 <font class="keywordflow">while</font> (it != endIt)
+00064 {
+00065 <font class="keywordflow">if</font> (*it)
+00066 {
+00067 (*it)-&gt;stop();
+00068 }
+00069 ++it;
+00070 }
+00071 <a class="code" href="classNL3D_1_1CPSSound.html#n9">_SoundStopped</a> = <font class="keyword">true</font>;
+00072 }
+00073
+<a name="l00074"></a><a class="code" href="classNL3D_1_1CPSSound.html#a22">00074</a> <font class="keywordtype">void</font> CPSSound::reactivateSound()
+00075 {
+00076 <font class="comment">//if (!_SoundStopped) return; </font>
+00077 <a class="code" href="classNL3D_1_1CPSSound.html#n10">_SoundReactivated</a> = <font class="keyword">true</font>;
+00078 }
+00079
+<a name="l00080"></a><a class="code" href="classNL3D_1_1CPSSound.html#b3">00080</a> <font class="keywordtype">void</font> CPSSound::removeAllSources(<font class="keywordtype">void</font>)
+00081 {
+00082 <font class="keyword">const</font> sint32 size = <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.getSize();
+00083 <font class="comment">// delete all sounds, and rebuild them all </font>
+00084 <font class="keywordflow">for</font> (sint32 k = size - 1; k &gt;= 0; --k)
+00085 {
+00086 <a class="code" href="classNL3D_1_1CPSSound.html#b1">deleteElement</a>(k);
+00087 }
+00088 }
+00089
+<a name="l00090"></a><a class="code" href="classNL3D_1_1CPSSound.html#z735_1">00090</a> CPSSound::~CPSSound()
+00091 {
+00092 <a class="code" href="classNL3D_1_1CPSSound.html#b3">removeAllSources</a>();
+00093 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>;
+00094 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>;
+00095 }
+00096
+<a name="l00097"></a><a class="code" href="classNL3D_1_1CPSSound.html#a0">00097</a> uint32 CPSSound::getType(<font class="keywordtype">void</font>)<font class="keyword"> const</font>
+00098 <font class="keyword"></font>{
+00099 <font class="keywordflow">return</font> <a class="code" href="namespaceNL3D.html#a207">PSSound</a>;
+00100 }
+00101
+<a name="l00102"></a><a class="code" href="classNL3D_1_1CPSSound.html#a2">00102</a> <font class="keywordtype">void</font> CPSSound::step(<a class="code" href="namespaceNL3D.html#a484">TPSProcessPass</a> pass, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> ellapsedTime, <a class="code" href="namespaceNL3D.html#a1">TAnimationTime</a> realEt)
+00103 {
+00104 <font class="keywordflow">if</font> (pass != <a class="code" href="namespaceNL3D.html#a484a168">PSMotion</a>) <font class="keywordflow">return</font>;
+00105 <font class="keyword">const</font> uint32 size = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSize();
+00106 <font class="keywordflow">if</font> (!size) <font class="keywordflow">return</font>;
+00107
+00108
+00109
+00110
+00111 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n9">_SoundStopped</a> &amp;&amp; !<a class="code" href="classNL3D_1_1CPSSound.html#n10">_SoundReactivated</a>)
+00112 {
+00113 <font class="keywordflow">return</font>;
+00114 }
+00115
+00116 <font class="keywordflow">if</font> (_SoundReactivated)
+00117 {
+00118 <a class="code" href="classNL3D_1_1CPSSound.html#n9">_SoundStopped</a> = <font class="keyword">false</font>;
+00119 <a class="code" href="classNL3D_1_1CPSSound.html#n10">_SoundReactivated</a> = <font class="keyword">false</font>;
+00120 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSSound.html#n8">_Mute</a>)
+00121 {
+00122 sint32 k;
+00123 <font class="comment">// delete all sounds, and rebuild them all </font>
+00124 <a class="code" href="classNL3D_1_1CPSSound.html#b3">removeAllSources</a>();
+00125 <font class="keywordflow">for</font> (k = 0; k &lt; (sint32) size; ++k)
+00126 {
+00127 <a class="code" href="classNL3D_1_1CPSSound.html#b0">newElement</a>(NULL, 0);
+00128 }
+00129
+00130 }
+00131 }
+00132
+00133
+00134
+00135
+00136 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+00137 uint32 toProcess, leftToDo = size;
+00138
+00139 <font class="keywordtype">float</font> Gains[<a class="code" href="namespaceNL3D.html#a220">SoundBufSize</a>];
+00140 <font class="keywordtype">float</font> frequencies[<a class="code" href="namespaceNL3D.html#a220">SoundBufSize</a>];
+00141
+00142 uint GainPtInc = <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> ? 1 : 0;
+00143 uint frequencyPtInc = <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> ? 1 : 0;
+00144 <font class="keywordtype">float</font> *currVol, *currFrequency;
+00145
+00146
+00147 CPSAttrib&lt;UPSSoundInstance *&gt;::iterator it = <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.begin()
+00148 , endIt = <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.end();
+00149
+00150 CPSAttrib&lt;NLMISC::CVector&gt;::const_iterator posIt = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos().begin();
+00151 CPSAttrib&lt;NLMISC::CVector&gt;::const_iterator speedIt = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed().begin();
+00152
+00153 <font class="keywordflow">do</font>
+00154 {
+00155 toProcess = leftToDo &gt; <a class="code" href="namespaceNL3D.html#a220">SoundBufSize</a> ? <a class="code" href="namespaceNL3D.html#a220">SoundBufSize</a> : leftToDo;
+00156 <font class="comment">// compute Gain </font>
+00157 currVol = <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> ? (<font class="keywordtype">float</font> *) <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a25">getOwner</a>(), size - leftToDo, Gains, <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>)
+00158 : &amp;<a class="code" href="classNL3D_1_1CPSSound.html#n2">_Gain</a>;
+00159 <font class="comment">// compute frequency</font>
+00160 currFrequency = <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> ? (<font class="keywordtype">float</font> *) <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;make(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a25">getOwner</a>(), size - leftToDo, frequencies, <font class="keyword">sizeof</font>(<font class="keywordtype">float</font>), toProcess, <font class="keyword">true</font>)
+00161 : &amp;<a class="code" href="classNL3D_1_1CPSSound.html#n4">_Pitch</a>;
+00162
+00163 endIt = it + toProcess;
+00164
+00165 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;isInSystemBasis())
+00166 {
+00167 <font class="keywordflow">do</font>
+00168 {
+00169 <font class="keywordflow">if</font> (*it) <font class="comment">// was this sound instanciated?</font>
+00170 {
+00171 (*it)-&gt;setSoundParams(*currVol
+00172 , *posIt
+00173 , *speedIt
+00174 , *currFrequency);
+00175 }
+00176 currVol += GainPtInc;
+00177 currFrequency += frequencyPtInc;
+00178 ++posIt;
+00179 ++speedIt;
+00180 ++it;
+00181 }
+00182 <font class="keywordflow">while</font> (it != endIt);
+00183 }
+00184 <font class="keywordflow">else</font>
+00185 {
+00186 <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> m = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getSysMat();
+00187 <font class="keywordflow">do</font>
+00188 {
+00189 <font class="keywordflow">if</font> (*it) <font class="comment">// was this sound instanciated?</font>
+00190 {
+00191 (*it)-&gt;setSoundParams(*currVol
+00192 , m * *posIt
+00193 , *speedIt
+00194 , *currFrequency);
+00195 }
+00196 currVol += GainPtInc;
+00197 currFrequency += frequencyPtInc;
+00198 ++posIt;
+00199 ++speedIt;
+00200 ++it;
+00201 }
+00202 <font class="keywordflow">while</font> (it != endIt);
+00203 }
+00204
+00205
+00206 leftToDo -= toProcess;
+00207 }
+00208 <font class="keywordflow">while</font> (leftToDo);
+00209
+00210 }
+00211
+<a name="l00212"></a><a class="code" href="classNL3D_1_1CPSSound.html#a5">00212</a> <font class="keywordtype">void</font> CPSSound::setGain(<font class="keywordtype">float</font> Gain)
+00213 {
+00214 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>;
+00215 <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> = NULL;
+00216 <a class="code" href="classNL3D_1_1CPSSound.html#n2">_Gain</a> = Gain;
+00217 }
+00218
+00219
+<a name="l00220"></a><a class="code" href="classNL3D_1_1CPSSound.html#a7">00220</a> <font class="keywordtype">void</font> CPSSound::setGainScheme(CPSAttribMaker&lt;float&gt; *Gain)
+00221 {
+00222 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>;
+00223 <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> = Gain;
+00224 }
+00225
+00226
+00227
+00228
+<a name="l00229"></a><a class="code" href="classNL3D_1_1CPSSound.html#a10">00229</a> <font class="keywordtype">void</font> CPSSound::setPitch(<font class="keywordtype">float</font> pitch)
+00230 {
+00231 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>;
+00232 <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> = NULL;
+00233 <a class="code" href="classNL3D_1_1CPSSound.html#n4">_Pitch</a> = pitch;
+00234 }
+00235
+<a name="l00236"></a><a class="code" href="classNL3D_1_1CPSSound.html#a12">00236</a> <font class="keywordtype">void</font> CPSSound::setPitchScheme(CPSAttribMaker&lt;float&gt; *pitch)
+00237 {
+00238 <font class="keyword">delete</font> <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>;
+00239 <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> = pitch;
+00240 }
+00241
+00242
+00243
+00244
+<a name="l00245"></a><a class="code" href="classNL3D_1_1CPSSound.html#z735_2">00245</a> <font class="keywordtype">void</font> CPSSound::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f) <font class="keywordflow">throw</font>(NLMISC::EStream)
+00246 {
+00247 CPSLocatedBindable::serial(f);
+00248 sint ver = f.serialVersion(2);
+00249 f.serial(_SoundName);
+00250 sint32 nbSounds;
+00251 <font class="keywordtype">bool</font> hasScheme;
+00252 <font class="keywordflow">if</font> (f.isReading())
+00253 {
+00254 f.serial(nbSounds); <font class="comment">// we are very unlikely to save a system with sounds being played in it,</font>
+00255 <font class="comment">// but we need to keep datas coherency.</font>
+00256 <font class="keywordflow">if</font> (_Owner)
+00257 {
+00258 _Sounds.resize(_Owner-&gt;getMaxSize());
+00259 }
+00260 }
+00261 <font class="keywordflow">else</font>
+00262 {
+00263 nbSounds = _Sounds.getSize(); <font class="comment">// number of used sound</font>
+00264 f.serial(nbSounds);
+00265 }
+00266
+00267
+00268 <font class="keywordflow">if</font> (f.isReading())
+00269 {
+00270 <font class="keyword">delete</font> _GainScheme;
+00271 _GainScheme = NULL;
+00272 <font class="keyword">delete</font> _PitchScheme;
+00273 _PitchScheme = NULL;
+00274 }
+00275 <font class="comment">// save Gain infos</font>
+00276 hasScheme = _GainScheme != NULL;
+00277 f.serial(hasScheme);
+00278 <font class="keywordflow">if</font> (hasScheme)
+00279 {
+00280 f.serialPolyPtr(_GainScheme);
+00281 }
+00282 <font class="keywordflow">else</font>
+00283 {
+00284 f.serial(_Gain);
+00285 }
+00286 <font class="comment">// save frequency infos</font>
+00287 hasScheme = _PitchScheme != NULL;
+00288 f.serial(hasScheme);
+00289 <font class="keywordflow">if</font> (hasScheme)
+00290 {
+00291 f.serialPolyPtr(_PitchScheme);
+00292 }
+00293 <font class="keywordflow">else</font>
+00294 {
+00295 f.serial(_Pitch);
+00296 }
+00297
+00298 <font class="keywordflow">if</font> (f.isReading())
+00299 {
+00300 _SoundStopped = <font class="keyword">false</font>;
+00301 }
+00302
+00303
+00304 <font class="keywordflow">if</font> (ver &gt; 1)
+00305 {
+00306 f.serial(_EmissionPercent);
+00307 f.serial(_SpawnSounds);
+00308 }
+00309
+00310 <font class="keywordflow">if</font> (f.isReading())
+00311 {
+00312 <font class="keywordflow">for</font> (sint k = 0; k &lt; nbSounds; ++k)
+00313 {
+00314 newElement(NULL, 0);
+00315 }
+00316 }
+00317 }
+00318
+00319
+<a name="l00320"></a><a class="code" href="classNL3D_1_1CPSSound.html#b0">00320</a> <font class="keywordtype">void</font> CPSSound::newElement(CPSLocated *emitterLocated, uint32 emitterIndex)
+00321 {
+00322 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>);
+00323 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;newElement(emitterLocated, emitterIndex);
+00324 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;newElement(emitterLocated, emitterIndex);
+00325 <font class="comment">// if there's a sound server, we generate a new sound instance</font>
+00326 <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CPSSound.html#n8">_Mute</a> &amp;&amp; !<a class="code" href="classNL3D_1_1CPSSound.html#n9">_SoundStopped</a> &amp;&amp; CParticleSystem::getSoundServer())
+00327 {
+00328 <font class="keywordflow">if</font> ((rand() % 99) * 0.01f &lt; <a class="code" href="classNL3D_1_1CPSSound.html#n6">_EmissionPercent</a>)
+00329 {
+00330 uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.insert(CParticleSystem::getSoundServer()-&gt;createSound(<a class="code" href="classNL3D_1_1CPSSound.html#n1">_SoundName</a>, <a class="code" href="classNL3D_1_1CPSSound.html#n7">_SpawnSounds</a>));
+00332
+00333 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>])
+00334 {
+00335 <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;mat = <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;isInSystemBasis() ? <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getOwner()-&gt;getSysMat() : <a class="code" href="classNLMISC_1_1CMatrix.html#p0">NLMISC::CMatrix::Identity</a>;
+00336 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]-&gt;setSoundParams(
+00337 <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> ? <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a25">getOwner</a>(), 0) : 0,
+00338 mat * <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getPos()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>],
+00339 <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#n0">_Owner</a>-&gt;getSpeed()[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>],
+00340 <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> ? <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;get(<a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a25">getOwner</a>(), 0) : 1 );
+00341 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]-&gt;play();
+00342 }
+00343 }
+00344 <font class="keywordflow">else</font>
+00345 {
+00346 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.insert(NULL);
+00347 }
+00348 }
+00349 <font class="keywordflow">else</font>
+00350 {
+00351 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.insert(NULL);
+00352 }
+00353 }
+00354
+<a name="l00355"></a><a class="code" href="classNL3D_1_1CPSSound.html#b1">00355</a> <font class="keywordtype">void</font> CPSSound::deleteElement(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>)
+00356 {
+00357 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00358 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;deleteElement(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00359 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>])
+00360 {
+00361 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]-&gt;release();
+00362 }
+00363 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.remove(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00364 }
+00365
+<a name="l00366"></a><a class="code" href="classNL3D_1_1CPSSound.html#b2">00366</a> <font class="keywordtype">void</font> CPSSound::resize(uint32 size)
+00367 {
+00368 <a class="code" href="debug_8h.html#a6">nlassert</a>(size &lt; (1 &lt;&lt; 16));
+00369 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSSound.html#n3">_GainScheme</a>-&gt;resize(size, <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a25">getOwner</a>()-&gt;getSize());
+00370 <font class="keywordflow">if</font> (<a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a> &amp;&amp; <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;hasMemory()) <a class="code" href="classNL3D_1_1CPSSound.html#n5">_PitchScheme</a>-&gt;resize(size, <a class="code" href="classNL3D_1_1CPSLocatedBindable.html#a25">getOwner</a>()-&gt;getSize());
+00371 <a class="code" href="classNL3D_1_1CPSSound.html#n0">_Sounds</a>.resize(size);
+00372 }
+00373
+00374 } <font class="comment">// NL3D</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>