Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > f00c83953c7eb23ee3c18f4f35d8eb6b > files > 252

sfml2-doc-2.0-0.1mdv2010.2.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>SFML - Simple and Fast Multimedia Library</title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="tabs.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="logo">
            <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
        </div>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.htm"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.htm"><span>Classes</span></a></li>
      <li><a href="files.htm"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.htm"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.htm"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.htm"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.htm"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><b>sf</b>::<a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a>
  </div>
</div>
<div class="contents">
<h1>sf::SoundBuffer Class Reference<br/>
<small>
[<a class="el" href="group__audio.htm">Audio module</a>]</small>
</h1><!-- doxytag: class="sf::SoundBuffer" --><!-- doxytag: inherits="Resource&lt; SoundBuffer &gt;" -->
<p>Storage for audio samples defining a sound.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="SoundBuffer_8hpp_source.htm">SoundBuffer.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for sf::SoundBuffer:</div>
<div class="dynsection">
 <div class="center">
  <img src="classsf_1_1SoundBuffer.png" usemap="#sf::SoundBuffer_map" alt=""/>
  <map id="sf::SoundBuffer_map" name="sf::SoundBuffer_map">
<area href="classsf_1_1Resource.htm" alt="sf::Resource&lt; SoundBuffer &gt;" shape="rect" coords="0,0,177,24"/>
</map>
 </div>
</div>

<p><a href="classsf_1_1SoundBuffer-members.htm">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#a0cabfbfe19b831bf7d5c9592d92ef233">SoundBuffer</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default constructor.  <a href="#a0cabfbfe19b831bf7d5c9592d92ef233"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#aaf000fc741ff27015907e8588263f4a6">SoundBuffer</a> (const <a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a> &amp;copy)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Copy constructor.  <a href="#aaf000fc741ff27015907e8588263f4a6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#aea240161724ffba74a0d6a9e277d3cd5">~SoundBuffer</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructor.  <a href="#aea240161724ffba74a0d6a9e277d3cd5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032">LoadFromFile</a> (const std::string &amp;filename)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load the sound buffer from a file.  <a href="#aec8a8960c145915855d956600e9c7032"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#ae5a1a1dc3dd09248490e2d7d540994f2">LoadFromMemory</a> (const void *data, std::size_t sizeInBytes)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load the sound buffer from a file in memory.  <a href="#ae5a1a1dc3dd09248490e2d7d540994f2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#ab6d97f90036ce659e89776126cc22d02">LoadFromStream</a> (<a class="el" href="classsf_1_1InputStream.htm">InputStream</a> &amp;stream)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load the sound buffer from a custom stream.  <a href="#ab6d97f90036ce659e89776126cc22d02"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#ad306b97aeb0010bddaea35d1aeb6e836">LoadFromSamples</a> (const Int16 *samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Load the sound buffer from an array of audio samples.  <a href="#ad306b97aeb0010bddaea35d1aeb6e836"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#a93b8036a7ff5d62791a16bc1b5023e2a">SaveToFile</a> (const std::string &amp;filename) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Save the sound buffer to an audio file.  <a href="#a93b8036a7ff5d62791a16bc1b5023e2a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const Int16 *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#ab31f8ddb0c696171867ae575a8d59eea">GetSamples</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the array of audio samples stored in the buffer.  <a href="#ab31f8ddb0c696171867ae575a8d59eea"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::size_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#a5da93e162669ec8c03b902f622261789">GetSamplesCount</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the number of samples stored in the buffer.  <a href="#a5da93e162669ec8c03b902f622261789"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#ac4b1b885e3720689c6cbc22ff6cbe571">GetSampleRate</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the sample rate of the sound.  <a href="#ac4b1b885e3720689c6cbc22ff6cbe571"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#acfea4667cb8a5e72b1061fa2647af30f">GetChannelsCount</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the number of channels used by the sound.  <a href="#acfea4667cb8a5e72b1061fa2647af30f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">Uint32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#ae4e14bd641836221d5998bf2c6b63578">GetDuration</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the total duration of the sound.  <a href="#ae4e14bd641836221d5998bf2c6b63578"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1SoundBuffer.htm#adcc786b60bbd95be1551368fafd274a7">operator=</a> (const <a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a> &amp;right)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overload of assignment operator.  <a href="#adcc786b60bbd95be1551368fafd274a7"></a><br/></td></tr>
<tr><td colspan="2"><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a50914f77c7cf4fb97616c898c5291f4b"></a><!-- doxytag: member="sf::SoundBuffer::Sound" ref="a50914f77c7cf4fb97616c898c5291f4b" args="" -->
class&nbsp;</td><td class="memItemRight" valign="bottom"><b>Sound</b></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Storage for audio samples defining a sound. </p>
<p>A sound buffer holds the data of a sound, which is an array of audio samples.</p>
<p>A sample is a 16 bits signed integer that defines the amplitude of the sound at a given time. The sound is then restituted by playing these samples at a high rate (for example, 44100 samples per second is the standard rate used for playing CDs). In short, audio samples are like texture pixels, and a <a class="el" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a> is similar to a <a class="el" href="classsf_1_1Texture.htm" title="Image living on the graphics card that can be used for drawing.">sf::Texture</a>.</p>
<p>A sound buffer can be loaded from a file (see <a class="el" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032" title="Load the sound buffer from a file.">LoadFromFile()</a> for the complete list of supported formats), from memory, from a custom stream (see <a class="el" href="classsf_1_1InputStream.htm" title="Abstract class for custom file input streams.">sf::InputStream</a>) or directly from an array of samples. It can also be saved back to a file.</p>
<p><a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">Sound</a> buffers alone are not very useful: they hold the audio data but cannot be played. To do so, you need to use the <a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> class, which provides functions to play/pause/stop the sound as well as changing the way it is outputted (volume, pitch, 3D position, ...). This separation allows more flexibility and better performances: indeed a <a class="el" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a> is a heavy resource, and any operation on it is slow (often too slow for real-time applications). On the other side, a <a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> is a lightweight object, which can use the audio data of a sound buffer and change the way it is played without actually modifying that data. Note that it is also possible to bind several <a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> instances to the same <a class="el" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a>.</p>
<p>It is important to note that the <a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> instance doesn't copy the buffer that it uses, it only keeps a reference to it. Thus, a <a class="el" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a> must not be destructed while it is used by a <a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> (i.e. never write a function that uses a local <a class="el" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a> instance for loading a sound).</p>
<p>Usage example: </p>
<div class="fragment"><pre class="fragment"> <span class="comment">// Declare a new sound buffer</span>
 <a class="code" href="classsf_1_1SoundBuffer.htm" title="Storage for audio samples defining a sound.">sf::SoundBuffer</a> buffer;
 
 <span class="comment">// Load it from a file</span>
 <span class="keywordflow">if</span> (!buffer.<a class="code" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032" title="Load the sound buffer from a file.">LoadFromFile</a>(<span class="stringliteral">&quot;sound.wav&quot;</span>))
 {
     <span class="comment">// error...</span>
 }
 
 <span class="comment">// Create a sound source and bind it to the buffer</span>
 <a class="code" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> sound1;
 sound1.<a class="code" href="classsf_1_1Sound.htm#a8712959d4f0bef9f97b7c69358ba846d" title="Set the source buffer containing the audio data to play.">SetBuffer</a>(buffer);
 
 <span class="comment">// Play the sound</span>
 sound1.<a class="code" href="classsf_1_1Sound.htm#afdafa7970587f04d3833b4095c2de1db" title="Start or resume playing the sound.">Play</a>();
 
 <span class="comment">// Create another sound source bound to the same buffer</span>
 <a class="code" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a> sound2;
 sound2.<a class="code" href="classsf_1_1Sound.htm#a8712959d4f0bef9f97b7c69358ba846d" title="Set the source buffer containing the audio data to play.">SetBuffer</a>(buffer);

 <span class="comment">// Play it with a higher pitch -- the first sound remains unchanged</span>
 sound2.<a class="code" href="classsf_1_1SoundSource.htm#a5837f438c9edd414a6eb2a72b8a4994a" title="Set the pitch of the sound.">SetPitch</a>(2);
 sound2.<a class="code" href="classsf_1_1Sound.htm#afdafa7970587f04d3833b4095c2de1db" title="Start or resume playing the sound.">Play</a>();
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">sf::Sound</a>, <a class="el" href="classsf_1_1SoundBufferRecorder.htm" title="Specialized SoundRecorder which stores the captured audio data into a sound buffer...">sf::SoundBufferRecorder</a> </dd></dl>

<p>Definition at line <a class="el" href="SoundBuffer_8hpp_source.htm#l00052">52</a> of file <a class="el" href="SoundBuffer_8hpp_source.htm">SoundBuffer.hpp</a>.</p>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a0cabfbfe19b831bf7d5c9592d92ef233"></a><!-- doxytag: member="sf::SoundBuffer::SoundBuffer" ref="a0cabfbfe19b831bf7d5c9592d92ef233" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sf::SoundBuffer::SoundBuffer </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Default constructor. </p>

</div>
</div>
<a class="anchor" id="aaf000fc741ff27015907e8588263f4a6"></a><!-- doxytag: member="sf::SoundBuffer::SoundBuffer" ref="aaf000fc741ff27015907e8588263f4a6" args="(const SoundBuffer &amp;copy)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sf::SoundBuffer::SoundBuffer </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>copy</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Copy constructor. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>copy</em>&nbsp;</td><td>Instance to copy </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aea240161724ffba74a0d6a9e277d3cd5"></a><!-- doxytag: member="sf::SoundBuffer::~SoundBuffer" ref="aea240161724ffba74a0d6a9e277d3cd5" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sf::SoundBuffer::~SoundBuffer </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destructor. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="acfea4667cb8a5e72b1061fa2647af30f"></a><!-- doxytag: member="sf::SoundBuffer::GetChannelsCount" ref="acfea4667cb8a5e72b1061fa2647af30f" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int sf::SoundBuffer::GetChannelsCount </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the number of channels used by the sound. </p>
<p>If the sound is mono then the number of channels will be 1, 2 for stereo, etc.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of channels</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#ac4b1b885e3720689c6cbc22ff6cbe571" title="Get the sample rate of the sound.">GetSampleRate</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ae4e14bd641836221d5998bf2c6b63578" title="Get the total duration of the sound.">GetDuration</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ae4e14bd641836221d5998bf2c6b63578"></a><!-- doxytag: member="sf::SoundBuffer::GetDuration" ref="ae4e14bd641836221d5998bf2c6b63578" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Uint32 sf::SoundBuffer::GetDuration </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the total duration of the sound. </p>
<dl class="return"><dt><b>Returns:</b></dt><dd><a class="el" href="classsf_1_1Sound.htm" title="Regular sound that can be played in the audio environment.">Sound</a> duration, in milliseconds</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#ac4b1b885e3720689c6cbc22ff6cbe571" title="Get the sample rate of the sound.">GetSampleRate</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#acfea4667cb8a5e72b1061fa2647af30f" title="Get the number of channels used by the sound.">GetChannelsCount</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ac4b1b885e3720689c6cbc22ff6cbe571"></a><!-- doxytag: member="sf::SoundBuffer::GetSampleRate" ref="ac4b1b885e3720689c6cbc22ff6cbe571" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">unsigned int sf::SoundBuffer::GetSampleRate </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the sample rate of the sound. </p>
<p>The sample rate is the number of samples played per second. The higher, the better the quality (for example, 44100 samples/s is CD quality).</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Sample rate (number of samples per second)</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#acfea4667cb8a5e72b1061fa2647af30f" title="Get the number of channels used by the sound.">GetChannelsCount</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ae4e14bd641836221d5998bf2c6b63578" title="Get the total duration of the sound.">GetDuration</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ab31f8ddb0c696171867ae575a8d59eea"></a><!-- doxytag: member="sf::SoundBuffer::GetSamples" ref="ab31f8ddb0c696171867ae575a8d59eea" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const Int16* sf::SoundBuffer::GetSamples </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the array of audio samples stored in the buffer. </p>
<p>The format of the returned samples is 16 bits signed integer (sf::Int16). The total number of samples in this array is given by the <a class="el" href="classsf_1_1SoundBuffer.htm#a5da93e162669ec8c03b902f622261789" title="Get the number of samples stored in the buffer.">GetSamplesCount()</a> function.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Read-only pointer to the array of sound samples</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#a5da93e162669ec8c03b902f622261789" title="Get the number of samples stored in the buffer.">GetSamplesCount</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a5da93e162669ec8c03b902f622261789"></a><!-- doxytag: member="sf::SoundBuffer::GetSamplesCount" ref="a5da93e162669ec8c03b902f622261789" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::size_t sf::SoundBuffer::GetSamplesCount </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the number of samples stored in the buffer. </p>
<p>The array of samples can be accessed with the <a class="el" href="classsf_1_1SoundBuffer.htm#ab31f8ddb0c696171867ae575a8d59eea" title="Get the array of audio samples stored in the buffer.">GetSamples()</a> function.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of samples</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#ab31f8ddb0c696171867ae575a8d59eea" title="Get the array of audio samples stored in the buffer.">GetSamples</a> </dd></dl>

</div>
</div>
<a class="anchor" id="aec8a8960c145915855d956600e9c7032"></a><!-- doxytag: member="sf::SoundBuffer::LoadFromFile" ref="aec8a8960c145915855d956600e9c7032" args="(const std::string &amp;filename)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool sf::SoundBuffer::LoadFromFile </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>filename</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Load the sound buffer from a file. </p>
<p>Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>Path of the sound file to load</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>True if loading succeeded, false if it failed</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#ae5a1a1dc3dd09248490e2d7d540994f2" title="Load the sound buffer from a file in memory.">LoadFromMemory</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ab6d97f90036ce659e89776126cc22d02" title="Load the sound buffer from a custom stream.">LoadFromStream</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ad306b97aeb0010bddaea35d1aeb6e836" title="Load the sound buffer from an array of audio samples.">LoadFromSamples</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#a93b8036a7ff5d62791a16bc1b5023e2a" title="Save the sound buffer to an audio file.">SaveToFile</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ae5a1a1dc3dd09248490e2d7d540994f2"></a><!-- doxytag: member="sf::SoundBuffer::LoadFromMemory" ref="ae5a1a1dc3dd09248490e2d7d540994f2" args="(const void *data, std::size_t sizeInBytes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool sf::SoundBuffer::LoadFromMemory </td>
          <td>(</td>
          <td class="paramtype">const void *&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::size_t&nbsp;</td>
          <td class="paramname"> <em>sizeInBytes</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Load the sound buffer from a file in memory. </p>
<p>Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>Pointer to the file data in memory </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sizeInBytes</em>&nbsp;</td><td>Size of the data to load, in bytes</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>True if loading succeeded, false if it failed</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032" title="Load the sound buffer from a file.">LoadFromFile</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ab6d97f90036ce659e89776126cc22d02" title="Load the sound buffer from a custom stream.">LoadFromStream</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ad306b97aeb0010bddaea35d1aeb6e836" title="Load the sound buffer from an array of audio samples.">LoadFromSamples</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ad306b97aeb0010bddaea35d1aeb6e836"></a><!-- doxytag: member="sf::SoundBuffer::LoadFromSamples" ref="ad306b97aeb0010bddaea35d1aeb6e836" args="(const Int16 *samples, std::size_t samplesCount, unsigned int channelsCount, unsigned int sampleRate)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool sf::SoundBuffer::LoadFromSamples </td>
          <td>(</td>
          <td class="paramtype">const Int16 *&nbsp;</td>
          <td class="paramname"> <em>samples</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::size_t&nbsp;</td>
          <td class="paramname"> <em>samplesCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>channelsCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>sampleRate</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Load the sound buffer from an array of audio samples. </p>
<p>The assumed format of the audio samples is 16 bits signed integer (sf::Int16).</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>samples</em>&nbsp;</td><td>Pointer to the array of samples in memory </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>samplesCount</em>&nbsp;</td><td>Number of samples in the array </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>channelsCount</em>&nbsp;</td><td>Number of channels (1 = mono, 2 = stereo, ...) </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sampleRate</em>&nbsp;</td><td>Sample rate (number of samples to play per second)</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>True if loading succeeded, false if it failed</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032" title="Load the sound buffer from a file.">LoadFromFile</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ae5a1a1dc3dd09248490e2d7d540994f2" title="Load the sound buffer from a file in memory.">LoadFromMemory</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#a93b8036a7ff5d62791a16bc1b5023e2a" title="Save the sound buffer to an audio file.">SaveToFile</a> </dd></dl>

</div>
</div>
<a class="anchor" id="ab6d97f90036ce659e89776126cc22d02"></a><!-- doxytag: member="sf::SoundBuffer::LoadFromStream" ref="ab6d97f90036ce659e89776126cc22d02" args="(InputStream &amp;stream)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool sf::SoundBuffer::LoadFromStream </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classsf_1_1InputStream.htm">InputStream</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>stream</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Load the sound buffer from a custom stream. </p>
<p>Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>stream</em>&nbsp;</td><td>Source stream to read from</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>True if loading succeeded, false if it failed</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032" title="Load the sound buffer from a file.">LoadFromFile</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ae5a1a1dc3dd09248490e2d7d540994f2" title="Load the sound buffer from a file in memory.">LoadFromMemory</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ad306b97aeb0010bddaea35d1aeb6e836" title="Load the sound buffer from an array of audio samples.">LoadFromSamples</a> </dd></dl>

</div>
</div>
<a class="anchor" id="adcc786b60bbd95be1551368fafd274a7"></a><!-- doxytag: member="sf::SoundBuffer::operator=" ref="adcc786b60bbd95be1551368fafd274a7" args="(const SoundBuffer &amp;right)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a>&amp; sf::SoundBuffer::operator= </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsf_1_1SoundBuffer.htm">SoundBuffer</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>right</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Overload of assignment operator. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>right</em>&nbsp;</td><td>Instance to assign</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Reference to self </dd></dl>

</div>
</div>
<a class="anchor" id="a93b8036a7ff5d62791a16bc1b5023e2a"></a><!-- doxytag: member="sf::SoundBuffer::SaveToFile" ref="a93b8036a7ff5d62791a16bc1b5023e2a" args="(const std::string &amp;filename) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool sf::SoundBuffer::SaveToFile </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>filename</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Save the sound buffer to an audio file. </p>
<p>Here is a complete list of all the supported audio formats: ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4, mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>filename</em>&nbsp;</td><td>Path of the sound file to write</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>True if saving succeeded, false if it failed</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1SoundBuffer.htm#aec8a8960c145915855d956600e9c7032" title="Load the sound buffer from a file.">LoadFromFile</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ae5a1a1dc3dd09248490e2d7d540994f2" title="Load the sound buffer from a file in memory.">LoadFromMemory</a>, <a class="el" href="classsf_1_1SoundBuffer.htm#ad306b97aeb0010bddaea35d1aeb6e836" title="Load the sound buffer from an array of audio samples.">LoadFromSamples</a> </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="SoundBuffer_8hpp_source.htm">SoundBuffer.hpp</a></li>
</ul>
</div>

        <p id="footer">
            &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
            Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
        </p>

    </body>
</html>