diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a03346.html | 1594 |
1 files changed, 1594 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a03346.html b/docs/doxygen/nel/a03346.html new file mode 100644 index 00000000..60d92c73 --- /dev/null +++ b/docs/doxygen/nel/a03346.html @@ -0,0 +1,1594 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLSOUND::CSampleBank class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLSOUND::CSampleBank Class Reference</h1><code>#include <<a class="el" href="a06347.html">sample_bank.h</a>></code> +<p> +<p>Inheritance diagram for NLSOUND::CSampleBank: +<p><center><img src="a03346.png" usemap="#NLSOUND::CSampleBank_map" border="0" alt=""></center> +<map name="NLSOUND::CSampleBank_map"> +<area href="a02239.html" alt="NLSOUND::CAudioMixerUser::IMixerUpdate" shape="rect" coords="0,56,258,80"> +<area href="a02425.html" alt="NLMISC::CDbgRefCount< IMixerUpdate >" shape="rect" coords="0,0,258,24"> +</map> +<hr><a name="_details"></a><h2>Detailed Description</h2> +A set of samples. <dl compact><dt><b>Author:</b></dt><dd>Peter Hanappe <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00067">67</a> of file <a class="el" href="a06347.html">sample_bank.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka0">countSamples</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of samples in this bank. <a href="#NLSOUND_1_1CSampleBanka0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka1">CSampleBank</a> (const std::string &name, <a class="el" href="a03419.html">ISoundDriver</a> *sd)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NLSOUND_1_1CSampleBanka1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka2">getName</a> () const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the name (must be unique). <a href="#NLSOUND_1_1CSampleBanka2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02298.html">IBuffer</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka3">getSample</a> (const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> &name)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return a samples corresponding to a name. <a href="#NLSOUND_1_1CSampleBanka3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka4">getSize</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the size of this bank in bytes. <a href="#NLSOUND_1_1CSampleBanka4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka5">isLoaded</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if the samples in this bank have been loaded. <a href="#NLSOUND_1_1CSampleBanka5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka6">load</a> (bool async)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka7">unload</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanka8">~CSampleBank</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#NLSOUND_1_1CSampleBanka8"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03346.html">CSampleBank</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke0">findSampleBank</a> (const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> &<a class="el" href="a04560.html#a1">filename</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return an existing bank for the given file name, NULL if no bank for this file. <a href="#NLSOUND_1_1CSampleBanke0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02298.html">IBuffer</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke1">get</a> (const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> &name)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the name corresponding to a name. The sample is searched. <a href="#NLSOUND_1_1CSampleBanke1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke2">getLoadedSampleBankInfo</a> (std::vector< std::pair< std::string, <a class="el" href="a04558.html#a15">uint</a> > > &result)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Fill a vector with current loaded sample banks. <a href="#NLSOUND_1_1CSampleBanke2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke3">getTotalByteSize</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the total loaded samples size. <a href="#NLSOUND_1_1CSampleBanke3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke4">init</a> (<a class="el" href="a02551.html">NLGEORGES::UFormElm</a> *mixerConfig)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke5">releaseAll</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Delete all the loaded banks. <a href="#NLSOUND_1_1CSampleBanke5"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanke6">reload</a> (bool async)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Reload all the sample bank. <a href="#NLSOUND_1_1CSampleBanke6"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::hash_map< <a class="el" href="a05378.html#a236">NLMISC::TStringId</a>,<br> + <a class="el" href="a03346.html">CSampleBank</a> * > </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky0">TSampleBankContainer</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::hash_map< <a class="el" href="a05378.html#a236">NLMISC::TStringId</a>,<br> + std::vector< <a class="el" href="a03347.html">TFilteredBank</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky1">TVirtualBankCont</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">List of virtual sample bank. <a href="#NLSOUND_1_1CSampleBanky1"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankd0">onUpdate</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">The update method. Used when waiting for async sample loading. <a href="#NLSOUND_1_1CSampleBankd0"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>std::list< std::pair< <a class="el" href="a02298.html">IBuffer</a> *,<br> + <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> > > </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr3">_LoadList</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">List of sample that need to be loaded asynchronously. <a href="#NLSOUND_1_1CSampleBankr3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a236">NLMISC::TStringId</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr4">_Name</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05381.html#a50">TSampleTable</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03419.html">ISoundDriver</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr6">_SoundDriver</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr7">_SplitLoadDone</a></td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Flag for splitted load. <a href="#NLSOUND_1_1CSampleBankr7"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky0">TSampleBankContainer</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a15">uint</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankv1">_LoadedSize</a> = 0</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky1">TVirtualBankCont</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a03346.html#NLSOUND_1_1CSampleBankv2">_VirtualBanks</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLSOUND_1_1CSampleBanky0" doxytag="NLSOUND::CSampleBank::TSampleBankContainer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::hash_map<<a class="el" href="a05378.html#a236">NLMISC::TStringId</a>, <a class="el" href="a03346.html">CSampleBank</a>*> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky0">NLSOUND::CSampleBank::TSampleBankContainer</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00140">140</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanky1" doxytag="NLSOUND::CSampleBank::TVirtualBankCont" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::hash_map<<a class="el" href="a05378.html#a236">NLMISC::TStringId</a>, std::vector<<a class="el" href="a03347.html">TFilteredBank</a>> > <a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky1">NLSOUND::CSampleBank::TVirtualBankCont</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +List of virtual sample bank. +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00177">177</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLSOUND_1_1CSampleBanka1" doxytag="NLSOUND::CSampleBank::CSampleBank" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLSOUND::CSampleBank::CSampleBank </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03419.html">ISoundDriver</a> * </td> + <td class="mdname" nowrap> <em>sd</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00180">180</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00055">init()</a>. +<p> +<div class="fragment"><pre>00181 : <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr6">_SoundDriver</a>(sd), <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr4">_Name</a>(CStringMapper::map(name)), <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a>(<span class="keyword">false</span>), <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a>(<span class="keyword">true</span>), <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a>(0) +00182 { +00183 <span class="comment">// _Name = CFile::getFilenameWithoutExtension(_Path);</span> +00184 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.insert(make_pair(_Name, <span class="keyword">this</span>)); +00185 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka8" doxytag="NLSOUND::CSampleBank::~CSampleBank" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLSOUND::CSampleBank::~<a class="el" href="a03346.html">CSampleBank</a> </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Destructor. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00190">190</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00160">_LoadingDone</a>, <a class="el" href="a06347.html#l00151">_Samples</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, and <a class="el" href="a06346.html#l00503">unload()</a>. +<p> +<div class="fragment"><pre>00191 { +00192 CAudioMixerUser::instance()->unregisterUpdate(<span class="keyword">this</span>); +00193 <span class="keywordflow">while</span> (!<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a>) +00194 { +00195 <span class="comment">// need to wait for loading end.</span> +00196 <a class="code" href="a05378.html#a256">nlSleep</a>(100); +00197 } +00198 +00199 <span class="keywordflow">if</span> (<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a>) +00200 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBanka7">unload</a>(); +00201 +00202 <span class="comment">// remove the bank from the list of known banks</span> +00203 TSampleBankContainer::iterator iter(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.begin()), end(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.end()); +00204 +00205 <span class="keywordflow">for</span> (; iter != end; ++iter) +00206 { +00207 <span class="keywordflow">if</span> (iter->second == <span class="keyword">this</span>) +00208 { +00209 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.erase(iter); +00210 <span class="keywordflow">break</span>; +00211 } +00212 } +00213 +00214 +00215 <span class="comment">// delete all the samples.</span> +00216 <span class="keywordflow">while</span> (!<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.empty()) +00217 { +00218 <span class="keyword">delete</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.begin()->second; +00219 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.erase(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.begin()); +00220 } +00221 +00222 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.clear(); +00223 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLSOUND_1_1CSampleBanka0" doxytag="NLSOUND::CSampleBank::countSamples" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLSOUND::CSampleBank::countSamples </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the number of samples in this bank. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00587">587</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00151">_Samples</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a05465.html#l01803">NLSOUND::CAudioMixerUser::loadSampleBank()</a>. +<p> +<div class="fragment"><pre>00588 { +00589 <span class="keywordflow">return</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.size(); +00590 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke0" doxytag="NLSOUND::CSampleBank::findSampleBank" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03346.html">CSampleBank</a> * NLSOUND::CSampleBank::findSampleBank </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>filename</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return an existing bank for the given file name, NULL if no bank for this file. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00115">115</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00228">load()</a>. +<p> +<div class="fragment"><pre>00116 { +00117 TSampleBankContainer::iterator it(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.find(filename)); +00118 +00119 <span class="keywordflow">if</span> (it != <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.end()) +00120 <span class="keywordflow">return</span> it->second; +00121 +00122 <span class="keywordflow">return</span> NULL; +00123 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke1" doxytag="NLSOUND::CSampleBank::get" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02298.html">IBuffer</a> * NLSOUND::CSampleBank::get </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>name</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the name corresponding to a name. The sample is searched. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00127">127</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00649">buffer</a>. +<p> +<div class="fragment"><pre>00128 { +00129 IBuffer* <a class="code" href="a04223.html#a589">buffer</a>; +00130 TSampleBankContainer::iterator iter; +00131 +00132 <span class="keywordflow">for</span> (iter = <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.begin(); iter != <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.end(); ++iter) +00133 { +00134 <a class="code" href="a04223.html#a589">buffer</a> = iter->second->getSample(name); +00135 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a589">buffer</a> != 0) +00136 { +00137 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a589">buffer</a>; +00138 } +00139 } +00140 +00141 <span class="comment">//nlwarning ("Try to get an unknown sample '%s'", name);</span> +00142 <span class="keywordflow">return</span> 0; +00143 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke2" doxytag="NLSOUND::CSampleBank::getLoadedSampleBankInfo" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLSOUND::CSampleBank::getLoadedSampleBankInfo </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< std::pair< std::string, <a class="el" href="a04558.html#a15">uint</a> > > & </td> + <td class="mdname1" valign="top" nowrap> <em>result</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Fill a vector with current loaded sample banks. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00157">157</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06470.html#l00083">NLMISC::CStringMapper::unmap()</a>. +<p> +<div class="fragment"><pre>00158 { +00159 result.clear(); +00160 +00161 TSampleBankContainer::iterator first(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.begin()), last(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.end()); +00162 <span class="keywordflow">for</span> (; first != last; ++first) +00163 { +00164 std::pair<std::string, uint> p; +00165 <span class="keywordflow">if</span> (first->second->isLoaded()) +00166 { +00167 p.first = <a class="code" href="a03450.html#NLMISC_1_1CStringMappere4">NLMISC::CStringMapper::unmap</a>(first->first); +00168 p.second = first->second->getSize(); +00169 result.push_back(p); +00170 } +00171 } +00172 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka2" doxytag="NLSOUND::CSampleBank::getName" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> NLSOUND::CSampleBank::getName </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">void </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const<code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the name (must be unique). +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00129">129</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +<div class="fragment"><pre>00129 { <span class="keywordflow">return</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr4">_Name</a>; } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka3" doxytag="NLSOUND::CSampleBank::getSample" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02298.html">IBuffer</a> * NLSOUND::CSampleBank::getSample </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>name</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return a samples corresponding to a name. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00555">555</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00151">_Samples</a>. +<p> +<div class="fragment"><pre>00556 { +00557 { +00558 <span class="comment">/* // dump the sample list.</span> +00559 <span class="comment"> TSampleTable::iterator it (_Samples.begin()), last(_Samples.end());</span> +00560 <span class="comment"> std::string s;</span> +00561 <span class="comment"></span> +00562 <span class="comment">// while (first != last)</span> +00563 <span class="comment"> for (it = _Samples.begin(); it != _Samples.end(); ++it)</span> +00564 <span class="comment"> {</span> +00565 <span class="comment"> s += std::string(" [")+it->first+"] ";</span> +00566 <span class="comment"> //first++;</span> +00567 <span class="comment"> }</span> +00568 <span class="comment"></span> +00569 <span class="comment"> nldebug("getSample(%s) : sample list = [%s]", name, s.c_str());</span> +00570 <span class="comment">*/</span> +00571 } +00572 +00573 <span class="comment">// Find sound</span> +00574 TSampleTable::iterator iter = <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.find(name); +00575 <span class="keywordflow">if</span> ( iter == <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.end() ) +00576 { +00577 <span class="keywordflow">return</span> 0; +00578 } +00579 <span class="keywordflow">else</span> +00580 { +00581 <span class="keywordflow">return</span> (*iter).second; +00582 } +00583 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka4" doxytag="NLSOUND::CSampleBank::getSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLSOUND::CSampleBank::getSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the size of this bank in bytes. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00594">594</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00151">_Samples</a>, <a class="el" href="a05646.html#l00645">size</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00595 { +00596 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a> = 0; +00597 +00598 TSampleTable::const_iterator iter; +00599 <span class="keywordflow">for</span> (iter = <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.begin(); iter != <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.end(); iter++) +00600 { +00601 <a class="code" href="a04223.html#a587">size</a> += (*iter).second->getSize(); +00602 } +00603 +00604 <span class="keywordflow">return</span> <a class="code" href="a04223.html#a587">size</a>; +00605 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke3" doxytag="NLSOUND::CSampleBank::getTotalByteSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> NLSOUND::CSampleBank::getTotalByteSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Return the total loaded samples size. +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00086">86</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +References <a class="el" href="a06346.html#l00048">_LoadedSize</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00086 { <span class="keywordflow">return</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv1">_LoadedSize</a>; }; +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke4" doxytag="NLSOUND::CSampleBank::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLSOUND::CSampleBank::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02551.html">NLGEORGES::UFormElm</a> * </td> + <td class="mdname1" valign="top" nowrap> <em>mixerConfig</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Initialise the sample bank with the mixer config file. +<p> +Definition at line <a class="el" href="a06346.html#l00055">55</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06346.html#l00050">_VirtualBanks</a>, <a class="el" href="a06347.html#l00173">NLSOUND::CSampleBank::TFilteredBank::BankName</a>, <a class="el" href="a06346.html#l00180">CSampleBank()</a>, <a class="el" href="a06347.html#l00172">NLSOUND::CSampleBank::TFilteredBank::Filter</a>, <a class="el" href="a02551.html#NLGEORGES_1_1UFormElma1">NLGEORGES::UFormElm::getArrayNode()</a>, <a class="el" href="a02551.html#NLGEORGES_1_1UFormElma3">NLGEORGES::UFormElm::getArraySize()</a>, <a class="el" href="a02551.html#NLGEORGES_1_1UFormElma17">NLGEORGES::UFormElm::getNodeByName()</a>, <a class="el" href="a02551.html#NLGEORGES_1_1UFormElma44">NLGEORGES::UFormElm::getValueByName()</a>, <a class="el" href="a05646.html#l00645">size</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00056 { +00057 NL_ALLOC_CONTEXT(NLSOUND_CSampleBank); +00058 <span class="keywordflow">if</span> (mixerConfig == 0) +00059 <span class="keywordflow">return</span>; +00060 +00061 <a class="code" href="a02551.html">NLGEORGES::UFormElm</a> *virtualBanks; +00062 mixerConfig-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma17">getNodeByName</a>(&virtualBanks, <span class="stringliteral">".VirtualBanks"</span>); +00063 <span class="keywordflow">if</span> (virtualBanks == 0) +00064 <span class="keywordflow">return</span>; +00065 +00066 <a class="code" href="a04558.html#a15">uint</a> <a class="code" href="a04223.html#a587">size</a>; +00067 virtualBanks-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma3">getArraySize</a>(size); +00068 +00069 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<<a class="code" href="a04223.html#a587">size</a>; ++i) +00070 { +00071 <a class="code" href="a02551.html">NLGEORGES::UFormElm</a> *virtualBank; +00072 virtualBanks-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma1">getArrayNode</a>(&virtualBank, i); +00073 +00074 <span class="keywordflow">if</span> (virtualBank != 0) +00075 { +00076 std::vector<TFilteredBank> vfb; +00077 std::string virtualName; +00078 virtualBank-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma44">getValueByName</a>(virtualName, <span class="stringliteral">".VirtualName"</span>); +00079 <a class="code" href="a02551.html">NLGEORGES::UFormElm</a> *realBanks; +00080 virtualBank-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma17">getNodeByName</a>(&realBanks, <span class="stringliteral">".FilteredBank"</span>); +00081 <span class="keywordflow">if</span> (realBanks != 0) +00082 { +00083 <a class="code" href="a04558.html#a15">uint</a> size2; +00084 realBanks-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma3">getArraySize</a>(size2); +00085 +00086 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> j=0; j<size2; ++j) +00087 { +00088 TFilteredBank fb; +00089 std::string bankName; +00090 <a class="code" href="a02551.html">NLGEORGES::UFormElm</a> *realBank; +00091 realBank-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma1">getArrayNode</a>(&realBank, j); +00092 +00093 realBank-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma44">getValueByName</a>(bankName, <span class="stringliteral">".SampleBank"</span>); +00094 fb.BankName = CStringMapper::map(bankName); +00095 realBank-><a class="code" href="a02551.html#NLGEORGES_1_1UFormElma44">getValueByName</a>(fb.Filter, <span class="stringliteral">".Filter"</span>); +00096 +00097 vfb.push_back(fb); +00098 } +00099 } +00100 +00101 <span class="keywordflow">if</span> (!vfb.empty()) +00102 { +00103 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv2">_VirtualBanks</a>.insert(std::make_pair(NLMISC::CStringMapper::map(virtualName), vfb)); +00104 <span class="comment">// create the sample bank</span> +00105 <span class="keyword">new</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBanka1">CSampleBank</a>(virtualName, NULL); +00106 } +00107 } +00108 } +00109 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka5" doxytag="NLSOUND::CSampleBank::isLoaded" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLSOUND::CSampleBank::isLoaded </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns true if the samples in this bank have been loaded. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00548">548</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +<div class="fragment"><pre>00549 { +00550 <span class="keywordflow">return</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a>; +00551 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka6" doxytag="NLSOUND::CSampleBank::load" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLSOUND::CSampleBank::load </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>async</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Load all the samples.<p> +Can throw EPathNotFound or <a class="el" href="a03823.html">ESoundFileNotFound</a> (check Exception) <dl compact><dt><b>Parameters:</b></dt><dd> + <table border="0" cellspacing="2" cellpadding="0"> + <tr><td valign=top><em>async</em> </td><td>If true, the samples are loaded in background.</td></tr> + </table> +</dl> + +<p> +Definition at line <a class="el" href="a06346.html#l00228">228</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00162">_ByteSize</a>, <a class="el" href="a06346.html#l00048">_LoadedSize</a>, <a class="el" href="a06347.html#l00160">_LoadingDone</a>, <a class="el" href="a06347.html#l00151">_Samples</a>, <a class="el" href="a06346.html#l00050">_VirtualBanks</a>, <a class="el" href="a03419.html#NLSOUND_1_1ISoundDrivera2">NLSOUND::ISoundDriver::createBuffer()</a>, <a class="el" href="a05646.html#l01013">data</a>, <a class="el" href="a06346.html#l00115">findSampleBank()</a>, <a class="el" href="a05466.html#l00501">NLSOUND::CAudioMixerUser::TSampleBankHeader::Freq</a>, <a class="el" href="a05465.html#l00825">NLSOUND::CAudioMixerUser::getBackgroundFlags()</a>, <a class="el" href="a05466.html#l00276">NLSOUND::CAudioMixerUser::getPackedSheetUpdate()</a>, <a class="el" href="a05708.html#l00436">NLMISC::CIFile::getPos()</a>, <a class="el" href="a02298.html#NLSOUND_1_1IBuffera5">NLSOUND::IBuffer::getSize()</a>, <a class="el" href="a05381.html#a80a19">NLSOUND::Mono16</a>, <a class="el" href="a05381.html#a80a18">NLSOUND::Mono16ADPCM</a>, <a class="el" href="a05466.html#l00499">NLSOUND::CAudioMixerUser::TSampleBankHeader::Name</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05622.html#l00135">nlwarning</a>, <a class="el" href="a05466.html#l00503">NLSOUND::CAudioMixerUser::TSampleBankHeader::OffsetAdpcm</a>, <a class="el" href="a05466.html#l00502">NLSOUND::CAudioMixerUser::TSampleBankHeader::OffsetMono16</a>, <a class="el" href="a02298.html#NLSOUND_1_1IBuffera9">NLSOUND::IBuffer::presetName()</a>, <a class="el" href="a03419.html#NLSOUND_1_1ISoundDrivera7">NLSOUND::ISoundDriver::readRawBuffer()</a>, <a class="el" href="a05708.html#l00404">NLMISC::CIFile::seek()</a>, <a class="el" href="a06462.html#l00232">NLMISC::IStream::serial()</a>, <a class="el" href="a05708.html#l00355">NLMISC::CIFile::serialBuffer()</a>, <a class="el" href="a05981.html#l00099">sint32</a>, <a class="el" href="a05466.html#l00505">NLSOUND::CAudioMixerUser::TSampleBankHeader::SizeAdpcm</a>, <a class="el" href="a05466.html#l00504">NLSOUND::CAudioMixerUser::TSampleBankHeader::SizeMono16</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00096">uint8</a>. +<p> +Referenced by <a class="el" href="a05465.html#l01803">NLSOUND::CAudioMixerUser::loadSampleBank()</a>. +<p> +<div class="fragment"><pre>00229 { +00230 <span class="comment">// TODO : add async loading support !</span> +00231 +00232 TVirtualBankCont::iterator it(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv2">_VirtualBanks</a>.find(_Name)); +00233 <span class="keywordflow">if</span> (it != <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv2">_VirtualBanks</a>.end()) +00234 { +00235 <span class="comment">// this is a virtual sample bank !</span> +00236 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"Loading virtual sample bank %s"</span>, CStringMapper::unmap(_Name).c_str()); +00237 +00238 CAudioMixerUser *mixer = CAudioMixerUser::instance(); +00239 <span class="keyword">const</span> CAudioMixerUser::TBackgroundFlags &flags = mixer->getBackgroundFlags(); +00240 +00241 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<it->second.size(); ++i) +00242 { +00243 <span class="keywordflow">if</span> (flags.Flags[it->second[i].Filter]) +00244 { +00245 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBanka1">CSampleBank</a> *bank = <a class="code" href="a03346.html#NLSOUND_1_1CSampleBanke0">findSampleBank</a>(it->second[i].BankName); +00246 <span class="keywordflow">if</span> (bank) +00247 bank->load(async); +00248 } +00249 } +00250 } +00251 +00252 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"Loading sample bank %s %"</span>, CStringMapper::unmap(_Name).c_str(), async?<span class="stringliteral">""</span>:<span class="stringliteral">"Asynchronously"</span>); +00253 +00254 vector<string> filenames; +00255 <span class="comment">// vector<string>::iterator iter;</span> +00256 +00257 <span class="keywordflow">if</span> (<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a>) +00258 { +00259 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Trying to load an already loaded bank : %s"</span>, CStringMapper::unmap(_Name).c_str ()); +00260 <span class="keywordflow">return</span>; +00261 } +00262 +00263 +00264 <span class="comment">// Load the sample bank from the builded sample_bank file.</span> +00265 string bankName(CStringMapper::unmap(_Name)+<span class="stringliteral">".sample_bank"</span>); +00266 string <a class="code" href="a05377.html#a2">filename</a> = CPath::lookup(bankName); +00267 <span class="keywordflow">if</span> (<a class="code" href="a05377.html#a2">filename</a>.empty()) +00268 { +00269 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Trying to load an unknown sample bank [%s]"</span>, bankName.c_str()); +00270 <span class="keywordflow">return</span>; +00271 } +00272 +00273 <span class="keywordflow">try</span> +00274 { +00275 +00276 <a class="code" href="a02653.html">CIFile</a> sampleBank(filename); +00277 +00278 CAudioMixerUser::TSampleBankHeader sbh; +00279 sampleBank.<a class="code" href="a02270.html#NLMISC_1_1IStreama5">serial</a>(sbh); +00280 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a> = <span class="keyword">false</span>; +00281 +00282 <a class="code" href="a04558.html#a10">sint32</a> seekStart = sampleBank.<a class="code" href="a02653.html#NLMISC_1_1CIFilea8">getPos</a>(); +00283 +00284 +00285 <a class="code" href="a04558.html#a7">uint8</a> *<a class="code" href="a04223.html#a637">data</a> = 0; +00286 <a class="code" href="a04558.html#a15">uint</a> i; +00287 <span class="keywordflow">for</span> (i=0; i<sbh.Name.size(); ++i) +00288 { +00289 IBuffer *ibuffer = <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr6">_SoundDriver</a>->createBuffer(); +00290 <a class="code" href="a04199.html#a6">nlassert</a>(ibuffer); +00291 +00292 <a class="code" href="a05378.html#a236">TStringId</a> nameId = CStringMapper::map(CFile::getFilenameWithoutExtension(sbh.Name[i])); +00293 ibuffer->presetName(nameId); +00294 +00295 <span class="comment">/* {</span> +00296 <span class="comment"> sint16 *data16 = new sint16[sbh.NbSample[i]];</span> +00297 <span class="comment"> IBuffer::TADPCMState state;</span> +00298 <span class="comment"> state.PreviousSample = 0;</span> +00299 <span class="comment"> state.StepIndex = 0;</span> +00300 <span class="comment"> uint count =0;</span> +00301 <span class="comment"> for (count=0; count+1024<sbh.NbSample[i]; count+=1024)</span> +00302 <span class="comment"> {</span> +00303 <span class="comment"> IBuffer::decodeADPCM(data+count/2, data16+count, 1024, state);</span> +00304 <span class="comment"> }</span> +00305 <span class="comment"> IBuffer::decodeADPCM(data+count/2, data16+count, sbh.NbSample[i]-count, state);</span> +00306 <span class="comment"></span> +00307 <span class="comment"> state.PreviousSample = 0;</span> +00308 <span class="comment"> state.StepIndex = 0;</span> +00309 <span class="comment"> sint16 *data16_2 = new sint16[sbh.NbSample[i]];</span> +00310 <span class="comment"> IBuffer::decodeADPCM(data, data16_2, sbh.NbSample[i], state);</span> +00311 <span class="comment"></span> +00312 <span class="comment"> for (uint j=0; j<sbh.NbSample[i]; ++j)</span> +00313 <span class="comment"> {</span> +00314 <span class="comment"> if (data16[j] != data16_2[j])</span> +00315 <span class="comment"> {</span> +00316 <span class="comment"> nlwarning("Sample differ at %u", j);</span> +00317 <span class="comment"> }</span> +00318 <span class="comment"> }</span> +00319 <span class="comment"></span> +00320 <span class="comment"> _SoundDriver->readRawBuffer(ibuffer, sbh.Name[i], (uint8*)data16, sbh.NbSample[i]*2, Mono16, sbh.Freq[i]);</span> +00321 <span class="comment"> delete [] data16;</span> +00322 <span class="comment"> delete [] data16_2;</span> +00323 <span class="comment"> }</span> +00324 <span class="comment"> */</span> +00325 +00326 <span class="keywordflow">if</span> (CAudioMixerUser::instance()->useAPDCM()) +00327 { +00328 <a class="code" href="a04223.html#a637">data</a> = (<a class="code" href="a04558.html#a7">uint8</a>*) realloc(data, sbh.SizeAdpcm[i]); +00329 sampleBank.<a class="code" href="a02653.html#NLMISC_1_1CIFilea13">seek</a>(seekStart + sbh.OffsetAdpcm[i], CIFile::begin); +00330 sampleBank.<a class="code" href="a02653.html#NLMISC_1_1CIFilea15">serialBuffer</a>(data, sbh.SizeAdpcm[i]); +00331 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr6">_SoundDriver</a>->readRawBuffer(ibuffer, sbh.Name[i], data, sbh.SizeAdpcm[i], Mono16ADPCM, sbh.Freq[i]); +00332 } +00333 <span class="keywordflow">else</span> +00334 { +00335 <a class="code" href="a04223.html#a637">data</a> = (<a class="code" href="a04558.html#a7">uint8</a>*) realloc(data, sbh.SizeMono16[i]); +00336 sampleBank.<a class="code" href="a02653.html#NLMISC_1_1CIFilea13">seek</a>(seekStart + sbh.OffsetMono16[i], CIFile::begin); +00337 sampleBank.<a class="code" href="a02653.html#NLMISC_1_1CIFilea15">serialBuffer</a>(data, sbh.SizeMono16[i]); +00338 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr6">_SoundDriver</a>->readRawBuffer(ibuffer, sbh.Name[i], data, sbh.SizeMono16[i], Mono16, sbh.Freq[i]); +00339 } +00340 +00341 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a> += ibuffer->getSize(); +00342 +00343 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>[nameId] = ibuffer; +00344 +00345 <span class="comment">// Warn the sound bank that the sample are available.</span> +00346 CSoundBank::instance()->bufferLoaded(nameId, ibuffer); +00347 } +00348 free(data); +00349 +00350 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv1">_LoadedSize</a> += <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a>; +00351 } +00352 <span class="keywordflow">catch</span>(<a class="code" href="a02482.html">Exception</a> &e) +00353 { +00354 <span class="comment">// loading failed !</span> +00355 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Exception %s during loading of sample bank %s"</span>, e.what(), <a class="code" href="a05377.html#a2">filename</a>.c_str()); +00356 CAudioMixerUser *mixer = CAudioMixerUser::instance(); +00357 +00358 <span class="keywordflow">if</span> (mixer->getPackedSheetUpdate()) +00359 { +00360 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"Deleting offending sound bank, you need to restart to recreate it!"</span>); +00361 CFile::deleteFile(filename); +00362 } +00363 } +00364 +00365 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a> = <span class="keyword">true</span>; +00366 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a> = <span class="keyword">true</span>; +00367 +00368 +00369 +00371 <span class="comment">/*</span> +00372 <span class="comment"></span> +00373 <span class="comment"> std::string list = CPath::lookup(CStringMapper::unmap(_Name)+CAudioMixerUser::SampleBankListExt, false);</span> +00374 <span class="comment"> if (list.empty())</span> +00375 <span class="comment"> {</span> +00376 <span class="comment"> nlwarning("File %s not found to load sample bank %s", (CStringMapper::unmap(_Name)+CAudioMixerUser::SampleBankListExt).c_str(), CStringMapper::unmap(_Name).c_str());</span> +00377 <span class="comment"> return;</span> +00378 <span class="comment"> }</span> +00379 <span class="comment"></span> +00380 <span class="comment"></span> +00381 <span class="comment"> NLMISC::CIFile sampleBankList(list);</span> +00382 <span class="comment"> sampleBankList.serialCont(filenames);</span> +00383 <span class="comment"></span> +00384 <span class="comment"> for (iter = filenames.begin(); iter != filenames.end(); iter++)</span> +00385 <span class="comment"> {</span> +00386 <span class="comment"> IBuffer* ibuffer = NULL;</span> +00387 <span class="comment"> try</span> +00388 <span class="comment"> {</span> +00389 <span class="comment"> ibuffer = _SoundDriver->createBuffer();</span> +00390 <span class="comment"> nlassert(ibuffer);</span> +00391 <span class="comment"></span> +00392 <span class="comment">// std::string sampleName(CFile::getFilenameWithoutExtension(*iter));</span> +00393 <span class="comment"> NLMISC::TStringId sampleName(CStringMapper::map(CFile::getFilenameWithoutExtension(*iter)));</span> +00394 <span class="comment"></span> +00395 <span class="comment"> if (async)</span> +00396 <span class="comment"> {</span> +00397 <span class="comment"> ibuffer->presetName(sampleName);</span> +00398 <span class="comment"> nldebug("Preloading sample [%s]", CStringMapper::unmap(sampleName).c_str());</span> +00399 <span class="comment"> }</span> +00400 <span class="comment"> else</span> +00401 <span class="comment"> {</span> +00402 <span class="comment"> std::string fullName = NLMISC::CPath::lookup(*iter, false);</span> +00403 <span class="comment"> if (!fullName.empty())</span> +00404 <span class="comment"> {</span> +00405 <span class="comment"> NLMISC::CIFile ifile(fullName);</span> +00406 <span class="comment"> uint size = ifile.getFileSize();</span> +00407 <span class="comment"> uint8 *buffer = new uint8[ifile.getFileSize()];</span> +00408 <span class="comment"> ifile.serialBuffer(buffer, size);</span> +00409 <span class="comment"></span> +00410 <span class="comment"> _SoundDriver->readWavBuffer(ibuffer, fullName, buffer, size);</span> +00411 <span class="comment"> _ByteSize += ibuffer->getSize();</span> +00412 <span class="comment"></span> +00413 <span class="comment"> delete [] buffer;</span> +00414 <span class="comment"> }</span> +00415 <span class="comment"> }</span> +00416 <span class="comment"> _Samples[sampleName] = ibuffer ;</span> +00417 <span class="comment"></span> +00418 <span class="comment"> // Warn the sound bank that the sample are available.</span> +00419 <span class="comment"> CSoundBank::instance()->bufferLoaded(sampleName, ibuffer);</span> +00420 <span class="comment"> }</span> +00421 <span class="comment"> catch (ESoundDriver &e)</span> +00422 <span class="comment"> {</span> +00423 <span class="comment"> if (ibuffer != NULL) {</span> +00424 <span class="comment"> delete ibuffer;</span> +00425 <span class="comment"> ibuffer = NULL;</span> +00426 <span class="comment"> }</span> +00427 <span class="comment"> nlwarning("Problem with file '%s': %s", (*iter).c_str(), e.what());</span> +00428 <span class="comment"> }</span> +00429 <span class="comment"> }</span> +00430 <span class="comment"></span> +00431 <span class="comment"> _Loaded = true;</span> +00432 <span class="comment"></span> +00433 <span class="comment"> if (!async)</span> +00434 <span class="comment"> {</span> +00435 <span class="comment"> _LoadingDone = true;</span> +00436 <span class="comment"> // compute the sample bank size.</span> +00437 <span class="comment"> _LoadedSize += _ByteSize;</span> +00438 <span class="comment"> }</span> +00439 <span class="comment"> else</span> +00440 <span class="comment"> {</span> +00441 <span class="comment"> // fill the loading list.</span> +00442 <span class="comment"> TSampleTable::iterator first(_Samples.begin()), last(_Samples.end());</span> +00443 <span class="comment"> for (; first != last; ++first)</span> +00444 <span class="comment"> {</span> +00445 <span class="comment"> _LoadList.push_back(make_pair(first->second, first->first));</span> +00446 <span class="comment"> }</span> +00447 <span class="comment"> _SplitLoadDone = false;</span> +00448 <span class="comment"> // send the first files</span> +00449 <span class="comment"> for (uint i=0; i<ASYNC_LOADING_SPLIT && !_LoadList.empty(); ++i)</span> +00450 <span class="comment"> {</span> +00451 <span class="comment"> CAsyncFileManagerSound::getInstance().loadWavFile(_LoadList.front().first, CStringMapper::unmap(_LoadList.front().second)+".wav");</span> +00452 <span class="comment"> _LoadList.pop_front();</span> +00453 <span class="comment"> }</span> +00454 <span class="comment"> // add a end loading event...</span> +00455 <span class="comment"> CAsyncFileManagerSound::getInstance().signal(&_SplitLoadDone);</span> +00456 <span class="comment"> // and register for update on the mixer</span> +00457 <span class="comment"> CAudioMixerUser::instance()->registerUpdate(this);</span> +00458 <span class="comment"> }</span> +00459 <span class="comment"> */</span> +00460 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankd0" doxytag="NLSOUND::CSampleBank::onUpdate" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLSOUND::CSampleBank::onUpdate </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [private, virtual]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +The update method. Used when waiting for async sample loading. +<p> + +<p> +Implements <a class="el" href="a02239.html#NLSOUND_1_1CAudioMixerUser_1_1IMixerUpdatea0">NLSOUND::CAudioMixerUser::IMixerUpdate</a>. +<p> +Definition at line <a class="el" href="a06346.html#l00462">462</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00162">_ByteSize</a>, <a class="el" href="a06346.html#l00048">_LoadedSize</a>, <a class="el" href="a06347.html#l00160">_LoadingDone</a>, <a class="el" href="a06347.html#l00168">_LoadList</a>, <a class="el" href="a06347.html#l00151">_Samples</a>, <a class="el" href="a06347.html#l00165">_SplitLoadDone</a>, <a class="el" href="a06346.html#l00045">NLSOUND::ASYNC_LOADING_SPLIT</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00463 { +00464 <span class="keywordflow">if</span> (<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr7">_SplitLoadDone</a>) +00465 { +00466 <a class="code" href="a04199.html#a0">nldebug</a>(<span class="stringliteral">"Some samples have been loaded"</span>); +00467 <span class="keywordflow">if</span> (<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr3">_LoadList</a>.empty()) +00468 { +00469 <span class="comment">// all the samples are loaded, we can compute the bank size.</span> +00470 TSampleTable::iterator first(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.begin()), last(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.end()); +00471 <span class="keywordflow">for</span> (; first != last; ++first) +00472 { +00473 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a> += first->second->getSize(); +00474 } +00475 +00476 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv1">_LoadedSize</a> += <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a>; +00477 +00478 <span class="comment">// stop the update.</span> +00479 CAudioMixerUser::instance()->unregisterUpdate(<span class="keyword">this</span>); +00480 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a> = <span class="keyword">true</span>; +00481 +00482 <span class="comment">// Force an update in the background manager (can restar stoped sound).</span> +00483 CAudioMixerUser::instance()->getBackgroundSoundManager()->updateBackgroundStatus(); +00484 +00485 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"Sample bank %s loaded."</span>, CStringMapper::unmap(_Name).c_str()); +00486 } +00487 <span class="keywordflow">else</span> +00488 { +00489 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr7">_SplitLoadDone</a> = <span class="keyword">false</span>; +00490 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i=0; i<<a class="code" href="a05381.html#a49">ASYNC_LOADING_SPLIT</a> && !<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr3">_LoadList</a>.empty(); ++i) +00491 { +00492 CAsyncFileManagerSound::getInstance().loadWavFile(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr3">_LoadList</a>.front().first, CStringMapper::unmap(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr3">_LoadList</a>.front().second)+<span class="stringliteral">".wav"</span>); +00493 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr3">_LoadList</a>.pop_front(); +00494 } +00495 <span class="comment">// add a end loading event...</span> +00496 CAsyncFileManagerSound::getInstance().signal(&_SplitLoadDone); +00497 } +00498 } +00499 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke5" doxytag="NLSOUND::CSampleBank::releaseAll" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLSOUND::CSampleBank::releaseAll </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Delete all the loaded banks. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00607">607</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a05622.html#l00101">nldebug</a>. +<p> +<div class="fragment"><pre>00608 { +00609 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"SampleBanks: Releasing..."</span> ); +00610 +00611 <span class="keywordflow">while</span> (!<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.empty()) +00612 { +00613 <span class="keyword">delete</span> <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.begin()->second; +00614 } +00615 <a class="code" href="a04199.html#a0">nldebug</a>( <span class="stringliteral">"SampleBanks: Released"</span> ); +00616 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanke6" doxytag="NLSOUND::CSampleBank::reload" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLSOUND::CSampleBank::reload </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">bool </td> + <td class="mdname1" valign="top" nowrap> <em>async</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Reload all the sample bank. +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00145">145</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +<div class="fragment"><pre>00146 { +00147 TSampleBankContainer::iterator first(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.begin()), last(<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv0">_Banks</a>.end()); +00148 +00149 <span class="keywordflow">for</span> (; first != last; ++first) +00150 { +00151 first->second->unload(); +00152 first->second->load(async); +00153 } +00154 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBanka7" doxytag="NLSOUND::CSampleBank::unload" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLSOUND::CSampleBank::unload </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Unload all the samples in this bank. Return false is unload can't be done (if an async loading is not terminated. +<p> +Definition at line <a class="el" href="a06346.html#l00503">503</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +References <a class="el" href="a06347.html#l00162">_ByteSize</a>, <a class="el" href="a06346.html#l00048">_LoadedSize</a>, <a class="el" href="a06347.html#l00160">_LoadingDone</a>, <a class="el" href="a06347.html#l00151">_Samples</a>, <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, and <a class="el" href="a05622.html#l00135">nlwarning</a>. +<p> +Referenced by <a class="el" href="a05465.html#l01838">NLSOUND::CAudioMixerUser::unloadSampleBank()</a>, and <a class="el" href="a06346.html#l00190">~CSampleBank()</a>. +<p> +<div class="fragment"><pre>00504 { +00505 vector<IBuffer*> vec; +00506 TSampleTable::iterator it; +00507 +00508 <span class="keywordflow">if</span> (!<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a>) +00509 { +00510 <a class="code" href="a04199.html#a2">nlwarning</a>(<span class="stringliteral">"Trying to unload an already unloaded bank : %s"</span>, CStringMapper::unmap(_Name).c_str ()); +00511 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00512 } +00513 +00514 <span class="comment">// need to wait end of load ?</span> +00515 <span class="keywordflow">if</span> (!<a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr2">_LoadingDone</a>) +00516 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00517 +00518 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"Unloading sample bank %s"</span>, CStringMapper::unmap(_Name).c_str()); +00519 +00520 <span class="keywordflow">for</span> (it = <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.begin(); it != <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr5">_Samples</a>.end(); ++it) +00521 { +00522 IBuffer *<a class="code" href="a04223.html#a589">buffer</a> = it->second; +00523 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a589">buffer</a>) +00524 { +00525 <span class="keyword">const</span> NLMISC::TStringId & bufferName = <a class="code" href="a04223.html#a589">buffer</a>->getName(); +00526 +00527 <span class="comment">// Warn the mixer to stop any track playing this buffer.</span> +00528 CAudioMixerUser::instance()->bufferUnloaded(buffer); +00529 <span class="comment">// Warn the sound banks abount this buffer.</span> +00530 CSoundBank::instance()->bufferUnloaded(bufferName); +00531 +00532 <span class="comment">// delete</span> +00533 it->second = NULL; +00534 <span class="keyword">delete</span> <a class="code" href="a04223.html#a589">buffer</a>; +00535 } +00536 } +00537 +00538 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr1">_Loaded</a> = <span class="keyword">false</span>; +00539 +00540 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankv1">_LoadedSize</a> -= <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a>; +00541 <a class="code" href="a03346.html#NLSOUND_1_1CSampleBankr0">_ByteSize</a> = 0; +00542 +00543 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00544 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLSOUND_1_1CSampleBankv0" doxytag="NLSOUND::CSampleBank::_Banks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky0">CSampleBank::TSampleBankContainer</a> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankv0">NLSOUND::CSampleBank::_Banks</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00047">47</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr0" doxytag="NLSOUND::CSampleBank::_ByteSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr0">NLSOUND::CSampleBank::_ByteSize</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00162">162</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00228">load()</a>, <a class="el" href="a06346.html#l00462">onUpdate()</a>, and <a class="el" href="a06346.html#l00503">unload()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr1" doxytag="NLSOUND::CSampleBank::_Loaded" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr1">NLSOUND::CSampleBank::_Loaded</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00158">158</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankv1" doxytag="NLSOUND::CSampleBank::_LoadedSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a15">uint</a> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankv1">NLSOUND::CSampleBank::_LoadedSize</a> = 0<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00048">48</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +Referenced by <a class="el" href="a06347.html#l00086">getTotalByteSize()</a>, <a class="el" href="a06346.html#l00228">load()</a>, <a class="el" href="a06346.html#l00462">onUpdate()</a>, and <a class="el" href="a06346.html#l00503">unload()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr2" doxytag="NLSOUND::CSampleBank::_LoadingDone" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr2">NLSOUND::CSampleBank::_LoadingDone</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00160">160</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00228">load()</a>, <a class="el" href="a06346.html#l00462">onUpdate()</a>, <a class="el" href="a06346.html#l00503">unload()</a>, and <a class="el" href="a06346.html#l00190">~CSampleBank()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr3" doxytag="NLSOUND::CSampleBank::_LoadList" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> std::list<std::pair<<a class="el" href="a02298.html">IBuffer</a> *, <a class="el" href="a05378.html#a236">NLMISC::TStringId</a>> > <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr3">NLSOUND::CSampleBank::_LoadList</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +List of sample that need to be loaded asynchronously. +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00168">168</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00462">onUpdate()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr4" doxytag="NLSOUND::CSampleBank::_Name" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05378.html#a236">NLMISC::TStringId</a> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr4">NLSOUND::CSampleBank::_Name</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00155">155</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr5" doxytag="NLSOUND::CSampleBank::_Samples" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a05381.html#a50">TSampleTable</a> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr5">NLSOUND::CSampleBank::_Samples</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00151">151</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00587">countSamples()</a>, <a class="el" href="a06346.html#l00555">getSample()</a>, <a class="el" href="a06346.html#l00594">getSize()</a>, <a class="el" href="a06346.html#l00228">load()</a>, <a class="el" href="a06346.html#l00462">onUpdate()</a>, <a class="el" href="a06346.html#l00503">unload()</a>, and <a class="el" href="a06346.html#l00190">~CSampleBank()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr6" doxytag="NLSOUND::CSampleBank::_SoundDriver" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03419.html">ISoundDriver</a>* <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr6">NLSOUND::CSampleBank::_SoundDriver</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00148">148</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankr7" doxytag="NLSOUND::CSampleBank::_SplitLoadDone" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankr7">NLSOUND::CSampleBank::_SplitLoadDone</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Flag for splitted load. +<p> + +<p> +Definition at line <a class="el" href="a06347.html#l00165">165</a> of file <a class="el" href="a06347.html">sample_bank.h</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00462">onUpdate()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLSOUND_1_1CSampleBankv2" doxytag="NLSOUND::CSampleBank::_VirtualBanks" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBanky1">CSampleBank::TVirtualBankCont</a> <a class="el" href="a03346.html#NLSOUND_1_1CSampleBankv2">NLSOUND::CSampleBank::_VirtualBanks</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06346.html#l00050">50</a> of file <a class="el" href="a06346.html">sample_bank.cpp</a>. +<p> +Referenced by <a class="el" href="a06346.html#l00055">init()</a>, and <a class="el" href="a06346.html#l00228">load()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06347.html">sample_bank.h</a><li><a class="el" href="a06346.html">sample_bank.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:39:54 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |