view code-docs/FixedTempoEstimator_8cpp_source.html @ 3:5c2683745b33 vamp-plugin-sdk-v2.4

Update for 2.4
author Chris Cannam
date Fri, 13 Jul 2012 13:30:27 +0100
parents 3c430ef1ed66
children 27319718b1f8
line wrap: on
line source
<!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>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>VampPluginSDK: FixedTempoEstimator.cpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">VampPluginSDK
   &#160;<span id="projectnumber">2.4</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('FixedTempoEstimator_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">FixedTempoEstimator.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="FixedTempoEstimator_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="comment">/*</span>
<a name="l00004"></a>00004 <span class="comment">    Vamp</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment">    An API for audio analysis and feature extraction plugins.</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">    Centre for Digital Music, Queen Mary, University of London.</span>
<a name="l00009"></a>00009 <span class="comment">    Copyright 2006-2009 Chris Cannam and QMUL.</span>
<a name="l00010"></a>00010 <span class="comment">  </span>
<a name="l00011"></a>00011 <span class="comment">    Permission is hereby granted, free of charge, to any person</span>
<a name="l00012"></a>00012 <span class="comment">    obtaining a copy of this software and associated documentation</span>
<a name="l00013"></a>00013 <span class="comment">    files (the &quot;Software&quot;), to deal in the Software without</span>
<a name="l00014"></a>00014 <span class="comment">    restriction, including without limitation the rights to use, copy,</span>
<a name="l00015"></a>00015 <span class="comment">    modify, merge, publish, distribute, sublicense, and/or sell copies</span>
<a name="l00016"></a>00016 <span class="comment">    of the Software, and to permit persons to whom the Software is</span>
<a name="l00017"></a>00017 <span class="comment">    furnished to do so, subject to the following conditions:</span>
<a name="l00018"></a>00018 <span class="comment"></span>
<a name="l00019"></a>00019 <span class="comment">    The above copyright notice and this permission notice shall be</span>
<a name="l00020"></a>00020 <span class="comment">    included in all copies or substantial portions of the Software.</span>
<a name="l00021"></a>00021 <span class="comment"></span>
<a name="l00022"></a>00022 <span class="comment">    THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,</span>
<a name="l00023"></a>00023 <span class="comment">    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
<a name="l00024"></a>00024 <span class="comment">    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
<a name="l00025"></a>00025 <span class="comment">    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR</span>
<a name="l00026"></a>00026 <span class="comment">    ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF</span>
<a name="l00027"></a>00027 <span class="comment">    CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION</span>
<a name="l00028"></a>00028 <span class="comment">    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span>
<a name="l00029"></a>00029 <span class="comment"></span>
<a name="l00030"></a>00030 <span class="comment">    Except as contained in this notice, the names of the Centre for</span>
<a name="l00031"></a>00031 <span class="comment">    Digital Music; Queen Mary, University of London; and Chris Cannam</span>
<a name="l00032"></a>00032 <span class="comment">    shall not be used in advertising or otherwise to promote the sale,</span>
<a name="l00033"></a>00033 <span class="comment">    use or other dealings in this Software without prior written</span>
<a name="l00034"></a>00034 <span class="comment">    authorization.</span>
<a name="l00035"></a>00035 <span class="comment">*/</span>
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="preprocessor">#include &quot;<a class="code" href="FixedTempoEstimator_8h.html">FixedTempoEstimator.h</a>&quot;</span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 <span class="keyword">using</span> std::string;
<a name="l00040"></a>00040 <span class="keyword">using</span> std::vector;
<a name="l00041"></a>00041 <span class="keyword">using</span> std::cerr;
<a name="l00042"></a>00042 <span class="keyword">using</span> std::endl;
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 <span class="keyword">using</span> <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...">Vamp::RealTime</a>;
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="preprocessor">#include &lt;cmath&gt;</span>
<a name="l00047"></a>00047 <span class="preprocessor">#include &lt;cstdio&gt;</span>
<a name="l00048"></a>00048 
<a name="l00049"></a>00049 
<a name="l00050"></a><a class="code" href="classFixedTempoEstimator_1_1D.html">00050</a> <span class="keyword">class </span><a class="code" href="classFixedTempoEstimator_1_1D.html">FixedTempoEstimator::D</a>
<a name="l00051"></a>00051 <span class="comment">// this class just avoids us having to declare any data members in the header</span>
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053 <span class="keyword">public</span>:
<a name="l00054"></a>00054     <a class="code" href="classFixedTempoEstimator_1_1D.html#a104a9b64d47eca678844584f69ca0b9d">D</a>(<span class="keywordtype">float</span> inputSampleRate);
<a name="l00055"></a>00055     <a class="code" href="classFixedTempoEstimator_1_1D.html#a78a63ac8bbf342cb0405747871adf4cc">~D</a>();
<a name="l00056"></a>00056 
<a name="l00057"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#add749be18355ab1ae5c1ccbacfd2e192">00057</a>     <span class="keywordtype">size_t</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#add749be18355ab1ae5c1ccbacfd2e192">getPreferredStepSize</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 64; }
<a name="l00058"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#ac02826f981736fc2aa5d835fa14e174d">00058</a>     <span class="keywordtype">size_t</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#ac02826f981736fc2aa5d835fa14e174d">getPreferredBlockSize</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> 256; }
<a name="l00059"></a>00059 
<a name="l00060"></a>00060     <a class="code" href="classVamp_1_1PluginBase.html#a3b6bb4bbd86affe1ca9deceea1aad4f8">ParameterList</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a06fcf80a9a22c4b90abbc88eb592621a">getParameterDescriptors</a>() <span class="keyword">const</span>;
<a name="l00061"></a>00061     <span class="keywordtype">float</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a968ef2e555c81e4a3bde89d19fafb31a">getParameter</a>(<span class="keywordtype">string</span> <span class="keywordtype">id</span>) <span class="keyword">const</span>;
<a name="l00062"></a>00062     <span class="keywordtype">void</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a6cafa64d4cc8aa3556bc0ce6b0c49bc4">setParameter</a>(<span class="keywordtype">string</span> <span class="keywordtype">id</span>, <span class="keywordtype">float</span> value);
<a name="l00063"></a>00063 
<a name="l00064"></a>00064     <a class="code" href="classVamp_1_1Plugin.html#a30f531b8fb69fac41a24e3d2a6a08ed9">OutputList</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a7ce98af800f36045a0dae4b1dbed943f">getOutputDescriptors</a>() <span class="keyword">const</span>;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066     <span class="keywordtype">bool</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#af0fcad4493650728babb7e341963c91d">initialise</a>(<span class="keywordtype">size_t</span> channels, <span class="keywordtype">size_t</span> stepSize, <span class="keywordtype">size_t</span> blockSize);
<a name="l00067"></a>00067     <span class="keywordtype">void</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#af5ac8147bfe79371d00aba8a19c2f8fd">reset</a>();
<a name="l00068"></a>00068     <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a7fac74fc9fc54f436408705d1e125e20">process</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> *<span class="keyword">const</span> *, <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...">RealTime</a>);
<a name="l00069"></a>00069     <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a7f9c3603bb3374d6936885010dbdd82b">getRemainingFeatures</a>();
<a name="l00070"></a>00070 
<a name="l00071"></a>00071 <span class="keyword">private</span>:
<a name="l00072"></a>00072     <span class="keywordtype">void</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a4f2cbc11fba5bc8af3fd2a0078156091">calculate</a>();
<a name="l00073"></a>00073     <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a20389ba1515f6ce4181d3f41e5c4f347">assembleFeatures</a>();
<a name="l00074"></a>00074 
<a name="l00075"></a>00075     <span class="keywordtype">float</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a0a7cb0705938097ab23a6f9187e6bae5">lag2tempo</a>(<span class="keywordtype">int</span>);
<a name="l00076"></a>00076     <span class="keywordtype">int</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#ac6a75212293fc855de6ed0c6581a0fb9">tempo2lag</a>(<span class="keywordtype">float</span>);
<a name="l00077"></a>00077 
<a name="l00078"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a072a0fc30b3912a54858eefdd47f4d4f">00078</a>     <span class="keywordtype">float</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a072a0fc30b3912a54858eefdd47f4d4f">m_inputSampleRate</a>;
<a name="l00079"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a837da9722c63fe3c66c738255990c45f">00079</a>     <span class="keywordtype">size_t</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a837da9722c63fe3c66c738255990c45f">m_stepSize</a>;
<a name="l00080"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a0b9bf37e600f0564b9f305f73a9517c8">00080</a>     <span class="keywordtype">size_t</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a0b9bf37e600f0564b9f305f73a9517c8">m_blockSize</a>;
<a name="l00081"></a>00081 
<a name="l00082"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a768fdbb62e4b21a39897963fdbd486ed">00082</a>     <span class="keywordtype">float</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a768fdbb62e4b21a39897963fdbd486ed">m_minbpm</a>;
<a name="l00083"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a33e8d045b222addc6173b50df2553ba8">00083</a>     <span class="keywordtype">float</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#a33e8d045b222addc6173b50df2553ba8">m_maxbpm</a>;
<a name="l00084"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#aca506973452865d436e07462eabdebad">00084</a>     <span class="keywordtype">float</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#aca506973452865d436e07462eabdebad">m_maxdflen</a>;
<a name="l00085"></a>00085 
<a name="l00086"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#aa59cf1cb5640a910c70884579e5d99ad">00086</a>     <span class="keywordtype">float</span> *<a class="code" href="classFixedTempoEstimator_1_1D.html#aa59cf1cb5640a910c70884579e5d99ad">m_priorMagnitudes</a>;
<a name="l00087"></a>00087 
<a name="l00088"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#ae739e006f2d10ef2b13677770b23e663">00088</a>     <span class="keywordtype">size_t</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#ae739e006f2d10ef2b13677770b23e663">m_dfsize</a>;
<a name="l00089"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a8e2312120e87ad9a48fedeebbaefa396">00089</a>     <span class="keywordtype">float</span> *<a class="code" href="classFixedTempoEstimator_1_1D.html#a8e2312120e87ad9a48fedeebbaefa396">m_df</a>;
<a name="l00090"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a7a8c8658ecfeec98962078df89fcd538">00090</a>     <span class="keywordtype">float</span> *<a class="code" href="classFixedTempoEstimator_1_1D.html#a7a8c8658ecfeec98962078df89fcd538">m_r</a>;
<a name="l00091"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#ab255006072672653e645fc315eea6167">00091</a>     <span class="keywordtype">float</span> *<a class="code" href="classFixedTempoEstimator_1_1D.html#ab255006072672653e645fc315eea6167">m_fr</a>;
<a name="l00092"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a698446aad2c0f737732a392fb86a612c">00092</a>     <span class="keywordtype">float</span> *<a class="code" href="classFixedTempoEstimator_1_1D.html#a698446aad2c0f737732a392fb86a612c">m_t</a>;
<a name="l00093"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#ab73af7f1943b76388de04cbb4696a983">00093</a>     <span class="keywordtype">size_t</span> <a class="code" href="classFixedTempoEstimator_1_1D.html#ab73af7f1943b76388de04cbb4696a983">m_n</a>;
<a name="l00094"></a>00094 
<a name="l00095"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a3a3a0b4a4c259087f02d0046241674d0">00095</a>     <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...">Vamp::RealTime</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a3a3a0b4a4c259087f02d0046241674d0">m_start</a>;
<a name="l00096"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#abacd5ff19c301020efb99c03136b849a">00096</a>     <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...">Vamp::RealTime</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#abacd5ff19c301020efb99c03136b849a">m_lasttime</a>;
<a name="l00097"></a>00097 };
<a name="l00098"></a>00098 
<a name="l00099"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a104a9b64d47eca678844584f69ca0b9d">00099</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a104a9b64d47eca678844584f69ca0b9d">FixedTempoEstimator::D::D</a>(<span class="keywordtype">float</span> inputSampleRate) :
<a name="l00100"></a>00100     m_inputSampleRate(inputSampleRate),
<a name="l00101"></a>00101     m_stepSize(0),
<a name="l00102"></a>00102     m_blockSize(0),
<a name="l00103"></a>00103     m_minbpm(50),
<a name="l00104"></a>00104     m_maxbpm(190),
<a name="l00105"></a>00105     m_maxdflen(10),
<a name="l00106"></a>00106     m_priorMagnitudes(0),
<a name="l00107"></a>00107     m_df(0),
<a name="l00108"></a>00108     m_r(0),
<a name="l00109"></a>00109     m_fr(0),
<a name="l00110"></a>00110     m_t(0),
<a name="l00111"></a>00111     m_n(0)
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113 }
<a name="l00114"></a>00114 
<a name="l00115"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a78a63ac8bbf342cb0405747871adf4cc">00115</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a78a63ac8bbf342cb0405747871adf4cc">FixedTempoEstimator::D::~D</a>()
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117     <span class="keyword">delete</span>[] m_priorMagnitudes;
<a name="l00118"></a>00118     <span class="keyword">delete</span>[] m_df;
<a name="l00119"></a>00119     <span class="keyword">delete</span>[] m_r;
<a name="l00120"></a>00120     <span class="keyword">delete</span>[] m_fr;
<a name="l00121"></a>00121     <span class="keyword">delete</span>[] m_t;
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123 
<a name="l00124"></a>00124 <a class="code" href="classVamp_1_1PluginBase.html#a3b6bb4bbd86affe1ca9deceea1aad4f8">FixedTempoEstimator::ParameterList</a>
<a name="l00125"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a06fcf80a9a22c4b90abbc88eb592621a">00125</a> <a class="code" href="classFixedTempoEstimator.html#ae157465a4e07d180bab05b5c3a4d8987" title="Get the controllable parameters of this plugin.">FixedTempoEstimator::D::getParameterDescriptors</a>()<span class="keyword"> const</span>
<a name="l00126"></a>00126 <span class="keyword"></span>{
<a name="l00127"></a>00127     <a class="code" href="classVamp_1_1PluginBase.html#a3b6bb4bbd86affe1ca9deceea1aad4f8">ParameterList</a> list;
<a name="l00128"></a>00128 
<a name="l00129"></a>00129     <a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html">ParameterDescriptor</a> d;
<a name="l00130"></a>00130     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a116fd9f0dc94c2bc4bbc60b5443c598c" title="The name of the parameter, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;minbpm&quot;</span>;
<a name="l00131"></a>00131     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a0ecebb94fb4ada4aad2640e20aa57084" title="The human-readable name of the parameter.">name</a> = <span class="stringliteral">&quot;Minimum estimated tempo&quot;</span>;
<a name="l00132"></a>00132     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a780ddad41e433d85c82f9ea4d959cbaf" title="A human-readable short text describing the parameter.">description</a> = <span class="stringliteral">&quot;Minimum beat-per-minute value which the tempo estimator is able to return&quot;</span>;
<a name="l00133"></a>00133     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a3bc3df322e4c02e17e96bc6d44982d7b" title="The unit of the parameter, in human-readable form.">unit</a> = <span class="stringliteral">&quot;bpm&quot;</span>;
<a name="l00134"></a>00134     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#ab3e4d84f5bc199eea8b642b27e425ec8" title="The minimum value of the parameter.">minValue</a> = 10;
<a name="l00135"></a>00135     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#ab934b20dd708228a0e3c2811a3e2cec4" title="The maximum value of the parameter.">maxValue</a> = 360;
<a name="l00136"></a>00136     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#aec4ef77451ec02193ecc4a0856673fbc" title="The default value of the parameter.">defaultValue</a> = 50;
<a name="l00137"></a>00137     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a7c556d58d552f737ee5a34efdf7f9425" title="True if the parameter values are quantized to a particular resolution.">isQuantized</a> = <span class="keyword">false</span>;
<a name="l00138"></a>00138     list.push_back(d);
<a name="l00139"></a>00139 
<a name="l00140"></a>00140     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a116fd9f0dc94c2bc4bbc60b5443c598c" title="The name of the parameter, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;maxbpm&quot;</span>;
<a name="l00141"></a>00141     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a0ecebb94fb4ada4aad2640e20aa57084" title="The human-readable name of the parameter.">name</a> = <span class="stringliteral">&quot;Maximum estimated tempo&quot;</span>;
<a name="l00142"></a>00142     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a780ddad41e433d85c82f9ea4d959cbaf" title="A human-readable short text describing the parameter.">description</a> = <span class="stringliteral">&quot;Maximum beat-per-minute value which the tempo estimator is able to return&quot;</span>;
<a name="l00143"></a>00143     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#aec4ef77451ec02193ecc4a0856673fbc" title="The default value of the parameter.">defaultValue</a> = 190;
<a name="l00144"></a>00144     list.push_back(d);
<a name="l00145"></a>00145 
<a name="l00146"></a>00146     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a116fd9f0dc94c2bc4bbc60b5443c598c" title="The name of the parameter, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;maxdflen&quot;</span>;
<a name="l00147"></a>00147     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a0ecebb94fb4ada4aad2640e20aa57084" title="The human-readable name of the parameter.">name</a> = <span class="stringliteral">&quot;Input duration to study&quot;</span>;
<a name="l00148"></a>00148     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a780ddad41e433d85c82f9ea4d959cbaf" title="A human-readable short text describing the parameter.">description</a> = <span class="stringliteral">&quot;Length of audio input, in seconds, which should be taken into account when estimating tempo.  There is no need to supply the plugin with any further input once this time has elapsed since the start of the audio.  The tempo estimator may use only the first part of this, up to eight times the slowest beat duration: increasing this value further than that is unlikely to improve results.&quot;</span>;
<a name="l00149"></a>00149     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#a3bc3df322e4c02e17e96bc6d44982d7b" title="The unit of the parameter, in human-readable form.">unit</a> = <span class="stringliteral">&quot;s&quot;</span>;
<a name="l00150"></a>00150     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#ab3e4d84f5bc199eea8b642b27e425ec8" title="The minimum value of the parameter.">minValue</a> = 2;
<a name="l00151"></a>00151     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#ab934b20dd708228a0e3c2811a3e2cec4" title="The maximum value of the parameter.">maxValue</a> = 40;
<a name="l00152"></a>00152     d.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#aec4ef77451ec02193ecc4a0856673fbc" title="The default value of the parameter.">defaultValue</a> = 10;
<a name="l00153"></a>00153     list.push_back(d);
<a name="l00154"></a>00154 
<a name="l00155"></a>00155     <span class="keywordflow">return</span> list;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 <span class="keywordtype">float</span>
<a name="l00159"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a968ef2e555c81e4a3bde89d19fafb31a">00159</a> <a class="code" href="classFixedTempoEstimator.html#a2030b05fb1228b30ace16200780c9152" title="Get the value of a named parameter.">FixedTempoEstimator::D::getParameter</a>(<span class="keywordtype">string</span> <span class="keywordtype">id</span>)<span class="keyword"> const</span>
<a name="l00160"></a>00160 <span class="keyword"></span>{
<a name="l00161"></a>00161     <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <span class="stringliteral">&quot;minbpm&quot;</span>) {
<a name="l00162"></a>00162         <span class="keywordflow">return</span> m_minbpm;
<a name="l00163"></a>00163     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <span class="stringliteral">&quot;maxbpm&quot;</span>) {
<a name="l00164"></a>00164         <span class="keywordflow">return</span> m_maxbpm;
<a name="l00165"></a>00165     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <span class="stringliteral">&quot;maxdflen&quot;</span>) {
<a name="l00166"></a>00166         <span class="keywordflow">return</span> m_maxdflen;
<a name="l00167"></a>00167     }
<a name="l00168"></a>00168     <span class="keywordflow">return</span> 0.f;
<a name="l00169"></a>00169 }
<a name="l00170"></a>00170 
<a name="l00171"></a>00171 <span class="keywordtype">void</span>
<a name="l00172"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a6cafa64d4cc8aa3556bc0ce6b0c49bc4">00172</a> <a class="code" href="classFixedTempoEstimator.html#a8a5a413025384cf451c64d2c2ce13a75" title="Set a named parameter.">FixedTempoEstimator::D::setParameter</a>(<span class="keywordtype">string</span> <span class="keywordtype">id</span>, <span class="keywordtype">float</span> value)
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174     <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <span class="stringliteral">&quot;minbpm&quot;</span>) {
<a name="l00175"></a>00175         m_minbpm = value;
<a name="l00176"></a>00176     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <span class="stringliteral">&quot;maxbpm&quot;</span>) {
<a name="l00177"></a>00177         m_maxbpm = value;
<a name="l00178"></a>00178     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">id</span> == <span class="stringliteral">&quot;maxdflen&quot;</span>) {
<a name="l00179"></a>00179         m_maxdflen = value;
<a name="l00180"></a>00180     }
<a name="l00181"></a>00181 }
<a name="l00182"></a>00182 
<a name="l00183"></a><a class="code" href="FixedTempoEstimator_8cpp.html#a7a8511e62dffb5334ad3b70d57b2fcee">00183</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="FixedTempoEstimator_8cpp.html#a7a8511e62dffb5334ad3b70d57b2fcee">TempoOutput</a> = 0;
<a name="l00184"></a><a class="code" href="FixedTempoEstimator_8cpp.html#a554b16c6b7516530e52c65318bfe08eb">00184</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="FixedTempoEstimator_8cpp.html#a554b16c6b7516530e52c65318bfe08eb">CandidatesOutput</a> = 1;
<a name="l00185"></a><a class="code" href="FixedTempoEstimator_8cpp.html#acaa4524f29afce03c812a88ff31159c1">00185</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="FixedTempoEstimator_8cpp.html#acaa4524f29afce03c812a88ff31159c1">DFOutput</a> = 2;
<a name="l00186"></a><a class="code" href="FixedTempoEstimator_8cpp.html#a382c1fe740ac8911c6078cfbceffc870">00186</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="FixedTempoEstimator_8cpp.html#a382c1fe740ac8911c6078cfbceffc870">ACFOutput</a> = 3;
<a name="l00187"></a><a class="code" href="FixedTempoEstimator_8cpp.html#a5b284021783d79785d46b043b458368d">00187</a> <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="FixedTempoEstimator_8cpp.html#a5b284021783d79785d46b043b458368d">FilteredACFOutput</a> = 4;
<a name="l00188"></a>00188 
<a name="l00189"></a>00189 <a class="code" href="classVamp_1_1Plugin.html#a30f531b8fb69fac41a24e3d2a6a08ed9">FixedTempoEstimator::OutputList</a>
<a name="l00190"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a7ce98af800f36045a0dae4b1dbed943f">00190</a> <a class="code" href="classFixedTempoEstimator.html#a83121c205a723fe6297e2bf8870622a4" title="Get the outputs of this plugin.">FixedTempoEstimator::D::getOutputDescriptors</a>()<span class="keyword"> const</span>
<a name="l00191"></a>00191 <span class="keyword"></span>{
<a name="l00192"></a>00192     <a class="code" href="classVamp_1_1Plugin.html#a30f531b8fb69fac41a24e3d2a6a08ed9">OutputList</a> list;
<a name="l00193"></a>00193 
<a name="l00194"></a>00194     <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html">OutputDescriptor</a> d;
<a name="l00195"></a>00195     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;tempo&quot;</span>;
<a name="l00196"></a>00196     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = <span class="stringliteral">&quot;Tempo&quot;</span>;
<a name="l00197"></a>00197     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">&quot;Estimated tempo&quot;</span>;
<a name="l00198"></a>00198     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#aa057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">&quot;bpm&quot;</span>;
<a name="l00199"></a>00199     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af0e577e1a256ff6eed6ea42133fec77d" title="True if the output has the same number of values per sample for every output sample.">hasFixedBinCount</a> = <span class="keyword">true</span>;
<a name="l00200"></a>00200     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#afdd006959a995e40ef7d565a3a4df6dc" title="The number of values per result of the output.">binCount</a> = 1;
<a name="l00201"></a>00201     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae9ccb65f99f477096b65dd031f4c5e31" title="True if the results in each output bin fall within a fixed numeric range (minimum and maximum values)...">hasKnownExtents</a> = <span class="keyword">false</span>;
<a name="l00202"></a>00202     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a1b4858928d23bfd7d5bc557c82a83fb4" title="True if the output values are quantized to a particular resolution.">isQuantized</a> = <span class="keyword">false</span>;
<a name="l00203"></a>00203     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a0d1194980d44e31b25ef3b4b070d6b5d" title="Positioning in time of the output results.">sampleType</a> = <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#abffa9ed50cd756df70fd51f0355f448cadea995a737867f7b22b52f1c43c5432e" title="Results are unevenly spaced and have individual timestamps.">OutputDescriptor::VariableSampleRate</a>;
<a name="l00204"></a>00204     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#add0cbbdfa9c91764037c39365b1d42af" title="Sample rate of the output results, as samples per second.">sampleRate</a> = <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>;
<a name="l00205"></a>00205     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab0d7cc6ab19e53b5bd12ee234f549ea3" title="True if the returned results for this output are known to have a duration field.">hasDuration</a> = <span class="keyword">true</span>; <span class="comment">// our returned tempo spans a certain range</span>
<a name="l00206"></a>00206     list.push_back(d);
<a name="l00207"></a>00207 
<a name="l00208"></a>00208     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;candidates&quot;</span>;
<a name="l00209"></a>00209     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = <span class="stringliteral">&quot;Tempo candidates&quot;</span>;
<a name="l00210"></a>00210     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">&quot;Possible tempo estimates, one per bin with the most likely in the first bin&quot;</span>;
<a name="l00211"></a>00211     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#aa057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">&quot;bpm&quot;</span>;
<a name="l00212"></a>00212     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af0e577e1a256ff6eed6ea42133fec77d" title="True if the output has the same number of values per sample for every output sample.">hasFixedBinCount</a> = <span class="keyword">false</span>;
<a name="l00213"></a>00213     list.push_back(d);
<a name="l00214"></a>00214 
<a name="l00215"></a>00215     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;detectionfunction&quot;</span>;
<a name="l00216"></a>00216     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = <span class="stringliteral">&quot;Detection Function&quot;</span>;
<a name="l00217"></a>00217     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">&quot;Onset detection function&quot;</span>;
<a name="l00218"></a>00218     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#aa057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00219"></a>00219     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af0e577e1a256ff6eed6ea42133fec77d" title="True if the output has the same number of values per sample for every output sample.">hasFixedBinCount</a> = 1;
<a name="l00220"></a>00220     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#afdd006959a995e40ef7d565a3a4df6dc" title="The number of values per result of the output.">binCount</a> = 1;
<a name="l00221"></a>00221     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae9ccb65f99f477096b65dd031f4c5e31" title="True if the results in each output bin fall within a fixed numeric range (minimum and maximum values)...">hasKnownExtents</a> = <span class="keyword">true</span>;
<a name="l00222"></a>00222     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ac9f5924c0be7571bba8e7ae7e7a921f4" title="Minimum value of the results in the output.">minValue</a> = 0.0;
<a name="l00223"></a>00223     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a907b4e8fbb48a46ac5a05f880d72719f" title="Maximum value of the results in the output.">maxValue</a> = 1.0;
<a name="l00224"></a>00224     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a1b4858928d23bfd7d5bc557c82a83fb4" title="True if the output values are quantized to a particular resolution.">isQuantized</a> = <span class="keyword">false</span>;
<a name="l00225"></a>00225     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a3bed37153067b625b95acb40b60dbf0b" title="Quantization resolution of the output values (e.g.">quantizeStep</a> = 0.0;
<a name="l00226"></a>00226     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a0d1194980d44e31b25ef3b4b070d6b5d" title="Positioning in time of the output results.">sampleType</a> = <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#abffa9ed50cd756df70fd51f0355f448ca4c74bd2fc96dfe2815623f94b40e5629" title="Results are evenly spaced in time (sampleRate specified below)">OutputDescriptor::FixedSampleRate</a>;
<a name="l00227"></a>00227     <span class="keywordflow">if</span> (m_stepSize) {
<a name="l00228"></a>00228         d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#add0cbbdfa9c91764037c39365b1d42af" title="Sample rate of the output results, as samples per second.">sampleRate</a> = <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a> / m_stepSize;
<a name="l00229"></a>00229     } <span class="keywordflow">else</span> {
<a name="l00230"></a>00230         d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#add0cbbdfa9c91764037c39365b1d42af" title="Sample rate of the output results, as samples per second.">sampleRate</a> = <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a> / (<a class="code" href="classFixedTempoEstimator.html#a68b8569b71504a0478caf990dbe30683" title="Get the preferred block size (window size -- the number of sample frames passed in each block to the ...">getPreferredBlockSize</a>()/2);
<a name="l00231"></a>00231     }
<a name="l00232"></a>00232     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab0d7cc6ab19e53b5bd12ee234f549ea3" title="True if the returned results for this output are known to have a duration field.">hasDuration</a> = <span class="keyword">false</span>;
<a name="l00233"></a>00233     list.push_back(d);
<a name="l00234"></a>00234 
<a name="l00235"></a>00235     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;acf&quot;</span>;
<a name="l00236"></a>00236     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = <span class="stringliteral">&quot;Autocorrelation Function&quot;</span>;
<a name="l00237"></a>00237     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">&quot;Autocorrelation of onset detection function&quot;</span>;
<a name="l00238"></a>00238     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae9ccb65f99f477096b65dd031f4c5e31" title="True if the results in each output bin fall within a fixed numeric range (minimum and maximum values)...">hasKnownExtents</a> = <span class="keyword">false</span>;
<a name="l00239"></a>00239     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#aa057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">&quot;r&quot;</span>;
<a name="l00240"></a>00240     list.push_back(d);
<a name="l00241"></a>00241 
<a name="l00242"></a>00242     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ae2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">&quot;filtered_acf&quot;</span>;
<a name="l00243"></a>00243     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#ab824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = <span class="stringliteral">&quot;Filtered Autocorrelation&quot;</span>;
<a name="l00244"></a>00244     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#af9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">&quot;Filtered autocorrelation of onset detection function&quot;</span>;
<a name="l00245"></a>00245     d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#aa057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">&quot;r&quot;</span>;
<a name="l00246"></a>00246     list.push_back(d);
<a name="l00247"></a>00247 
<a name="l00248"></a>00248     <span class="keywordflow">return</span> list;
<a name="l00249"></a>00249 }
<a name="l00250"></a>00250 
<a name="l00251"></a>00251 <span class="keywordtype">bool</span>
<a name="l00252"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#af0fcad4493650728babb7e341963c91d">00252</a> <a class="code" href="classFixedTempoEstimator.html#aa7500a4ffbc4653baaf5101defdb37f5" title="Initialise a plugin to prepare it for use with the given number of input channels, step size (window increment, in sample frames) and block size (window size, in sample frames).">FixedTempoEstimator::D::initialise</a>(<span class="keywordtype">size_t</span>, <span class="keywordtype">size_t</span> stepSize, <span class="keywordtype">size_t</span> blockSize)
<a name="l00253"></a>00253 {
<a name="l00254"></a>00254     m_stepSize = stepSize;
<a name="l00255"></a>00255     m_blockSize = blockSize;
<a name="l00256"></a>00256 
<a name="l00257"></a>00257     <span class="keywordtype">float</span> dfLengthSecs = m_maxdflen;
<a name="l00258"></a>00258     m_dfsize = (dfLengthSecs * <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>) / m_stepSize;
<a name="l00259"></a>00259 
<a name="l00260"></a>00260     m_priorMagnitudes = <span class="keyword">new</span> <span class="keywordtype">float</span>[m_blockSize/2];
<a name="l00261"></a>00261     m_df = <span class="keyword">new</span> <span class="keywordtype">float</span>[m_dfsize];
<a name="l00262"></a>00262 
<a name="l00263"></a>00263     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; m_blockSize/2; ++i) {
<a name="l00264"></a>00264         m_priorMagnitudes[i] = 0.f;
<a name="l00265"></a>00265     }
<a name="l00266"></a>00266     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; m_dfsize; ++i) {
<a name="l00267"></a>00267         m_df[i] = 0.f;
<a name="l00268"></a>00268     }
<a name="l00269"></a>00269 
<a name="l00270"></a>00270     m_n = 0;
<a name="l00271"></a>00271 
<a name="l00272"></a>00272     <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00273"></a>00273 }
<a name="l00274"></a>00274 
<a name="l00275"></a>00275 <span class="keywordtype">void</span>
<a name="l00276"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#af5ac8147bfe79371d00aba8a19c2f8fd">00276</a> <a class="code" href="classFixedTempoEstimator.html#ac41708397255400c6682fee6c1b3d45f" title="Reset the plugin after use, to prepare it for another clean run.">FixedTempoEstimator::D::reset</a>()
<a name="l00277"></a>00277 {
<a name="l00278"></a>00278     <span class="keywordflow">if</span> (!m_priorMagnitudes) <span class="keywordflow">return</span>;
<a name="l00279"></a>00279 
<a name="l00280"></a>00280     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; m_blockSize/2; ++i) {
<a name="l00281"></a>00281         m_priorMagnitudes[i] = 0.f;
<a name="l00282"></a>00282     }
<a name="l00283"></a>00283     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; m_dfsize; ++i) {
<a name="l00284"></a>00284         m_df[i] = 0.f;
<a name="l00285"></a>00285     }
<a name="l00286"></a>00286 
<a name="l00287"></a>00287     <span class="keyword">delete</span>[] m_r;
<a name="l00288"></a>00288     m_r = 0;
<a name="l00289"></a>00289 
<a name="l00290"></a>00290     <span class="keyword">delete</span>[] m_fr; 
<a name="l00291"></a>00291     m_fr = 0;
<a name="l00292"></a>00292 
<a name="l00293"></a>00293     <span class="keyword">delete</span>[] m_t; 
<a name="l00294"></a>00294     m_t = 0;
<a name="l00295"></a>00295 
<a name="l00296"></a>00296     m_n = 0;
<a name="l00297"></a>00297 
<a name="l00298"></a>00298     m_start = RealTime::zeroTime;
<a name="l00299"></a>00299     m_lasttime = RealTime::zeroTime;
<a name="l00300"></a>00300 }
<a name="l00301"></a>00301 
<a name="l00302"></a>00302 <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FixedTempoEstimator::FeatureSet</a>
<a name="l00303"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a7fac74fc9fc54f436408705d1e125e20">00303</a> <a class="code" href="classFixedTempoEstimator.html#a1cf76b0e55cf4ed3da095cffcdeaec3c" title="Process a single block of input data.">FixedTempoEstimator::D::process</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> *<span class="keyword">const</span> *inputBuffers, <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...">RealTime</a> ts)
<a name="l00304"></a>00304 {
<a name="l00305"></a>00305     <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> fs;
<a name="l00306"></a>00306 
<a name="l00307"></a>00307     <span class="keywordflow">if</span> (m_stepSize == 0) {
<a name="l00308"></a>00308         cerr &lt;&lt; <span class="stringliteral">&quot;ERROR: FixedTempoEstimator::process: &quot;</span>
<a name="l00309"></a>00309              &lt;&lt; <span class="stringliteral">&quot;FixedTempoEstimator has not been initialised&quot;</span>
<a name="l00310"></a>00310              &lt;&lt; endl;
<a name="l00311"></a>00311         <span class="keywordflow">return</span> fs;
<a name="l00312"></a>00312     }
<a name="l00313"></a>00313 
<a name="l00314"></a>00314     <span class="keywordflow">if</span> (m_n == 0) m_start = ts;
<a name="l00315"></a>00315     m_lasttime = ts;
<a name="l00316"></a>00316 
<a name="l00317"></a>00317     <span class="keywordflow">if</span> (m_n == m_dfsize) {
<a name="l00318"></a>00318         <span class="comment">// If we have seen enough input, do the estimation and return</span>
<a name="l00319"></a>00319         calculate();
<a name="l00320"></a>00320         fs = assembleFeatures();
<a name="l00321"></a>00321         ++m_n;
<a name="l00322"></a>00322         <span class="keywordflow">return</span> fs;
<a name="l00323"></a>00323     }
<a name="l00324"></a>00324 
<a name="l00325"></a>00325     <span class="comment">// If we have seen more than enough, just discard and return!</span>
<a name="l00326"></a>00326     <span class="keywordflow">if</span> (m_n &gt; m_dfsize) <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a>();
<a name="l00327"></a>00327 
<a name="l00328"></a>00328     <span class="keywordtype">float</span> value = 0.f;
<a name="l00329"></a>00329 
<a name="l00330"></a>00330     <span class="comment">// m_df will contain an onset detection function based on the rise</span>
<a name="l00331"></a>00331     <span class="comment">// in overall power from one spectral frame to the next --</span>
<a name="l00332"></a>00332     <span class="comment">// simplistic but reasonably effective for our purposes.</span>
<a name="l00333"></a>00333 
<a name="l00334"></a>00334     <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 1; i &lt; m_blockSize/2; ++i) {
<a name="l00335"></a>00335 
<a name="l00336"></a>00336         <span class="keywordtype">float</span> real = inputBuffers[0][i*2];
<a name="l00337"></a>00337         <span class="keywordtype">float</span> imag = inputBuffers[0][i*2 + 1];
<a name="l00338"></a>00338 
<a name="l00339"></a>00339         <span class="keywordtype">float</span> sqrmag = real * real + imag * imag;
<a name="l00340"></a>00340         value += fabsf(sqrmag - m_priorMagnitudes[i]);
<a name="l00341"></a>00341 
<a name="l00342"></a>00342         m_priorMagnitudes[i] = sqrmag;
<a name="l00343"></a>00343     }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345     m_df[m_n] = value;
<a name="l00346"></a>00346 
<a name="l00347"></a>00347     ++m_n;
<a name="l00348"></a>00348     <span class="keywordflow">return</span> fs;
<a name="l00349"></a>00349 }    
<a name="l00350"></a>00350 
<a name="l00351"></a>00351 <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FixedTempoEstimator::FeatureSet</a>
<a name="l00352"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a7f9c3603bb3374d6936885010dbdd82b">00352</a> <a class="code" href="classFixedTempoEstimator.html#a4965cf99be77fc4d1de51e11d83936b0" title="After all blocks have been processed, calculate and return any remaining features derived from the co...">FixedTempoEstimator::D::getRemainingFeatures</a>()
<a name="l00353"></a>00353 {
<a name="l00354"></a>00354     <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> fs;
<a name="l00355"></a>00355     <span class="keywordflow">if</span> (m_n &gt; m_dfsize) <span class="keywordflow">return</span> fs;
<a name="l00356"></a>00356     calculate();
<a name="l00357"></a>00357     fs = assembleFeatures();
<a name="l00358"></a>00358     ++m_n;
<a name="l00359"></a>00359     <span class="keywordflow">return</span> fs;
<a name="l00360"></a>00360 }
<a name="l00361"></a>00361 
<a name="l00362"></a>00362 <span class="keywordtype">float</span>
<a name="l00363"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a0a7cb0705938097ab23a6f9187e6bae5">00363</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a0a7cb0705938097ab23a6f9187e6bae5">FixedTempoEstimator::D::lag2tempo</a>(<span class="keywordtype">int</span> lag)
<a name="l00364"></a>00364 {
<a name="l00365"></a>00365     <span class="keywordflow">return</span> 60.f / ((lag * m_stepSize) / <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>);
<a name="l00366"></a>00366 }
<a name="l00367"></a>00367 
<a name="l00368"></a>00368 <span class="keywordtype">int</span>
<a name="l00369"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#ac6a75212293fc855de6ed0c6581a0fb9">00369</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#ac6a75212293fc855de6ed0c6581a0fb9">FixedTempoEstimator::D::tempo2lag</a>(<span class="keywordtype">float</span> tempo)
<a name="l00370"></a>00370 {
<a name="l00371"></a>00371     <span class="keywordflow">return</span> ((60.f / tempo) * <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>) / m_stepSize;
<a name="l00372"></a>00372 }
<a name="l00373"></a>00373 
<a name="l00374"></a>00374 <span class="keywordtype">void</span>
<a name="l00375"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a4f2cbc11fba5bc8af3fd2a0078156091">00375</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a4f2cbc11fba5bc8af3fd2a0078156091">FixedTempoEstimator::D::calculate</a>()
<a name="l00376"></a>00376 {    
<a name="l00377"></a>00377     <span class="keywordflow">if</span> (m_r) {
<a name="l00378"></a>00378         cerr &lt;&lt; <span class="stringliteral">&quot;FixedTempoEstimator::calculate: calculation already happened?&quot;</span> &lt;&lt; endl;
<a name="l00379"></a>00379         <span class="keywordflow">return</span>;
<a name="l00380"></a>00380     }
<a name="l00381"></a>00381 
<a name="l00382"></a>00382     <span class="keywordflow">if</span> (m_n &lt; m_dfsize / 9 &amp;&amp;
<a name="l00383"></a>00383         m_n &lt; (1.0 * <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>) / m_stepSize) { <span class="comment">// 1 second</span>
<a name="l00384"></a>00384         cerr &lt;&lt; <span class="stringliteral">&quot;FixedTempoEstimator::calculate: Input is too short&quot;</span> &lt;&lt; endl;
<a name="l00385"></a>00385         <span class="keywordflow">return</span>;
<a name="l00386"></a>00386     }
<a name="l00387"></a>00387 
<a name="l00388"></a>00388     <span class="comment">// This function takes m_df (the detection function array filled</span>
<a name="l00389"></a>00389     <span class="comment">// out in process()) and calculates m_r (the raw autocorrelation)</span>
<a name="l00390"></a>00390     <span class="comment">// and m_fr (the filtered autocorrelation from whose peaks tempo</span>
<a name="l00391"></a>00391     <span class="comment">// estimates will be taken).</span>
<a name="l00392"></a>00392 
<a name="l00393"></a>00393     <span class="keywordtype">int</span> n = m_n; <span class="comment">// length of actual df array (m_dfsize is the theoretical max)</span>
<a name="l00394"></a>00394 
<a name="l00395"></a>00395     m_r  = <span class="keyword">new</span> <span class="keywordtype">float</span>[n/2]; <span class="comment">// raw autocorrelation</span>
<a name="l00396"></a>00396     m_fr = <span class="keyword">new</span> <span class="keywordtype">float</span>[n/2]; <span class="comment">// filtered autocorrelation</span>
<a name="l00397"></a>00397     m_t  = <span class="keyword">new</span> <span class="keywordtype">float</span>[n/2]; <span class="comment">// averaged tempo estimate for each lag value</span>
<a name="l00398"></a>00398 
<a name="l00399"></a>00399     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; n/2; ++i) {
<a name="l00400"></a>00400         m_r[i]  = 0.f;
<a name="l00401"></a>00401         m_fr[i] = 0.f;
<a name="l00402"></a>00402         m_t[i]  = lag2tempo(i);
<a name="l00403"></a>00403     }
<a name="l00404"></a>00404 
<a name="l00405"></a>00405     <span class="comment">// Calculate the raw autocorrelation of the detection function</span>
<a name="l00406"></a>00406 
<a name="l00407"></a>00407     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; n/2; ++i) {
<a name="l00408"></a>00408 
<a name="l00409"></a>00409         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = i; j &lt; n; ++j) {
<a name="l00410"></a>00410             m_r[i] += m_df[j] * m_df[j - i];
<a name="l00411"></a>00411         }
<a name="l00412"></a>00412 
<a name="l00413"></a>00413         m_r[i] /= n - i - 1;
<a name="l00414"></a>00414     }
<a name="l00415"></a>00415 
<a name="l00416"></a>00416     <span class="comment">// Filter the autocorrelation and average out the tempo estimates</span>
<a name="l00417"></a>00417     
<a name="l00418"></a>00418     <span class="keywordtype">float</span> related[] = { 0.5, 2, 4, 8 };
<a name="l00419"></a>00419 
<a name="l00420"></a>00420     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i &lt; n/2-1; ++i) {
<a name="l00421"></a>00421 
<a name="l00422"></a>00422         m_fr[i] = m_r[i];
<a name="l00423"></a>00423 
<a name="l00424"></a>00424         <span class="keywordtype">int</span> div = 1;
<a name="l00425"></a>00425 
<a name="l00426"></a>00426         <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; int(<span class="keyword">sizeof</span>(related)/<span class="keyword">sizeof</span>(related[0])); ++j) {
<a name="l00427"></a>00427 
<a name="l00428"></a>00428             <span class="comment">// Check for an obvious peak at each metrically related lag</span>
<a name="l00429"></a>00429 
<a name="l00430"></a>00430             <span class="keywordtype">int</span> k0 = int(i * related[j] + 0.5);
<a name="l00431"></a>00431 
<a name="l00432"></a>00432             <span class="keywordflow">if</span> (k0 &gt;= 0 &amp;&amp; k0 &lt; <span class="keywordtype">int</span>(n/2)) {
<a name="l00433"></a>00433 
<a name="l00434"></a>00434                 <span class="keywordtype">int</span> kmax = 0, kmin = 0;
<a name="l00435"></a>00435                 <span class="keywordtype">float</span> kvmax = 0, kvmin = 0;
<a name="l00436"></a>00436                 <span class="keywordtype">bool</span> have = <span class="keyword">false</span>;
<a name="l00437"></a>00437 
<a name="l00438"></a>00438                 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> k = k0 - 1; k &lt;= k0 + 1; ++k) {
<a name="l00439"></a>00439 
<a name="l00440"></a>00440                     <span class="keywordflow">if</span> (k &lt; 0 || k &gt;= n/2) <span class="keywordflow">continue</span>;
<a name="l00441"></a>00441 
<a name="l00442"></a>00442                     <span class="keywordflow">if</span> (!have || (m_r[k] &gt; kvmax)) { kmax = k; kvmax = m_r[k]; }
<a name="l00443"></a>00443                     <span class="keywordflow">if</span> (!have || (m_r[k] &lt; kvmin)) { kmin = k; kvmin = m_r[k]; }
<a name="l00444"></a>00444                     
<a name="l00445"></a>00445                     have = <span class="keyword">true</span>;
<a name="l00446"></a>00446                 }
<a name="l00447"></a>00447                 
<a name="l00448"></a>00448                 <span class="comment">// Boost the original lag according to the strongest</span>
<a name="l00449"></a>00449                 <span class="comment">// value found close to this related lag</span>
<a name="l00450"></a>00450 
<a name="l00451"></a>00451                 m_fr[i] += m_r[kmax] / 5;
<a name="l00452"></a>00452 
<a name="l00453"></a>00453                 <span class="keywordflow">if</span> ((kmax == 0 || m_r[kmax] &gt; m_r[kmax-1]) &amp;&amp;
<a name="l00454"></a>00454                     (kmax == n/2-1 || m_r[kmax] &gt; m_r[kmax+1]) &amp;&amp;
<a name="l00455"></a>00455                     kvmax &gt; kvmin * 1.05) {
<a name="l00456"></a>00456 
<a name="l00457"></a>00457                     <span class="comment">// The strongest value close to the related lag is</span>
<a name="l00458"></a>00458                     <span class="comment">// also a pretty good looking peak, so use it to</span>
<a name="l00459"></a>00459                     <span class="comment">// improve our tempo estimate for the original lag</span>
<a name="l00460"></a>00460                     
<a name="l00461"></a>00461                     m_t[i] = m_t[i] + lag2tempo(kmax) * related[j];
<a name="l00462"></a>00462                     ++div;
<a name="l00463"></a>00463                 }
<a name="l00464"></a>00464             }
<a name="l00465"></a>00465         }
<a name="l00466"></a>00466         
<a name="l00467"></a>00467         m_t[i] /= div;
<a name="l00468"></a>00468         
<a name="l00469"></a>00469         <span class="comment">// Finally apply a primitive perceptual weighting (to prefer</span>
<a name="l00470"></a>00470         <span class="comment">// tempi of around 120-130)</span>
<a name="l00471"></a>00471 
<a name="l00472"></a>00472         <span class="keywordtype">float</span> weight = 1.f - fabsf(128.f - lag2tempo(i)) * 0.005;
<a name="l00473"></a>00473         <span class="keywordflow">if</span> (weight &lt; 0.f) weight = 0.f;
<a name="l00474"></a>00474         weight = weight * weight * weight;
<a name="l00475"></a>00475 
<a name="l00476"></a>00476         m_fr[i] += m_fr[i] * (weight / 3);
<a name="l00477"></a>00477     }
<a name="l00478"></a>00478 }
<a name="l00479"></a>00479     
<a name="l00480"></a>00480 <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FixedTempoEstimator::FeatureSet</a>
<a name="l00481"></a><a class="code" href="classFixedTempoEstimator_1_1D.html#a20389ba1515f6ce4181d3f41e5c4f347">00481</a> <a class="code" href="classFixedTempoEstimator_1_1D.html#a20389ba1515f6ce4181d3f41e5c4f347">FixedTempoEstimator::D::assembleFeatures</a>()
<a name="l00482"></a>00482 {
<a name="l00483"></a>00483     <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> fs;
<a name="l00484"></a>00484     <span class="keywordflow">if</span> (!m_r) <span class="keywordflow">return</span> fs; <span class="comment">// No autocorrelation: no results</span>
<a name="l00485"></a>00485 
<a name="l00486"></a>00486     <a class="code" href="structVamp_1_1Plugin_1_1Feature.html">Feature</a> feature;
<a name="l00487"></a>00487     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a98907091d0b6a589720ae35ae588a82b" title="True if an output feature has its own timestamp.">hasTimestamp</a> = <span class="keyword">true</span>;
<a name="l00488"></a>00488     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a33686757bd4481c72494122e9bfb9fba" title="True if an output feature has a specified duration.">hasDuration</a> = <span class="keyword">false</span>;
<a name="l00489"></a>00489     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00490"></a>00490     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.clear();
<a name="l00491"></a>00491     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.push_back(0.f);
<a name="l00492"></a>00492 
<a name="l00493"></a>00493     <span class="keywordtype">char</span> buffer[40];
<a name="l00494"></a>00494 
<a name="l00495"></a>00495     <span class="keywordtype">int</span> n = m_n;
<a name="l00496"></a>00496 
<a name="l00497"></a>00497     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; n; ++i) {
<a name="l00498"></a>00498 
<a name="l00499"></a>00499         <span class="comment">// Return the detection function in the DF output</span>
<a name="l00500"></a>00500 
<a name="l00501"></a>00501         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#acaa605f36839c07e76f4882f5e22d8d7" title="Timestamp of the output feature.">timestamp</a> = m_start +
<a name="l00502"></a>00502             RealTime::frame2RealTime(i * m_stepSize, <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>);
<a name="l00503"></a>00503         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>[0] = m_df[i];
<a name="l00504"></a>00504         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00505"></a>00505         fs[<a class="code" href="FixedTempoEstimator_8cpp.html#acaa4524f29afce03c812a88ff31159c1">DFOutput</a>].push_back(feature);
<a name="l00506"></a>00506     }
<a name="l00507"></a>00507 
<a name="l00508"></a>00508     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i &lt; n/2; ++i) {
<a name="l00509"></a>00509 
<a name="l00510"></a>00510         <span class="comment">// Return the raw autocorrelation in the ACF output, each</span>
<a name="l00511"></a>00511         <span class="comment">// value labelled according to its corresponding tempo</span>
<a name="l00512"></a>00512 
<a name="l00513"></a>00513         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#acaa605f36839c07e76f4882f5e22d8d7" title="Timestamp of the output feature.">timestamp</a> = m_start +
<a name="l00514"></a>00514             RealTime::frame2RealTime(i * m_stepSize, <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>);
<a name="l00515"></a>00515         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>[0] = m_r[i];
<a name="l00516"></a>00516         sprintf(buffer, <span class="stringliteral">&quot;%.1f bpm&quot;</span>, lag2tempo(i));
<a name="l00517"></a>00517         <span class="keywordflow">if</span> (i == n/2-1) feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00518"></a>00518         <span class="keywordflow">else</span> feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = buffer;
<a name="l00519"></a>00519         fs[<a class="code" href="FixedTempoEstimator_8cpp.html#a382c1fe740ac8911c6078cfbceffc870">ACFOutput</a>].push_back(feature);
<a name="l00520"></a>00520     }
<a name="l00521"></a>00521 
<a name="l00522"></a>00522     <span class="keywordtype">float</span> t0 = m_minbpm; <span class="comment">// our minimum detected tempo</span>
<a name="l00523"></a>00523     <span class="keywordtype">float</span> t1 = m_maxbpm; <span class="comment">// our maximum detected tempo</span>
<a name="l00524"></a>00524 
<a name="l00525"></a>00525     <span class="keywordtype">int</span> p0 = tempo2lag(t1);
<a name="l00526"></a>00526     <span class="keywordtype">int</span> p1 = tempo2lag(t0);
<a name="l00527"></a>00527 
<a name="l00528"></a>00528     std::map&lt;float, int&gt; candidates;
<a name="l00529"></a>00529 
<a name="l00530"></a>00530     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = p0; i &lt;= p1 &amp;&amp; i+1 &lt; n/2; ++i) {
<a name="l00531"></a>00531 
<a name="l00532"></a>00532         <span class="keywordflow">if</span> (m_fr[i] &gt; m_fr[i-1] &amp;&amp;
<a name="l00533"></a>00533             m_fr[i] &gt; m_fr[i+1]) {
<a name="l00534"></a>00534 
<a name="l00535"></a>00535             <span class="comment">// This is a peak in the filtered autocorrelation: stick</span>
<a name="l00536"></a>00536             <span class="comment">// it into the map from filtered autocorrelation to lag</span>
<a name="l00537"></a>00537             <span class="comment">// index -- this sorts our peaks by filtered acf value</span>
<a name="l00538"></a>00538 
<a name="l00539"></a>00539             candidates[m_fr[i]] = i;
<a name="l00540"></a>00540         }
<a name="l00541"></a>00541 
<a name="l00542"></a>00542         <span class="comment">// Also return the filtered autocorrelation in its own output</span>
<a name="l00543"></a>00543 
<a name="l00544"></a>00544         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#acaa605f36839c07e76f4882f5e22d8d7" title="Timestamp of the output feature.">timestamp</a> = m_start +
<a name="l00545"></a>00545             RealTime::frame2RealTime(i * m_stepSize, <a class="code" href="classVamp_1_1Plugin.html#a59b9dd82a4f4eb946cd0474cc81abc23">m_inputSampleRate</a>);
<a name="l00546"></a>00546         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>[0] = m_fr[i];
<a name="l00547"></a>00547         sprintf(buffer, <span class="stringliteral">&quot;%.1f bpm&quot;</span>, lag2tempo(i));
<a name="l00548"></a>00548         <span class="keywordflow">if</span> (i == p1 || i == n/2-2) feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00549"></a>00549         <span class="keywordflow">else</span> feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = buffer;
<a name="l00550"></a>00550         fs[<a class="code" href="FixedTempoEstimator_8cpp.html#a5b284021783d79785d46b043b458368d">FilteredACFOutput</a>].push_back(feature);
<a name="l00551"></a>00551     }
<a name="l00552"></a>00552 
<a name="l00553"></a>00553     <span class="keywordflow">if</span> (candidates.empty()) {
<a name="l00554"></a>00554         cerr &lt;&lt; <span class="stringliteral">&quot;No tempo candidates!&quot;</span> &lt;&lt; endl;
<a name="l00555"></a>00555         <span class="keywordflow">return</span> fs;
<a name="l00556"></a>00556     }
<a name="l00557"></a>00557 
<a name="l00558"></a>00558     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a98907091d0b6a589720ae35ae588a82b" title="True if an output feature has its own timestamp.">hasTimestamp</a> = <span class="keyword">true</span>;
<a name="l00559"></a>00559     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#acaa605f36839c07e76f4882f5e22d8d7" title="Timestamp of the output feature.">timestamp</a> = m_start;
<a name="l00560"></a>00560     
<a name="l00561"></a>00561     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a33686757bd4481c72494122e9bfb9fba" title="True if an output feature has a specified duration.">hasDuration</a> = <span class="keyword">true</span>;
<a name="l00562"></a>00562     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#af687c0a7fe041757e922ec296862b115" title="Duration of the output feature.">duration</a> = m_lasttime - m_start;
<a name="l00563"></a>00563 
<a name="l00564"></a>00564     <span class="comment">// The map contains only peaks and is sorted by filtered acf</span>
<a name="l00565"></a>00565     <span class="comment">// value, so the final element in it is our &quot;best&quot; tempo guess</span>
<a name="l00566"></a>00566 
<a name="l00567"></a>00567     std::map&lt;float, int&gt;::const_iterator ci = candidates.end();
<a name="l00568"></a>00568     --ci;
<a name="l00569"></a>00569     <span class="keywordtype">int</span> maxpi = ci-&gt;second;
<a name="l00570"></a>00570 
<a name="l00571"></a>00571     <span class="keywordflow">if</span> (m_t[maxpi] &gt; 0) {
<a name="l00572"></a>00572 
<a name="l00573"></a>00573         <span class="comment">// This lag has an adjusted tempo from the averaging process:</span>
<a name="l00574"></a>00574         <span class="comment">// use it</span>
<a name="l00575"></a>00575 
<a name="l00576"></a>00576         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>[0] = m_t[maxpi];
<a name="l00577"></a>00577 
<a name="l00578"></a>00578     } <span class="keywordflow">else</span> {
<a name="l00579"></a>00579 
<a name="l00580"></a>00580         <span class="comment">// shouldn&#39;t happen -- it would imply that this high value was</span>
<a name="l00581"></a>00581         <span class="comment">// not a peak!</span>
<a name="l00582"></a>00582 
<a name="l00583"></a>00583         feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>[0] = lag2tempo(maxpi);
<a name="l00584"></a>00584         cerr &lt;&lt; <span class="stringliteral">&quot;WARNING: No stored tempo for index &quot;</span> &lt;&lt; maxpi &lt;&lt; endl;
<a name="l00585"></a>00585     }
<a name="l00586"></a>00586 
<a name="l00587"></a>00587     sprintf(buffer, <span class="stringliteral">&quot;%.1f bpm&quot;</span>, feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>[0]);
<a name="l00588"></a>00588     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = buffer;
<a name="l00589"></a>00589 
<a name="l00590"></a>00590     <span class="comment">// Return the best tempo in the main output</span>
<a name="l00591"></a>00591 
<a name="l00592"></a>00592     fs[<a class="code" href="FixedTempoEstimator_8cpp.html#a7a8511e62dffb5334ad3b70d57b2fcee">TempoOutput</a>].push_back(feature);
<a name="l00593"></a>00593 
<a name="l00594"></a>00594     <span class="comment">// And return the other estimates (up to the arbitrarily chosen</span>
<a name="l00595"></a>00595     <span class="comment">// number of 10 of them) in the candidates output</span>
<a name="l00596"></a>00596 
<a name="l00597"></a>00597     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.clear();
<a name="l00598"></a>00598     feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = <span class="stringliteral">&quot;&quot;</span>;
<a name="l00599"></a>00599 
<a name="l00600"></a>00600     <span class="keywordflow">while</span> (feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.size() &lt; 10) {
<a name="l00601"></a>00601         <span class="keywordflow">if</span> (m_t[ci-&gt;second] &gt; 0) {
<a name="l00602"></a>00602             feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.push_back(m_t[ci-&gt;second]);
<a name="l00603"></a>00603         } <span class="keywordflow">else</span> {
<a name="l00604"></a>00604             feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#a60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.push_back(lag2tempo(ci-&gt;second));
<a name="l00605"></a>00605         }
<a name="l00606"></a>00606         <span class="keywordflow">if</span> (ci == candidates.begin()) <span class="keywordflow">break</span>;
<a name="l00607"></a>00607         --ci;
<a name="l00608"></a>00608     }
<a name="l00609"></a>00609 
<a name="l00610"></a>00610     fs[<a class="code" href="FixedTempoEstimator_8cpp.html#a554b16c6b7516530e52c65318bfe08eb">CandidatesOutput</a>].push_back(feature);
<a name="l00611"></a>00611     
<a name="l00612"></a>00612     <span class="keywordflow">return</span> fs;
<a name="l00613"></a>00613 }
<a name="l00614"></a>00614 
<a name="l00615"></a>00615     
<a name="l00616"></a>00616 
<a name="l00617"></a><a class="code" href="classFixedTempoEstimator.html#a3967c189f054f864639837c2519bd64d">00617</a> <a class="code" href="classFixedTempoEstimator.html#a3967c189f054f864639837c2519bd64d">FixedTempoEstimator::FixedTempoEstimator</a>(<span class="keywordtype">float</span> inputSampleRate) :
<a name="l00618"></a>00618     <a class="code" href="classVamp_1_1Plugin.html#a1b78c4f46c72ef345ed27f0b9bf20ac9">Plugin</a>(inputSampleRate),
<a name="l00619"></a>00619     <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>(new <a class="code" href="classFixedTempoEstimator_1_1D.html">D</a>(inputSampleRate))
<a name="l00620"></a>00620 {
<a name="l00621"></a>00621 }
<a name="l00622"></a>00622 
<a name="l00623"></a><a class="code" href="classFixedTempoEstimator.html#a0302c4bfdc163a3d34478cde93c96a53">00623</a> <a class="code" href="classFixedTempoEstimator.html#a0302c4bfdc163a3d34478cde93c96a53">FixedTempoEstimator::~FixedTempoEstimator</a>()
<a name="l00624"></a>00624 {
<a name="l00625"></a>00625     <span class="keyword">delete</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>;
<a name="l00626"></a>00626 }
<a name="l00627"></a>00627 
<a name="l00628"></a>00628 <span class="keywordtype">string</span>
<a name="l00629"></a><a class="code" href="classFixedTempoEstimator.html#ab818edcf1555177d10260e197e3a5e7a">00629</a> <a class="code" href="classFixedTempoEstimator.html#ab818edcf1555177d10260e197e3a5e7a" title="Get the computer-usable name of the plugin.">FixedTempoEstimator::getIdentifier</a>()<span class="keyword"> const</span>
<a name="l00630"></a>00630 <span class="keyword"></span>{
<a name="l00631"></a>00631     <span class="keywordflow">return</span> <span class="stringliteral">&quot;fixedtempo&quot;</span>;
<a name="l00632"></a>00632 }
<a name="l00633"></a>00633 
<a name="l00634"></a>00634 <span class="keywordtype">string</span>
<a name="l00635"></a><a class="code" href="classFixedTempoEstimator.html#af9eb6fa8a98aa66b55e64e1795f9405f">00635</a> <a class="code" href="classFixedTempoEstimator.html#af9eb6fa8a98aa66b55e64e1795f9405f" title="Get a human-readable name or title of the plugin.">FixedTempoEstimator::getName</a>()<span class="keyword"> const</span>
<a name="l00636"></a>00636 <span class="keyword"></span>{
<a name="l00637"></a>00637     <span class="keywordflow">return</span> <span class="stringliteral">&quot;Simple Fixed Tempo Estimator&quot;</span>;
<a name="l00638"></a>00638 }
<a name="l00639"></a>00639 
<a name="l00640"></a>00640 <span class="keywordtype">string</span>
<a name="l00641"></a><a class="code" href="classFixedTempoEstimator.html#a06b00853f00c2e78d490697fcd7d1920">00641</a> <a class="code" href="classFixedTempoEstimator.html#a06b00853f00c2e78d490697fcd7d1920" title="Get a human-readable description for the plugin, typically a line of text that may optionally be disp...">FixedTempoEstimator::getDescription</a>()<span class="keyword"> const</span>
<a name="l00642"></a>00642 <span class="keyword"></span>{
<a name="l00643"></a>00643     <span class="keywordflow">return</span> <span class="stringliteral">&quot;Study a short section of audio and estimate its tempo, assuming the tempo is constant&quot;</span>;
<a name="l00644"></a>00644 }
<a name="l00645"></a>00645 
<a name="l00646"></a>00646 <span class="keywordtype">string</span>
<a name="l00647"></a><a class="code" href="classFixedTempoEstimator.html#ae910d1b9250b11097fd6b51cd8285b68">00647</a> <a class="code" href="classFixedTempoEstimator.html#ae910d1b9250b11097fd6b51cd8285b68" title="Get the name of the author or vendor of the plugin in human-readable form.">FixedTempoEstimator::getMaker</a>()<span class="keyword"> const</span>
<a name="l00648"></a>00648 <span class="keyword"></span>{
<a name="l00649"></a>00649     <span class="keywordflow">return</span> <span class="stringliteral">&quot;Vamp SDK Example Plugins&quot;</span>;
<a name="l00650"></a>00650 }
<a name="l00651"></a>00651 
<a name="l00652"></a>00652 <span class="keywordtype">int</span>
<a name="l00653"></a><a class="code" href="classFixedTempoEstimator.html#ad002fddb3735c2dd7e31e6a9def9949f">00653</a> <a class="code" href="classFixedTempoEstimator.html#ad002fddb3735c2dd7e31e6a9def9949f" title="Get the version number of the plugin.">FixedTempoEstimator::getPluginVersion</a>()<span class="keyword"> const</span>
<a name="l00654"></a>00654 <span class="keyword"></span>{
<a name="l00655"></a>00655     <span class="keywordflow">return</span> 1;
<a name="l00656"></a>00656 }
<a name="l00657"></a>00657 
<a name="l00658"></a>00658 <span class="keywordtype">string</span>
<a name="l00659"></a><a class="code" href="classFixedTempoEstimator.html#a50c6b64530c84c0707ba3936c5022a48">00659</a> <a class="code" href="classFixedTempoEstimator.html#a50c6b64530c84c0707ba3936c5022a48" title="Get the copyright statement or licensing summary for the plugin.">FixedTempoEstimator::getCopyright</a>()<span class="keyword"> const</span>
<a name="l00660"></a>00660 <span class="keyword"></span>{
<a name="l00661"></a>00661     <span class="keywordflow">return</span> <span class="stringliteral">&quot;Code copyright 2008 Queen Mary, University of London.  Freely redistributable (BSD license)&quot;</span>;
<a name="l00662"></a>00662 }
<a name="l00663"></a>00663 
<a name="l00664"></a>00664 <span class="keywordtype">size_t</span>
<a name="l00665"></a><a class="code" href="classFixedTempoEstimator.html#ad450bb7e7df559ae3d68dfbfb085676f">00665</a> <a class="code" href="classFixedTempoEstimator.html#ad450bb7e7df559ae3d68dfbfb085676f" title="Get the preferred step size (window increment -- the distance in sample frames between the start fram...">FixedTempoEstimator::getPreferredStepSize</a>()<span class="keyword"> const</span>
<a name="l00666"></a>00666 <span class="keyword"></span>{
<a name="l00667"></a>00667     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#add749be18355ab1ae5c1ccbacfd2e192">getPreferredStepSize</a>();
<a name="l00668"></a>00668 }
<a name="l00669"></a>00669 
<a name="l00670"></a>00670 <span class="keywordtype">size_t</span>
<a name="l00671"></a><a class="code" href="classFixedTempoEstimator.html#a68b8569b71504a0478caf990dbe30683">00671</a> <a class="code" href="classFixedTempoEstimator.html#a68b8569b71504a0478caf990dbe30683" title="Get the preferred block size (window size -- the number of sample frames passed in each block to the ...">FixedTempoEstimator::getPreferredBlockSize</a>()<span class="keyword"> const</span>
<a name="l00672"></a>00672 <span class="keyword"></span>{
<a name="l00673"></a>00673     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#ac02826f981736fc2aa5d835fa14e174d">getPreferredBlockSize</a>();
<a name="l00674"></a>00674 }
<a name="l00675"></a>00675 
<a name="l00676"></a>00676 <span class="keywordtype">bool</span>
<a name="l00677"></a><a class="code" href="classFixedTempoEstimator.html#aa7500a4ffbc4653baaf5101defdb37f5">00677</a> <a class="code" href="classFixedTempoEstimator.html#aa7500a4ffbc4653baaf5101defdb37f5" title="Initialise a plugin to prepare it for use with the given number of input channels, step size (window increment, in sample frames) and block size (window size, in sample frames).">FixedTempoEstimator::initialise</a>(<span class="keywordtype">size_t</span> channels, <span class="keywordtype">size_t</span> stepSize, <span class="keywordtype">size_t</span> blockSize)
<a name="l00678"></a>00678 {
<a name="l00679"></a>00679     <span class="keywordflow">if</span> (channels &lt; <a class="code" href="classVamp_1_1Plugin.html#a267b42e866df3cf0d190893e8096f525" title="Get the minimum supported number of input channels.">getMinChannelCount</a>() ||
<a name="l00680"></a>00680         channels &gt; <a class="code" href="classVamp_1_1Plugin.html#a2c5ab12b6fa4847cb244bd1e9cb3ae5e" title="Get the maximum supported number of input channels.">getMaxChannelCount</a>()) <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00681"></a>00681 
<a name="l00682"></a>00682     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#af0fcad4493650728babb7e341963c91d">initialise</a>(channels, stepSize, blockSize);
<a name="l00683"></a>00683 }
<a name="l00684"></a>00684 
<a name="l00685"></a>00685 <span class="keywordtype">void</span>
<a name="l00686"></a><a class="code" href="classFixedTempoEstimator.html#ac41708397255400c6682fee6c1b3d45f">00686</a> <a class="code" href="classFixedTempoEstimator.html#ac41708397255400c6682fee6c1b3d45f" title="Reset the plugin after use, to prepare it for another clean run.">FixedTempoEstimator::reset</a>()
<a name="l00687"></a>00687 {
<a name="l00688"></a>00688     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#af5ac8147bfe79371d00aba8a19c2f8fd">reset</a>();
<a name="l00689"></a>00689 }
<a name="l00690"></a>00690 
<a name="l00691"></a>00691 <a class="code" href="classVamp_1_1PluginBase.html#a3b6bb4bbd86affe1ca9deceea1aad4f8">FixedTempoEstimator::ParameterList</a>
<a name="l00692"></a><a class="code" href="classFixedTempoEstimator.html#ae157465a4e07d180bab05b5c3a4d8987">00692</a> <a class="code" href="classFixedTempoEstimator.html#ae157465a4e07d180bab05b5c3a4d8987" title="Get the controllable parameters of this plugin.">FixedTempoEstimator::getParameterDescriptors</a>()<span class="keyword"> const</span>
<a name="l00693"></a>00693 <span class="keyword"></span>{
<a name="l00694"></a>00694     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#a06fcf80a9a22c4b90abbc88eb592621a">getParameterDescriptors</a>();
<a name="l00695"></a>00695 }
<a name="l00696"></a>00696 
<a name="l00697"></a>00697 <span class="keywordtype">float</span>
<a name="l00698"></a><a class="code" href="classFixedTempoEstimator.html#a2030b05fb1228b30ace16200780c9152">00698</a> <a class="code" href="classFixedTempoEstimator.html#a2030b05fb1228b30ace16200780c9152" title="Get the value of a named parameter.">FixedTempoEstimator::getParameter</a>(std::string <span class="keywordtype">id</span>)<span class="keyword"> const</span>
<a name="l00699"></a>00699 <span class="keyword"></span>{
<a name="l00700"></a>00700     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#a968ef2e555c81e4a3bde89d19fafb31a">getParameter</a>(<span class="keywordtype">id</span>);
<a name="l00701"></a>00701 }
<a name="l00702"></a>00702 
<a name="l00703"></a>00703 <span class="keywordtype">void</span>
<a name="l00704"></a><a class="code" href="classFixedTempoEstimator.html#a8a5a413025384cf451c64d2c2ce13a75">00704</a> <a class="code" href="classFixedTempoEstimator.html#a8a5a413025384cf451c64d2c2ce13a75" title="Set a named parameter.">FixedTempoEstimator::setParameter</a>(std::string <span class="keywordtype">id</span>, <span class="keywordtype">float</span> value)
<a name="l00705"></a>00705 {
<a name="l00706"></a>00706     <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#a6cafa64d4cc8aa3556bc0ce6b0c49bc4">setParameter</a>(<span class="keywordtype">id</span>, value);
<a name="l00707"></a>00707 }
<a name="l00708"></a>00708 
<a name="l00709"></a>00709 <a class="code" href="classVamp_1_1Plugin.html#a30f531b8fb69fac41a24e3d2a6a08ed9">FixedTempoEstimator::OutputList</a>
<a name="l00710"></a><a class="code" href="classFixedTempoEstimator.html#a83121c205a723fe6297e2bf8870622a4">00710</a> <a class="code" href="classFixedTempoEstimator.html#a83121c205a723fe6297e2bf8870622a4" title="Get the outputs of this plugin.">FixedTempoEstimator::getOutputDescriptors</a>()<span class="keyword"> const</span>
<a name="l00711"></a>00711 <span class="keyword"></span>{
<a name="l00712"></a>00712     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#a7ce98af800f36045a0dae4b1dbed943f">getOutputDescriptors</a>();
<a name="l00713"></a>00713 }
<a name="l00714"></a>00714 
<a name="l00715"></a>00715 <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FixedTempoEstimator::FeatureSet</a>
<a name="l00716"></a><a class="code" href="classFixedTempoEstimator.html#a1cf76b0e55cf4ed3da095cffcdeaec3c">00716</a> <a class="code" href="classFixedTempoEstimator.html#a1cf76b0e55cf4ed3da095cffcdeaec3c" title="Process a single block of input data.">FixedTempoEstimator::process</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> *<span class="keyword">const</span> *inputBuffers, <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conve...">RealTime</a> ts)
<a name="l00717"></a>00717 {
<a name="l00718"></a>00718     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#a7fac74fc9fc54f436408705d1e125e20">process</a>(inputBuffers, ts);
<a name="l00719"></a>00719 }
<a name="l00720"></a>00720 
<a name="l00721"></a>00721 <a class="code" href="classVamp_1_1Plugin.html#a448fb57dc245d47923ec9eeaf9856c5f">FixedTempoEstimator::FeatureSet</a>
<a name="l00722"></a><a class="code" href="classFixedTempoEstimator.html#a4965cf99be77fc4d1de51e11d83936b0">00722</a> <a class="code" href="classFixedTempoEstimator.html#a4965cf99be77fc4d1de51e11d83936b0" title="After all blocks have been processed, calculate and return any remaining features derived from the co...">FixedTempoEstimator::getRemainingFeatures</a>()
<a name="l00723"></a>00723 {
<a name="l00724"></a>00724     <span class="keywordflow">return</span> <a class="code" href="classFixedTempoEstimator.html#a5e1c9abaf33e9f48eb7d3b48f8af3308">m_d</a>-&gt;<a class="code" href="classFixedTempoEstimator_1_1D.html#a7f9c3603bb3374d6936885010dbdd82b">getRemainingFeatures</a>();
<a name="l00725"></a>00725 }
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="FixedTempoEstimator_8cpp.html">FixedTempoEstimator.cpp</a>      </li>

    <li class="footer">Generated on Fri Jul 13 2012 13:28:48 for VampPluginSDK by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.0 </li>
   </ul>
 </div>


</body>
</html>