classaflibmemcache.html

来自「一个共享源码的音频库5(doc 文档)」· HTML 代码 · 共 402 行 · 第 1/2 页

HTML
402
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>aflibMemCache class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.15 --><center><a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center><hr><h1>aflibMemCache  Class Reference</h1>Base class that implements audio data caching. <a href="#_details">More...</a><p><code>#include &lt;<a class="el" href="aflibMemCache_8h-source.html">aflibMemCache.h</a>&gt;</code><p><p>Inheritance diagram for aflibMemCache:<p><center><img src="classaflibMemCache.png" usemap="#aflibMemCache_map" border="0"></center><map name="aflibMemCache_map"><area href="classaflibAudio.html" alt="aflibAudio" shape="rect" coords="0,56,154,80"><area href="classaflibAudioBWFilter.html" alt="aflibAudioBWFilter" shape="rect" coords="164,112,318,136"><area href="classaflibAudioConstantSrc.html" alt="aflibAudioConstantSrc" shape="rect" coords="164,168,318,192"><area href="classaflibAudioEdit.html" alt="aflibAudioEdit" shape="rect" coords="164,224,318,248"><area href="classaflibAudioFile.html" alt="aflibAudioFile" shape="rect" coords="164,280,318,304"><area href="classaflibAudioMemoryInput.html" alt="aflibAudioMemoryInput" shape="rect" coords="164,336,318,360"><area href="classaflibAudioMixer.html" alt="aflibAudioMixer" shape="rect" coords="164,392,318,416"><area href="classaflibAudioRecorder.html" alt="aflibAudioRecorder" shape="rect" coords="164,448,318,472"><area href="classaflibAudioSampleRateCvt.html" alt="aflibAudioSampleRateCvt" shape="rect" coords="164,504,318,528"><area href="classaflibAudioSpectrum.html" alt="aflibAudioSpectrum" shape="rect" coords="164,560,318,584"></map><a href="classaflibMemCache-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Public Methods</h2></td></tr><tr><td nowrap align=right valign=top>&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a0">aflibMemCache</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Constructor.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>virtual&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a1">~aflibMemCache</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Destructor.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>bool&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a2">getCacheEnable</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Returns the current state of caching for this object.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a3">setCacheEnable</a> (bool enable)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Set the state of caching for this object.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>long long&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a4">getCacheMax</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Returns the maximum allowed size of the cache.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>long long&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a5">getCacheTotal</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Gets the total size of all caches added together.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>long long&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a6">getCacheLocal</a> () const</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Gets the current size of the cache for this object only.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#a7">clearCache</a> ()</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Empties the cache for this object only.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Protected Methods</h2></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#b0">lookupData</a> (long long &amp;position, int &amp;num_samples)</td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="classaflibMemCache.html#b1">fillDataFromCache</a> (<a class="el" href="classaflibData.html">aflibData</a> &amp;data, long long &amp;position, int &amp;num_samples, long long orig_position, int orig_num_samples)</td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>Base class that implements audio data caching.<p>The purpose of this class is to provide a memory caching mechanism to those classes who whould benefit from this. It will store audio data into a buffer that it controls so that when audio data is reread for what ever purpose it will come from this cache instead of from the original source. This is beneficial for three reasons.  1) Some sources may not support backing up for old data. For instance an http stream comming over an internet connection. Some derived <a class="el" href="classaflibAudio.html">aflibAudio</a> objects need to back up over old data. For instance the sample rate converter class. It needs to operate on an old history of the data for best results. In order to save the complexity from each derived class we will implement caching here.  2) Reading audio data can be expensive from some sources. Reading from a disk can be slow and audio data from mp3s requires decoding. This will provide the capability to not have to reread again from the original source.  3) Some audio sources do not support random access. We can provide a limited random access capability for these sources by caching the audio data from the start of the file. Of course there are limitations with this.<p>Most derived classes by default have caching disabled. To enable or disable caching one would call setCacheEnable. The environment variable AFLIB_CACHE_SIZE can be set to set the maximum amount of cache to use. The default is 1MB. <p><hr><h2>Constructor &amp; Destructor Documentation</h2><a name="a0" doxytag="aflibMemCache::aflibMemCache"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> aflibMemCache::aflibMemCache </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Constructor.<p>    </td>  </tr></table><a name="a1" doxytag="aflibMemCache::~aflibMemCache"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> aflibMemCache::~aflibMemCache </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap><code> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Destructor.<p>    </td>  </tr></table><hr><h2>Member Function Documentation</h2><a name="a7" doxytag="aflibMemCache::clearCache"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void aflibMemCache::clearCache </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Empties the cache for this object only.<p>    </td>  </tr></table><a name="b1" doxytag="aflibMemCache::fillDataFromCache"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top"> void aflibMemCache::fillDataFromCache </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="classaflibData.html">aflibData</a> &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>data</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>long long &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>position</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int &amp;&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>num_samples</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>long long&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>orig_position</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>int&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>orig_num_samples</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"><code> [protected]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?