shooter/SFML-VS32/doc/html/classsf_1_1InputSoundFile.html

482 lines
29 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SFML - Simple and Fast Multimedia Library</title>
<meta http-equiv="Content-Type" content="text/html;"/>
<meta charset="utf-8"/>
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
</head>
<body>
<div id="banner-container">
<div id="banner">
<span id="sfml">SFML 2.5.1</span>
</div>
</div>
<div id="content">
<!-- Generated by Doxygen 1.8.14 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="classes.html"><span>Class&#160;Index</span></a></li>
<li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1InputSoundFile.html">InputSoundFile</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classsf_1_1InputSoundFile-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">sf::InputSoundFile Class Reference<div class="ingroups"><a class="el" href="group__audio.html">Audio module</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>Provide read access to sound files.
<a href="classsf_1_1InputSoundFile.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="InputSoundFile_8hpp_source.html">InputSoundFile.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for sf::InputSoundFile:</div>
<div class="dyncontent">
<div class="center">
<img src="classsf_1_1InputSoundFile.png" usemap="#sf::InputSoundFile_map" alt=""/>
<map id="sf::InputSoundFile_map" name="sf::InputSoundFile_map">
<area href="classsf_1_1NonCopyable.html" title="Utility class that makes any derived class non-copyable. " alt="sf::NonCopyable" shape="rect" coords="0,0,112,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3b95347de25d1d93a3230287cf47a077"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a3b95347de25d1d93a3230287cf47a077">InputSoundFile</a> ()</td></tr>
<tr class="memdesc:a3b95347de25d1d93a3230287cf47a077"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor. <a href="#a3b95347de25d1d93a3230287cf47a077">More...</a><br /></td></tr>
<tr class="separator:a3b95347de25d1d93a3230287cf47a077"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a326a1a486587038123de0c187bf5c635"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a326a1a486587038123de0c187bf5c635">~InputSoundFile</a> ()</td></tr>
<tr class="memdesc:a326a1a486587038123de0c187bf5c635"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <a href="#a326a1a486587038123de0c187bf5c635">More...</a><br /></td></tr>
<tr class="separator:a326a1a486587038123de0c187bf5c635"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af68e54bc9bfac19554c84601156fe93f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#af68e54bc9bfac19554c84601156fe93f">openFromFile</a> (const std::string &amp;filename)</td></tr>
<tr class="memdesc:af68e54bc9bfac19554c84601156fe93f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a sound file from the disk for reading. <a href="#af68e54bc9bfac19554c84601156fe93f">More...</a><br /></td></tr>
<tr class="separator:af68e54bc9bfac19554c84601156fe93f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4e034a8e9e69ca3c33a3f11180250400"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a4e034a8e9e69ca3c33a3f11180250400">openFromMemory</a> (const void *data, std::size_t sizeInBytes)</td></tr>
<tr class="memdesc:a4e034a8e9e69ca3c33a3f11180250400"><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a sound file in memory for reading. <a href="#a4e034a8e9e69ca3c33a3f11180250400">More...</a><br /></td></tr>
<tr class="separator:a4e034a8e9e69ca3c33a3f11180250400"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a32b76497aeb088a2b46dc6efd819b909"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a32b76497aeb088a2b46dc6efd819b909">openFromStream</a> (<a class="el" href="classsf_1_1InputStream.html">InputStream</a> &amp;stream)</td></tr>
<tr class="memdesc:a32b76497aeb088a2b46dc6efd819b909"><td class="mdescLeft">&#160;</td><td class="mdescRight">Open a sound file from a custom stream for reading. <a href="#a32b76497aeb088a2b46dc6efd819b909">More...</a><br /></td></tr>
<tr class="separator:a32b76497aeb088a2b46dc6efd819b909"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a665b7fed6cdca3e0c622909e5a6655e4"><td class="memItemLeft" align="right" valign="top">Uint64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a665b7fed6cdca3e0c622909e5a6655e4">getSampleCount</a> () const</td></tr>
<tr class="memdesc:a665b7fed6cdca3e0c622909e5a6655e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the total number of audio samples in the file. <a href="#a665b7fed6cdca3e0c622909e5a6655e4">More...</a><br /></td></tr>
<tr class="separator:a665b7fed6cdca3e0c622909e5a6655e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a54307c308ba05dea63aba54a29c804a4"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a54307c308ba05dea63aba54a29c804a4">getChannelCount</a> () const</td></tr>
<tr class="memdesc:a54307c308ba05dea63aba54a29c804a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the number of channels used by the sound. <a href="#a54307c308ba05dea63aba54a29c804a4">More...</a><br /></td></tr>
<tr class="separator:a54307c308ba05dea63aba54a29c804a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b8177e40dd8020752f6d52f96b774c3"><td class="memItemLeft" align="right" valign="top">unsigned int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a6b8177e40dd8020752f6d52f96b774c3">getSampleRate</a> () const</td></tr>
<tr class="memdesc:a6b8177e40dd8020752f6d52f96b774c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the sample rate of the sound. <a href="#a6b8177e40dd8020752f6d52f96b774c3">More...</a><br /></td></tr>
<tr class="separator:a6b8177e40dd8020752f6d52f96b774c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa081bd4d9732408d10b48227a360778e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classsf_1_1Time.html">Time</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#aa081bd4d9732408d10b48227a360778e">getDuration</a> () const</td></tr>
<tr class="memdesc:aa081bd4d9732408d10b48227a360778e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the total duration of the sound file. <a href="#aa081bd4d9732408d10b48227a360778e">More...</a><br /></td></tr>
<tr class="separator:aa081bd4d9732408d10b48227a360778e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad1a2238acb734d8b1144ecd75cccc2e7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classsf_1_1Time.html">Time</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#ad1a2238acb734d8b1144ecd75cccc2e7">getTimeOffset</a> () const</td></tr>
<tr class="memdesc:ad1a2238acb734d8b1144ecd75cccc2e7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the read offset of the file in time. <a href="#ad1a2238acb734d8b1144ecd75cccc2e7">More...</a><br /></td></tr>
<tr class="separator:ad1a2238acb734d8b1144ecd75cccc2e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73a99f159e8aca6e39478f6cf686d7ad"><td class="memItemLeft" align="right" valign="top">Uint64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a73a99f159e8aca6e39478f6cf686d7ad">getSampleOffset</a> () const</td></tr>
<tr class="memdesc:a73a99f159e8aca6e39478f6cf686d7ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the read offset of the file in samples. <a href="#a73a99f159e8aca6e39478f6cf686d7ad">More...</a><br /></td></tr>
<tr class="separator:a73a99f159e8aca6e39478f6cf686d7ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf97be15020a42e159ff88f76f22af20"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#aaf97be15020a42e159ff88f76f22af20">seek</a> (Uint64 sampleOffset)</td></tr>
<tr class="memdesc:aaf97be15020a42e159ff88f76f22af20"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the current read position to the given sample offset. <a href="#aaf97be15020a42e159ff88f76f22af20">More...</a><br /></td></tr>
<tr class="separator:aaf97be15020a42e159ff88f76f22af20"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8eee7af58ad75ddc61f93ad72e2d66c1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a8eee7af58ad75ddc61f93ad72e2d66c1">seek</a> (<a class="el" href="classsf_1_1Time.html">Time</a> timeOffset)</td></tr>
<tr class="memdesc:a8eee7af58ad75ddc61f93ad72e2d66c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change the current read position to the given time offset. <a href="#a8eee7af58ad75ddc61f93ad72e2d66c1">More...</a><br /></td></tr>
<tr class="separator:a8eee7af58ad75ddc61f93ad72e2d66c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a83d6f64617456601edeb0daf9d14a17f"><td class="memItemLeft" align="right" valign="top">Uint64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1InputSoundFile.html#a83d6f64617456601edeb0daf9d14a17f">read</a> (Int16 *samples, Uint64 maxCount)</td></tr>
<tr class="memdesc:a83d6f64617456601edeb0daf9d14a17f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read audio samples from the open file. <a href="#a83d6f64617456601edeb0daf9d14a17f">More...</a><br /></td></tr>
<tr class="separator:a83d6f64617456601edeb0daf9d14a17f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Provide read access to sound files. </p>
<p>This class decodes audio samples from a sound file.</p>
<p>It is used internally by higher-level classes such as <a class="el" href="classsf_1_1SoundBuffer.html" title="Storage for audio samples defining a sound. ">sf::SoundBuffer</a> and <a class="el" href="classsf_1_1Music.html" title="Streamed music played from an audio file. ">sf::Music</a>, but can also be useful if you want to process or analyze audio files without playing them, or if you want to implement your own version of <a class="el" href="classsf_1_1Music.html" title="Streamed music played from an audio file. ">sf::Music</a> with more specific features.</p>
<p>Usage example: </p><div class="fragment"><div class="line"><span class="comment">// Open a sound file</span></div><div class="line"><a class="code" href="classsf_1_1InputSoundFile.html">sf::InputSoundFile</a> file;</div><div class="line"><span class="keywordflow">if</span> (!file.<a class="code" href="classsf_1_1InputSoundFile.html#af68e54bc9bfac19554c84601156fe93f">openFromFile</a>(<span class="stringliteral">&quot;music.ogg&quot;</span>))</div><div class="line"> <span class="comment">/* error */</span>;</div><div class="line"></div><div class="line"><span class="comment">// Print the sound attributes</span></div><div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;duration: &quot;</span> &lt;&lt; file.<a class="code" href="classsf_1_1InputSoundFile.html#aa081bd4d9732408d10b48227a360778e">getDuration</a>().<a class="code" href="classsf_1_1Time.html#aa3df2f992d0b0041b4eb02258d43f0e3">asSeconds</a>() &lt;&lt; std::endl;</div><div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;channels: &quot;</span> &lt;&lt; file.<a class="code" href="classsf_1_1InputSoundFile.html#a54307c308ba05dea63aba54a29c804a4">getChannelCount</a>() &lt;&lt; std::endl;</div><div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;sample rate: &quot;</span> &lt;&lt; file.<a class="code" href="classsf_1_1InputSoundFile.html#a6b8177e40dd8020752f6d52f96b774c3">getSampleRate</a>() &lt;&lt; std::endl;</div><div class="line">std::cout &lt;&lt; <span class="stringliteral">&quot;sample count: &quot;</span> &lt;&lt; file.<a class="code" href="classsf_1_1InputSoundFile.html#a665b7fed6cdca3e0c622909e5a6655e4">getSampleCount</a>() &lt;&lt; std::endl;</div><div class="line"></div><div class="line"><span class="comment">// Read and process batches of samples until the end of file is reached</span></div><div class="line">sf::Int16 samples[1024];</div><div class="line">sf::Uint64 count;</div><div class="line"><span class="keywordflow">do</span></div><div class="line">{</div><div class="line"> count = file.<a class="code" href="classsf_1_1InputSoundFile.html#a83d6f64617456601edeb0daf9d14a17f">read</a>(samples, 1024);</div><div class="line"></div><div class="line"> <span class="comment">// process, analyze, play, convert, or whatever</span></div><div class="line"> <span class="comment">// you want to do with the samples...</span></div><div class="line">}</div><div class="line"><span class="keywordflow">while</span> (count &gt; 0);</div></div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1SoundFileReader.html" title="Abstract base class for sound file decoding. ">sf::SoundFileReader</a>, <a class="el" href="classsf_1_1OutputSoundFile.html" title="Provide write access to sound files. ">sf::OutputSoundFile</a> </dd></dl>
<p class="definition">Definition at line <a class="el" href="InputSoundFile_8hpp_source.html#l00047">47</a> of file <a class="el" href="InputSoundFile_8hpp_source.html">InputSoundFile.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a3b95347de25d1d93a3230287cf47a077"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b95347de25d1d93a3230287cf47a077">&#9670;&nbsp;</a></span>InputSoundFile()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">sf::InputSoundFile::InputSoundFile </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Default constructor. </p>
</div>
</div>
<a id="a326a1a486587038123de0c187bf5c635"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a326a1a486587038123de0c187bf5c635">&#9670;&nbsp;</a></span>~InputSoundFile()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">sf::InputSoundFile::~InputSoundFile </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a54307c308ba05dea63aba54a29c804a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a54307c308ba05dea63aba54a29c804a4">&#9670;&nbsp;</a></span>getChannelCount()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned int sf::InputSoundFile::getChannelCount </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the number of channels used by the sound. </p>
<dl class="section return"><dt>Returns</dt><dd>Number of channels (1 = mono, 2 = stereo) </dd></dl>
</div>
</div>
<a id="aa081bd4d9732408d10b48227a360778e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa081bd4d9732408d10b48227a360778e">&#9670;&nbsp;</a></span>getDuration()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classsf_1_1Time.html">Time</a> sf::InputSoundFile::getDuration </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the total duration of the sound file. </p>
<p>This function is provided for convenience, the duration is deduced from the other sound file attributes.</p>
<dl class="section return"><dt>Returns</dt><dd>Duration of the sound file </dd></dl>
</div>
</div>
<a id="a665b7fed6cdca3e0c622909e5a6655e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a665b7fed6cdca3e0c622909e5a6655e4">&#9670;&nbsp;</a></span>getSampleCount()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint64 sf::InputSoundFile::getSampleCount </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the total number of audio samples in the file. </p>
<dl class="section return"><dt>Returns</dt><dd>Number of samples </dd></dl>
</div>
</div>
<a id="a73a99f159e8aca6e39478f6cf686d7ad"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a73a99f159e8aca6e39478f6cf686d7ad">&#9670;&nbsp;</a></span>getSampleOffset()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint64 sf::InputSoundFile::getSampleOffset </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the read offset of the file in samples. </p>
<dl class="section return"><dt>Returns</dt><dd>Sample position </dd></dl>
</div>
</div>
<a id="a6b8177e40dd8020752f6d52f96b774c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6b8177e40dd8020752f6d52f96b774c3">&#9670;&nbsp;</a></span>getSampleRate()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">unsigned int sf::InputSoundFile::getSampleRate </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the sample rate of the sound. </p>
<dl class="section return"><dt>Returns</dt><dd>Sample rate, in samples per second </dd></dl>
</div>
</div>
<a id="ad1a2238acb734d8b1144ecd75cccc2e7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad1a2238acb734d8b1144ecd75cccc2e7">&#9670;&nbsp;</a></span>getTimeOffset()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classsf_1_1Time.html">Time</a> sf::InputSoundFile::getTimeOffset </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the read offset of the file in time. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="classsf_1_1Time.html" title="Represents a time value. ">Time</a> position </dd></dl>
</div>
</div>
<a id="af68e54bc9bfac19554c84601156fe93f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af68e54bc9bfac19554c84601156fe93f">&#9670;&nbsp;</a></span>openFromFile()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool sf::InputSoundFile::openFromFile </td>
<td>(</td>
<td class="paramtype">const std::string &amp;&#160;</td>
<td class="paramname"><em>filename</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Open a sound file from the disk for reading. </p>
<p>The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC. The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">filename</td><td>Path of the sound file to load</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if the file was successfully opened </dd></dl>
</div>
</div>
<a id="a4e034a8e9e69ca3c33a3f11180250400"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4e034a8e9e69ca3c33a3f11180250400">&#9670;&nbsp;</a></span>openFromMemory()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool sf::InputSoundFile::openFromMemory </td>
<td>(</td>
<td class="paramtype">const void *&#160;</td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::size_t&#160;</td>
<td class="paramname"><em>sizeInBytes</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Open a sound file in memory for reading. </p>
<p>The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC. The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">data</td><td>Pointer to the file data in memory </td></tr>
<tr><td class="paramname">sizeInBytes</td><td>Size of the data to load, in bytes</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if the file was successfully opened </dd></dl>
</div>
</div>
<a id="a32b76497aeb088a2b46dc6efd819b909"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a32b76497aeb088a2b46dc6efd819b909">&#9670;&nbsp;</a></span>openFromStream()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool sf::InputSoundFile::openFromStream </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classsf_1_1InputStream.html">InputStream</a> &amp;&#160;</td>
<td class="paramname"><em>stream</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Open a sound file from a custom stream for reading. </p>
<p>The supported audio formats are: WAV (PCM only), OGG/Vorbis, FLAC. The supported sample sizes for FLAC and WAV are 8, 16, 24 and 32 bit.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">stream</td><td>Source stream to read from</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if the file was successfully opened </dd></dl>
</div>
</div>
<a id="a83d6f64617456601edeb0daf9d14a17f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a83d6f64617456601edeb0daf9d14a17f">&#9670;&nbsp;</a></span>read()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Uint64 sf::InputSoundFile::read </td>
<td>(</td>
<td class="paramtype">Int16 *&#160;</td>
<td class="paramname"><em>samples</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">Uint64&#160;</td>
<td class="paramname"><em>maxCount</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read audio samples from the open file. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">samples</td><td>Pointer to the sample array to fill </td></tr>
<tr><td class="paramname">maxCount</td><td>Maximum number of samples to read</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of samples actually read (may be less than <em>maxCount</em>) </dd></dl>
</div>
</div>
<a id="aaf97be15020a42e159ff88f76f22af20"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaf97be15020a42e159ff88f76f22af20">&#9670;&nbsp;</a></span>seek() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void sf::InputSoundFile::seek </td>
<td>(</td>
<td class="paramtype">Uint64&#160;</td>
<td class="paramname"><em>sampleOffset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the current read position to the given sample offset. </p>
<p>This function takes a sample offset to provide maximum precision. If you need to jump to a given time, use the other overload.</p>
<p>The sample offset takes the channels into account. If you have a time offset instead, you can easily find the corresponding sample offset with the following formula: <code>timeInSeconds * sampleRate * channelCount</code> If the given offset exceeds to total number of samples, this function jumps to the end of the sound file.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">sampleOffset</td><td>Index of the sample to jump to, relative to the beginning </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a8eee7af58ad75ddc61f93ad72e2d66c1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8eee7af58ad75ddc61f93ad72e2d66c1">&#9670;&nbsp;</a></span>seek() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void sf::InputSoundFile::seek </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classsf_1_1Time.html">Time</a>&#160;</td>
<td class="paramname"><em>timeOffset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the current read position to the given time offset. </p>
<p>Using a time offset is handy but imprecise. If you need an accurate result, consider using the overload which takes a sample offset.</p>
<p>If the given time exceeds to total duration, this function jumps to the end of the sound file.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">timeOffset</td><td><a class="el" href="classsf_1_1Time.html" title="Represents a time value. ">Time</a> to jump to, relative to the beginning </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="InputSoundFile_8hpp_source.html">InputSoundFile.hpp</a></li>
</ul>
</div><!-- contents -->
</div>
<div id="footer-container">
<div id="footer">
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
Copyright &copy; Laurent Gomila &nbsp;::&nbsp;
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
</div>
</div>
</body>
</html>