<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Audaspace: MutableReader Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Audaspace  <span id="projectnumber">1.3.0</span> </div> <div id="projectbrief">A high level audio library.</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="classMutableReader-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">MutableReader Class Reference</div> </div> </div><!--header--> <div class="contents"> <p>This class represents a reader for a sound that can change with each playback. <a href="classMutableReader.html#details">More...</a></p> <p><code>#include <<a class="el" href="MutableReader_8h_source.html">MutableReader.h</a>></code></p> <div class="dynheader"> Inheritance diagram for MutableReader:</div> <div class="dyncontent"> <div class="center"><img src="classMutableReader__inherit__graph.png" border="0" usemap="#MutableReader_inherit__map" alt="Inheritance graph"/></div> <map name="MutableReader_inherit__map" id="MutableReader_inherit__map"> <area shape="rect" title="This class represents a reader for a sound that can change with each playback." alt="" coords="5,80,120,107"/> <area shape="rect" href="classIReader.html" title="This class represents a sound source as stream or as buffer which can be read for example by another ..." alt="" coords="28,5,97,32"/> </map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></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:a3eeaa50ed78885870114e2bfa3bb7c25"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#a3eeaa50ed78885870114e2bfa3bb7c25">MutableReader</a> (std::shared_ptr< <a class="el" href="classISound.html">ISound</a> > sound)</td></tr> <tr class="memdesc:a3eeaa50ed78885870114e2bfa3bb7c25"><td class="mdescLeft"> </td><td class="mdescRight">Creates a new mutable reader. <a href="#a3eeaa50ed78885870114e2bfa3bb7c25">More...</a><br /></td></tr> <tr class="separator:a3eeaa50ed78885870114e2bfa3bb7c25"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a2b5d8637ef753d1c7be18b7569be2252"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#a2b5d8637ef753d1c7be18b7569be2252">isSeekable</a> () const</td></tr> <tr class="memdesc:a2b5d8637ef753d1c7be18b7569be2252"><td class="mdescLeft"> </td><td class="mdescRight">Tells whether the source provides seeking functionality or not. <a href="#a2b5d8637ef753d1c7be18b7569be2252">More...</a><br /></td></tr> <tr class="separator:a2b5d8637ef753d1c7be18b7569be2252"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a6121a911a2601592871c20ca6e246a33"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#a6121a911a2601592871c20ca6e246a33">seek</a> (int position)</td></tr> <tr class="memdesc:a6121a911a2601592871c20ca6e246a33"><td class="mdescLeft"> </td><td class="mdescRight">Seeks to a specific position in the source. <a href="#a6121a911a2601592871c20ca6e246a33">More...</a><br /></td></tr> <tr class="separator:a6121a911a2601592871c20ca6e246a33"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aeff098ea846f56a526cd7f8bcf32c749"><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#aeff098ea846f56a526cd7f8bcf32c749">getLength</a> () const</td></tr> <tr class="memdesc:aeff098ea846f56a526cd7f8bcf32c749"><td class="mdescLeft"> </td><td class="mdescRight">Returns an approximated length of the source in samples. <a href="#aeff098ea846f56a526cd7f8bcf32c749">More...</a><br /></td></tr> <tr class="separator:aeff098ea846f56a526cd7f8bcf32c749"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8c034845192bd374cb4b17141e2beb3c"><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#a8c034845192bd374cb4b17141e2beb3c">getPosition</a> () const</td></tr> <tr class="memdesc:a8c034845192bd374cb4b17141e2beb3c"><td class="mdescLeft"> </td><td class="mdescRight">Returns the position of the source as a sample count value. <a href="#a8c034845192bd374cb4b17141e2beb3c">More...</a><br /></td></tr> <tr class="separator:a8c034845192bd374cb4b17141e2beb3c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ad30788fb96706c3a46ce46cb235b9b5a"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="structSpecs.html">Specs</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#ad30788fb96706c3a46ce46cb235b9b5a">getSpecs</a> () const</td></tr> <tr class="memdesc:ad30788fb96706c3a46ce46cb235b9b5a"><td class="mdescLeft"> </td><td class="mdescRight">Returns the specification of the reader. <a href="#ad30788fb96706c3a46ce46cb235b9b5a">More...</a><br /></td></tr> <tr class="separator:ad30788fb96706c3a46ce46cb235b9b5a"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a43a0c05317ee33b40a6718c075c2ab4d"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classMutableReader.html#a43a0c05317ee33b40a6718c075c2ab4d">read</a> (int &length, bool &eos, <a class="el" href="Audaspace_8h.html#aa0798f7ea0975b143a1d9deac8c05d43">sample_t</a> *buffer)</td></tr> <tr class="memdesc:a43a0c05317ee33b40a6718c075c2ab4d"><td class="mdescLeft"> </td><td class="mdescRight">Request to read the next length samples out of the source. <a href="#a43a0c05317ee33b40a6718c075c2ab4d">More...</a><br /></td></tr> <tr class="separator:a43a0c05317ee33b40a6718c075c2ab4d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="inherit_header pub_methods_classIReader"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classIReader')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="classIReader.html">IReader</a></td></tr> <tr class="memitem:a3489c23855da532dd3a10cfae78bc899 inherit pub_methods_classIReader"><td class="memItemLeft" align="right" valign="top"><a id="a3489c23855da532dd3a10cfae78bc899"></a> virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classIReader.html#a3489c23855da532dd3a10cfae78bc899">~IReader</a> ()</td></tr> <tr class="memdesc:a3489c23855da532dd3a10cfae78bc899 inherit pub_methods_classIReader"><td class="mdescLeft"> </td><td class="mdescRight">Destroys the reader. <br /></td></tr> <tr class="separator:a3489c23855da532dd3a10cfae78bc899 inherit pub_methods_classIReader"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>This class represents a reader for a sound that can change with each playback. </p> <p>The change will occur when trying to seek backwards If the sound doesn't support that, it will be restarted. </p><dl class="section warning"><dt>Warning</dt><dd>Notice that if a <a class="el" href="classSoundList.html" title="This class allows to have a list of sound that will play sequentially or randomly with each playback.">SoundList</a> object is assigned to several MutableReaders, sequential playback won't work correctly. To prevent this the <a class="el" href="classSoundList.html" title="This class allows to have a list of sound that will play sequentially or randomly with each playback.">SoundList</a> must be copied. </dd></dl> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> <a id="a3eeaa50ed78885870114e2bfa3bb7c25"></a> <h2 class="memtitle"><span class="permalink"><a href="#a3eeaa50ed78885870114e2bfa3bb7c25">◆ </a></span>MutableReader()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">MutableReader::MutableReader </td> <td>(</td> <td class="paramtype">std::shared_ptr< <a class="el" href="classISound.html">ISound</a> > </td> <td class="paramname"><em>sound</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Creates a new mutable reader. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">sound</td><td>A of sound you want to assign to this reader. </td></tr> </table> </dd> </dl> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a id="aeff098ea846f56a526cd7f8bcf32c749"></a> <h2 class="memtitle"><span class="permalink"><a href="#aeff098ea846f56a526cd7f8bcf32c749">◆ </a></span>getLength()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual int MutableReader::getLength </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Returns an approximated length of the source in samples. </p> <dl class="section return"><dt>Returns</dt><dd>The length as sample count. May be negative if unknown. </dd></dl> <p>Implements <a class="el" href="classIReader.html#a384465b5d988cc802702ae4bdc56ea85">IReader</a>.</p> </div> </div> <a id="a8c034845192bd374cb4b17141e2beb3c"></a> <h2 class="memtitle"><span class="permalink"><a href="#a8c034845192bd374cb4b17141e2beb3c">◆ </a></span>getPosition()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual int MutableReader::getPosition </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Returns the position of the source as a sample count value. </p> <dl class="section return"><dt>Returns</dt><dd>The current position in the source. A negative value indicates that the position is unknown. </dd></dl> <dl class="section warning"><dt>Warning</dt><dd>The value returned doesn't always have to be correct for readers, especially after seeking. </dd></dl> <p>Implements <a class="el" href="classIReader.html#a47a8f86fd242a02ff626eb506cdb319d">IReader</a>.</p> </div> </div> <a id="ad30788fb96706c3a46ce46cb235b9b5a"></a> <h2 class="memtitle"><span class="permalink"><a href="#ad30788fb96706c3a46ce46cb235b9b5a">◆ </a></span>getSpecs()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="structSpecs.html">Specs</a> MutableReader::getSpecs </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Returns the specification of the reader. </p> <dl class="section return"><dt>Returns</dt><dd>The <a class="el" href="structSpecs.html" title="Specification of a sound source.">Specs</a> structure. </dd></dl> <p>Implements <a class="el" href="classIReader.html#aac4f3a14d42e5c4280488db98dd771b1">IReader</a>.</p> </div> </div> <a id="a2b5d8637ef753d1c7be18b7569be2252"></a> <h2 class="memtitle"><span class="permalink"><a href="#a2b5d8637ef753d1c7be18b7569be2252">◆ </a></span>isSeekable()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual bool MutableReader::isSeekable </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Tells whether the source provides seeking functionality or not. </p> <dl class="section warning"><dt>Warning</dt><dd>This doesn't mean that the seeking always has to succeed. </dd></dl> <dl class="section return"><dt>Returns</dt><dd>Always returns true for readers of buffering types. </dd></dl> <p>Implements <a class="el" href="classIReader.html#acf13bbdc14e680c21122981f7d3bf6be">IReader</a>.</p> </div> </div> <a id="a43a0c05317ee33b40a6718c075c2ab4d"></a> <h2 class="memtitle"><span class="permalink"><a href="#a43a0c05317ee33b40a6718c075c2ab4d">◆ </a></span>read()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual void MutableReader::read </td> <td>(</td> <td class="paramtype">int & </td> <td class="paramname"><em>length</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool & </td> <td class="paramname"><em>eos</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="Audaspace_8h.html#aa0798f7ea0975b143a1d9deac8c05d43">sample_t</a> * </td> <td class="paramname"><em>buffer</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Request to read the next length samples out of the source. </p> <p>The buffer supplied has the needed size. </p><dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in,out]</td><td class="paramname">length</td><td>The count of samples that should be read. Shall contain the real count of samples after reading, in case there were only fewer samples available. A smaller value also indicates the end of the reader. </td></tr> <tr><td class="paramdir">[out]</td><td class="paramname">eos</td><td>End of stream, whether the end is reached or not. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>The pointer to the buffer to read into. </td></tr> </table> </dd> </dl> <p>Implements <a class="el" href="classIReader.html#aef6fa21dfb71d3065fb14517bf0f24d5">IReader</a>.</p> </div> </div> <a id="a6121a911a2601592871c20ca6e246a33"></a> <h2 class="memtitle"><span class="permalink"><a href="#a6121a911a2601592871c20ca6e246a33">◆ </a></span>seek()</h2> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual void MutableReader::seek </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"><em>position</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Seeks to a specific position in the source. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">position</td><td>The position to seek for measured in samples. To get from a given time to the samples you simply have to multiply the time value in seconds with the sample rate of the reader. </td></tr> </table> </dd> </dl> <dl class="section warning"><dt>Warning</dt><dd>This may work or not, depending on the actual reader. </dd></dl> <p>Implements <a class="el" href="classIReader.html#ad9fc74bb6f4c2b1ecc0f75b7118c1458">IReader</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>fx/<a class="el" href="MutableReader_8h_source.html">MutableReader.h</a></li> </ul> </div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.15 </small></address> </body> </html>