annotate code-doc/PluginHostAdapter_8cpp-source.html @ 7:60ee9a026a62 website

...
author cannam
date Fri, 14 Nov 2008 11:56:54 +0000
parents 351c4ebce5f9
children
rev   line source
cannam@0 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
cannam@0 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
cannam@0 3 <title>VampPluginSDK: PluginHostAdapter.cpp Source File</title>
cannam@0 4 <link href="doxygen.css" rel="stylesheet" type="text/css">
cannam@0 5 <link href="tabs.css" rel="stylesheet" type="text/css">
cannam@0 6 </head><body>
cannam@0 7 <!-- Generated by Doxygen 1.5.5 -->
cannam@0 8 <div class="navigation" id="top">
cannam@0 9 <div class="tabs">
cannam@0 10 <ul>
cannam@0 11 <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
cannam@0 12 <li><a href="namespaces.html"><span>Namespaces</span></a></li>
cannam@0 13 <li><a href="annotated.html"><span>Classes</span></a></li>
cannam@0 14 <li class="current"><a href="files.html"><span>Files</span></a></li>
cannam@0 15 <li><a href="dirs.html"><span>Directories</span></a></li>
cannam@0 16 </ul>
cannam@0 17 </div>
cannam@0 18 <div class="navpath"><a class="el" href="dir_5b77fce4b90561041d958141b45c7c55.html">vamp-sdk</a>
cannam@0 19 </div>
cannam@0 20 </div>
cannam@0 21 </div>
cannam@0 22 <h1>PluginHostAdapter.cpp</h1><a href="PluginHostAdapter_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>
cannam@0 23 <a name="l00002"></a>00002
cannam@0 24 <a name="l00003"></a>00003 <span class="comment">/*</span>
cannam@0 25 <a name="l00004"></a>00004 <span class="comment"> Vamp</span>
cannam@0 26 <a name="l00005"></a>00005 <span class="comment"></span>
cannam@0 27 <a name="l00006"></a>00006 <span class="comment"> An API for audio analysis and feature extraction plugins.</span>
cannam@0 28 <a name="l00007"></a>00007 <span class="comment"></span>
cannam@0 29 <a name="l00008"></a>00008 <span class="comment"> Centre for Digital Music, Queen Mary, University of London.</span>
cannam@0 30 <a name="l00009"></a>00009 <span class="comment"> Copyright 2006 Chris Cannam.</span>
cannam@0 31 <a name="l00010"></a>00010 <span class="comment"> </span>
cannam@0 32 <a name="l00011"></a>00011 <span class="comment"> Permission is hereby granted, free of charge, to any person</span>
cannam@0 33 <a name="l00012"></a>00012 <span class="comment"> obtaining a copy of this software and associated documentation</span>
cannam@0 34 <a name="l00013"></a>00013 <span class="comment"> files (the "Software"), to deal in the Software without</span>
cannam@0 35 <a name="l00014"></a>00014 <span class="comment"> restriction, including without limitation the rights to use, copy,</span>
cannam@0 36 <a name="l00015"></a>00015 <span class="comment"> modify, merge, publish, distribute, sublicense, and/or sell copies</span>
cannam@0 37 <a name="l00016"></a>00016 <span class="comment"> of the Software, and to permit persons to whom the Software is</span>
cannam@0 38 <a name="l00017"></a>00017 <span class="comment"> furnished to do so, subject to the following conditions:</span>
cannam@0 39 <a name="l00018"></a>00018 <span class="comment"></span>
cannam@0 40 <a name="l00019"></a>00019 <span class="comment"> The above copyright notice and this permission notice shall be</span>
cannam@0 41 <a name="l00020"></a>00020 <span class="comment"> included in all copies or substantial portions of the Software.</span>
cannam@0 42 <a name="l00021"></a>00021 <span class="comment"></span>
cannam@0 43 <a name="l00022"></a>00022 <span class="comment"> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,</span>
cannam@0 44 <a name="l00023"></a>00023 <span class="comment"> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</span>
cannam@0 45 <a name="l00024"></a>00024 <span class="comment"> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND</span>
cannam@0 46 <a name="l00025"></a>00025 <span class="comment"> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR</span>
cannam@0 47 <a name="l00026"></a>00026 <span class="comment"> ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF</span>
cannam@0 48 <a name="l00027"></a>00027 <span class="comment"> CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION</span>
cannam@0 49 <a name="l00028"></a>00028 <span class="comment"> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span>
cannam@0 50 <a name="l00029"></a>00029 <span class="comment"></span>
cannam@0 51 <a name="l00030"></a>00030 <span class="comment"> Except as contained in this notice, the names of the Centre for</span>
cannam@0 52 <a name="l00031"></a>00031 <span class="comment"> Digital Music; Queen Mary, University of London; and Chris Cannam</span>
cannam@0 53 <a name="l00032"></a>00032 <span class="comment"> shall not be used in advertising or otherwise to promote the sale,</span>
cannam@0 54 <a name="l00033"></a>00033 <span class="comment"> use or other dealings in this Software without prior written</span>
cannam@0 55 <a name="l00034"></a>00034 <span class="comment"> authorization.</span>
cannam@0 56 <a name="l00035"></a>00035 <span class="comment">*/</span>
cannam@0 57 <a name="l00036"></a>00036
cannam@0 58 <a name="l00037"></a>00037 <span class="preprocessor">#include "<a class="code" href="PluginHostAdapter_8h.html">PluginHostAdapter.h</a>"</span>
cannam@0 59 <a name="l00038"></a>00038 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
cannam@0 60 <a name="l00039"></a>00039
cannam@0 61 <a name="l00040"></a>00040 <span class="keyword">namespace </span>Vamp
cannam@0 62 <a name="l00041"></a>00041 {
cannam@0 63 <a name="l00042"></a>00042
cannam@0 64 <a name="l00043"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#6535abd551acfbbaab381bbe1268cd49">00043</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#6535abd551acfbbaab381bbe1268cd49">PluginHostAdapter::PluginHostAdapter</a>(<span class="keyword">const</span> <a class="code" href="struct__VampPluginDescriptor.html">VampPluginDescriptor</a> *descriptor,
cannam@0 65 <a name="l00044"></a>00044 <span class="keywordtype">float</span> inputSampleRate) :
cannam@0 66 <a name="l00045"></a>00045 <a class="code" href="classVamp_1_1Plugin.html" title="Vamp::Plugin is a base class for plugin instance classes that provide feature extraction...">Plugin</a>(inputSampleRate),
cannam@0 67 <a name="l00046"></a>00046 m_descriptor(descriptor)
cannam@0 68 <a name="l00047"></a>00047 {
cannam@0 69 <a name="l00048"></a>00048 <span class="comment">// std::cerr &lt;&lt; "PluginHostAdapter::PluginHostAdapter (plugin = " &lt;&lt; descriptor-&gt;name &lt;&lt; ")" &lt;&lt; std::endl;</span>
cannam@0 70 <a name="l00049"></a>00049 <a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a> = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#19c4ce36fdeb88eeedb539efc544b8ee" title="Create and return a new instance of this plugin.">instantiate</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>, inputSampleRate);
cannam@0 71 <a name="l00050"></a>00050 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) {
cannam@0 72 <a name="l00051"></a>00051 <span class="comment">// std::cerr &lt;&lt; "WARNING: PluginHostAdapter: Plugin instantiation failed for plugin " &lt;&lt; m_descriptor-&gt;name &lt;&lt; std::endl;</span>
cannam@0 73 <a name="l00052"></a>00052 }
cannam@0 74 <a name="l00053"></a>00053 }
cannam@0 75 <a name="l00054"></a>00054
cannam@0 76 <a name="l00055"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#b0f354cb332852ab1892488f6b8e8c0e">00055</a> PluginHostAdapter::~PluginHostAdapter()
cannam@0 77 <a name="l00056"></a>00056 {
cannam@0 78 <a name="l00057"></a>00057 <span class="comment">// std::cerr &lt;&lt; "PluginHostAdapter::~PluginHostAdapter (plugin = " &lt;&lt; m_descriptor-&gt;name &lt;&lt; ")" &lt;&lt; std::endl;</span>
cannam@0 79 <a name="l00058"></a>00058 <span class="keywordflow">if</span> (<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#0e4522c33e59c3c518b9262f2477bc27" title="Destroy an instance of this plugin.">cleanup</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 80 <a name="l00059"></a>00059 }
cannam@0 81 <a name="l00060"></a>00060
cannam@0 82 <a name="l00061"></a>00061 std::vector&lt;std::string&gt;
cannam@0 83 <a name="l00062"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#08d7ed3a11bf4a3c30fa0f9b41a0fed6">00062</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#08d7ed3a11bf4a3c30fa0f9b41a0fed6">PluginHostAdapter::getPluginPath</a>()
cannam@0 84 <a name="l00063"></a>00063 {
cannam@0 85 <a name="l00064"></a>00064 std::vector&lt;std::string&gt; path;
cannam@0 86 <a name="l00065"></a>00065 std::string envPath;
cannam@0 87 <a name="l00066"></a>00066
cannam@0 88 <a name="l00067"></a>00067 <span class="keywordtype">char</span> *cpath = getenv(<span class="stringliteral">"VAMP_PATH"</span>);
cannam@0 89 <a name="l00068"></a>00068 <span class="keywordflow">if</span> (cpath) envPath = cpath;
cannam@0 90 <a name="l00069"></a>00069
cannam@0 91 <a name="l00070"></a>00070 <span class="preprocessor">#ifdef _WIN32</span>
cannam@0 92 <a name="l00071"></a>00071 <span class="preprocessor"></span><span class="preprocessor">#define PATH_SEPARATOR ';'</span>
cannam@0 93 <a name="l00072"></a>00072 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_VAMP_PATH "%ProgramFiles%\\Vamp Plugins"</span>
cannam@0 94 <a name="l00073"></a>00073 <span class="preprocessor"></span><span class="preprocessor">#else</span>
cannam@0 95 <a name="l00074"></a>00074 <span class="preprocessor"></span><span class="preprocessor">#define PATH_SEPARATOR ':'</span>
cannam@0 96 <a name="l00075"></a>00075 <span class="preprocessor"></span><span class="preprocessor">#ifdef __APPLE__</span>
cannam@0 97 <a name="l00076"></a>00076 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_VAMP_PATH "$HOME/Library/Audio/Plug-Ins/Vamp:/Library/Audio/Plug-Ins/Vamp"</span>
cannam@0 98 <a name="l00077"></a>00077 <span class="preprocessor"></span><span class="preprocessor">#else</span>
cannam@0 99 <a name="l00078"></a>00078 <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_VAMP_PATH "$HOME/vamp:$HOME/.vamp:/usr/local/lib/vamp:/usr/lib/vamp"</span>
cannam@0 100 <a name="l00079"></a>00079 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
cannam@0 101 <a name="l00080"></a>00080 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
cannam@0 102 <a name="l00081"></a>00081 <span class="preprocessor"></span>
cannam@0 103 <a name="l00082"></a>00082 <span class="keywordflow">if</span> (envPath == <span class="stringliteral">""</span>) {
cannam@0 104 <a name="l00083"></a>00083 envPath = <a class="code" href="PluginHostAdapter_8cpp.html#a7a9ce1e832e4f26cd5197ed38d4a58d">DEFAULT_VAMP_PATH</a>;
cannam@0 105 <a name="l00084"></a>00084 <span class="keywordtype">char</span> *chome = getenv(<span class="stringliteral">"HOME"</span>);
cannam@0 106 <a name="l00085"></a>00085 <span class="keywordflow">if</span> (chome) {
cannam@0 107 <a name="l00086"></a>00086 std::string home(chome);
cannam@0 108 <a name="l00087"></a>00087 std::string::size_type f;
cannam@0 109 <a name="l00088"></a>00088 <span class="keywordflow">while</span> ((f = envPath.find(<span class="stringliteral">"$HOME"</span>)) != std::string::npos &amp;&amp;
cannam@0 110 <a name="l00089"></a>00089 f &lt; envPath.length()) {
cannam@0 111 <a name="l00090"></a>00090 envPath.replace(f, 5, home);
cannam@0 112 <a name="l00091"></a>00091 }
cannam@0 113 <a name="l00092"></a>00092 }
cannam@0 114 <a name="l00093"></a>00093 <span class="preprocessor">#ifdef _WIN32</span>
cannam@0 115 <a name="l00094"></a>00094 <span class="preprocessor"></span> <span class="keywordtype">char</span> *cpfiles = getenv(<span class="stringliteral">"ProgramFiles"</span>);
cannam@0 116 <a name="l00095"></a>00095 <span class="keywordflow">if</span> (!cpfiles) cpfiles = <span class="stringliteral">"C:\\Program Files"</span>;
cannam@0 117 <a name="l00096"></a>00096 std::string pfiles(cpfiles);
cannam@0 118 <a name="l00097"></a>00097 std::string::size_type f;
cannam@0 119 <a name="l00098"></a>00098 <span class="keywordflow">while</span> ((f = envPath.find(<span class="stringliteral">"%ProgramFiles%"</span>)) != std::string::npos &amp;&amp;
cannam@0 120 <a name="l00099"></a>00099 f &lt; envPath.length()) {
cannam@0 121 <a name="l00100"></a>00100 envPath.replace(f, 14, pfiles);
cannam@0 122 <a name="l00101"></a>00101 }
cannam@0 123 <a name="l00102"></a>00102 <span class="preprocessor">#endif</span>
cannam@0 124 <a name="l00103"></a>00103 <span class="preprocessor"></span> }
cannam@0 125 <a name="l00104"></a>00104
cannam@0 126 <a name="l00105"></a>00105 std::string::size_type index = 0, newindex = 0;
cannam@0 127 <a name="l00106"></a>00106
cannam@0 128 <a name="l00107"></a>00107 <span class="keywordflow">while</span> ((newindex = envPath.find(<a class="code" href="PluginHostAdapter_8cpp.html#256a5721249aa3309437212cc21a9fe4">PATH_SEPARATOR</a>, index)) &lt; envPath.size()) {
cannam@0 129 <a name="l00108"></a>00108 path.push_back(envPath.substr(index, newindex - index));
cannam@0 130 <a name="l00109"></a>00109 index = newindex + 1;
cannam@0 131 <a name="l00110"></a>00110 }
cannam@0 132 <a name="l00111"></a>00111
cannam@0 133 <a name="l00112"></a>00112 path.push_back(envPath.substr(index));
cannam@0 134 <a name="l00113"></a>00113
cannam@0 135 <a name="l00114"></a>00114 <span class="keywordflow">return</span> path;
cannam@0 136 <a name="l00115"></a>00115 }
cannam@0 137 <a name="l00116"></a>00116
cannam@0 138 <a name="l00117"></a>00117 <span class="keywordtype">bool</span>
cannam@0 139 <a name="l00118"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#dd6a2f1ee7e47bd97fa599cead14b738">00118</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#dd6a2f1ee7e47bd97fa599cead14b738" title="Initialise a plugin to prepare it for use with the given number of input channels...">PluginHostAdapter::initialise</a>(<span class="keywordtype">size_t</span> channels,
cannam@0 140 <a name="l00119"></a>00119 <span class="keywordtype">size_t</span> stepSize,
cannam@0 141 <a name="l00120"></a>00120 <span class="keywordtype">size_t</span> blockSize)
cannam@0 142 <a name="l00121"></a>00121 {
cannam@0 143 <a name="l00122"></a>00122 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>;
cannam@0 144 <a name="l00123"></a>00123 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d0978f17a5e568079470a1978a9aad22" title="Initialise an instance following parameter configuration.">initialise</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>, channels, stepSize, blockSize) ?
cannam@0 145 <a name="l00124"></a>00124 <span class="keyword">true</span> : <span class="keyword">false</span>;
cannam@0 146 <a name="l00125"></a>00125 }
cannam@0 147 <a name="l00126"></a>00126
cannam@0 148 <a name="l00127"></a>00127 <span class="keywordtype">void</span>
cannam@0 149 <a name="l00128"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#5d54c5bbd76bc27b7a243827148afeaa">00128</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#5d54c5bbd76bc27b7a243827148afeaa" title="Reset the plugin after use, to prepare it for another clean run.">PluginHostAdapter::reset</a>()
cannam@0 150 <a name="l00129"></a>00129 {
cannam@0 151 <a name="l00130"></a>00130 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span>;
cannam@0 152 <a name="l00131"></a>00131 <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#12267f6b506aeda3792ff7c982b02336" title="Reset an instance, ready to use again on new input data.">reset</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 153 <a name="l00132"></a>00132 }
cannam@0 154 <a name="l00133"></a>00133
cannam@0 155 <a name="l00134"></a>00134 <a class="code" href="classVamp_1_1Plugin.html#39cb7649d6dcc20e4cb1640cd55907bc">PluginHostAdapter::InputDomain</a>
cannam@0 156 <a name="l00135"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#9c5239a4da67f1a426cd059e1a2856eb">00135</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#9c5239a4da67f1a426cd059e1a2856eb" title="Get the plugin&amp;#39;s required input domain.">PluginHostAdapter::getInputDomain</a>()<span class="keyword"> const</span>
cannam@0 157 <a name="l00136"></a>00136 <span class="keyword"></span>{
cannam@0 158 <a name="l00137"></a>00137 <span class="keywordflow">if</span> (<a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#ffc4d1796da7ced2c0cbb2cc2c4a22f4" title="Preferred input domain for audio input (time or frequency).">inputDomain</a> == <a class="code" href="vamp_8h.html#b107386a5f042feddf6446bea23bb765ee0c1c0d429276f071b8c0730b7bd87d">vampFrequencyDomain</a>) {
cannam@0 159 <a name="l00138"></a>00138 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1Plugin.html#39cb7649d6dcc20e4cb1640cd55907bca30e7877ab33f76acbdca28607e6ab53">FrequencyDomain</a>;
cannam@0 160 <a name="l00139"></a>00139 } <span class="keywordflow">else</span> {
cannam@0 161 <a name="l00140"></a>00140 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1Plugin.html#39cb7649d6dcc20e4cb1640cd55907bcd4a9f31b958a43a9757af7893aa2e7ff">TimeDomain</a>;
cannam@0 162 <a name="l00141"></a>00141 }
cannam@0 163 <a name="l00142"></a>00142 }
cannam@0 164 <a name="l00143"></a>00143
cannam@0 165 <a name="l00144"></a>00144 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>
cannam@0 166 <a name="l00145"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#98aadddc8403eb46c9d8c5a9d1fdd19e">00145</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#98aadddc8403eb46c9d8c5a9d1fdd19e" title="Get the Vamp API compatibility level of the plugin.">PluginHostAdapter::getVampApiVersion</a>()<span class="keyword"> const</span>
cannam@0 167 <a name="l00146"></a>00146 <span class="keyword"></span>{
cannam@0 168 <a name="l00147"></a>00147 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#b6c87760e87ddaa9ac3491bccaaa28c2" title="API version with which this descriptor is compatible.">vampApiVersion</a>;
cannam@0 169 <a name="l00148"></a>00148 }
cannam@0 170 <a name="l00149"></a>00149
cannam@0 171 <a name="l00150"></a>00150 std::string
cannam@0 172 <a name="l00151"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#b27423a656f878d97d2ad2eba4e76c7a">00151</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#b27423a656f878d97d2ad2eba4e76c7a" title="Get the computer-usable name of the plugin.">PluginHostAdapter::getIdentifier</a>()<span class="keyword"> const</span>
cannam@0 173 <a name="l00152"></a>00152 <span class="keyword"></span>{
cannam@0 174 <a name="l00153"></a>00153 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#4915ec8276749cb505c01d25a6d02219" title="Computer-usable name of the plugin.">identifier</a>;
cannam@0 175 <a name="l00154"></a>00154 }
cannam@0 176 <a name="l00155"></a>00155
cannam@0 177 <a name="l00156"></a>00156 std::string
cannam@0 178 <a name="l00157"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#45f1d0377e233eeddd1b7cefb48be62a">00157</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#45f1d0377e233eeddd1b7cefb48be62a" title="Get a human-readable name or title of the plugin.">PluginHostAdapter::getName</a>()<span class="keyword"> const</span>
cannam@0 179 <a name="l00158"></a>00158 <span class="keyword"></span>{
cannam@0 180 <a name="l00159"></a>00159 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#9dd5a0190e4d453ff36b5acb7000b150" title="Human-readable name of the plugin.">name</a>;
cannam@0 181 <a name="l00160"></a>00160 }
cannam@0 182 <a name="l00161"></a>00161
cannam@0 183 <a name="l00162"></a>00162 std::string
cannam@0 184 <a name="l00163"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#5eaafcef030e81b90a3e77cf16cf8ae1">00163</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#5eaafcef030e81b90a3e77cf16cf8ae1" title="Get a human-readable description for the plugin, typically a line of text that may...">PluginHostAdapter::getDescription</a>()<span class="keyword"> const</span>
cannam@0 185 <a name="l00164"></a>00164 <span class="keyword"></span>{
cannam@0 186 <a name="l00165"></a>00165 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#9ff8050f92f1a04a68bb34a9d368295e" title="Human-readable short text about the plugin.">description</a>;
cannam@0 187 <a name="l00166"></a>00166 }
cannam@0 188 <a name="l00167"></a>00167
cannam@0 189 <a name="l00168"></a>00168 std::string
cannam@0 190 <a name="l00169"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#f572be0b175f5661559006a380a0f3db">00169</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#f572be0b175f5661559006a380a0f3db" title="Get the name of the author or vendor of the plugin in human-readable form.">PluginHostAdapter::getMaker</a>()<span class="keyword"> const</span>
cannam@0 191 <a name="l00170"></a>00170 <span class="keyword"></span>{
cannam@0 192 <a name="l00171"></a>00171 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#4dca3d57331802964716edfa80580c9b" title="Human-readable name of plugin&amp;#39;s author or vendor.">maker</a>;
cannam@0 193 <a name="l00172"></a>00172 }
cannam@0 194 <a name="l00173"></a>00173
cannam@0 195 <a name="l00174"></a>00174 <span class="keywordtype">int</span>
cannam@0 196 <a name="l00175"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#6fbd94781867ca46a20368c2a3593c77">00175</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#6fbd94781867ca46a20368c2a3593c77" title="Get the version number of the plugin.">PluginHostAdapter::getPluginVersion</a>()<span class="keyword"> const</span>
cannam@0 197 <a name="l00176"></a>00176 <span class="keyword"></span>{
cannam@0 198 <a name="l00177"></a>00177 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#04427c420d9252c7796c0bf5101345ae" title="Version number of the plugin.">pluginVersion</a>;
cannam@0 199 <a name="l00178"></a>00178 }
cannam@0 200 <a name="l00179"></a>00179
cannam@0 201 <a name="l00180"></a>00180 std::string
cannam@0 202 <a name="l00181"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#c73c9d6baad04369beee695e99584815">00181</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#c73c9d6baad04369beee695e99584815" title="Get the copyright statement or licensing summary for the plugin.">PluginHostAdapter::getCopyright</a>()<span class="keyword"> const</span>
cannam@0 203 <a name="l00182"></a>00182 <span class="keyword"></span>{
cannam@0 204 <a name="l00183"></a>00183 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#e704bba384af0de056a26da1b13ee521" title="Human-readable summary of copyright or licensing for plugin.">copyright</a>;
cannam@0 205 <a name="l00184"></a>00184 }
cannam@0 206 <a name="l00185"></a>00185
cannam@0 207 <a name="l00186"></a>00186 <a class="code" href="classVamp_1_1PluginBase.html#3b6bb4bbd86affe1ca9deceea1aad4f8">PluginHostAdapter::ParameterList</a>
cannam@0 208 <a name="l00187"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#bfa93b20d9b5651a32042a9bb7c8df13">00187</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#bfa93b20d9b5651a32042a9bb7c8df13" title="Get the controllable parameters of this plugin.">PluginHostAdapter::getParameterDescriptors</a>()<span class="keyword"> const</span>
cannam@0 209 <a name="l00188"></a>00188 <span class="keyword"></span>{
cannam@0 210 <a name="l00189"></a>00189 <a class="code" href="classVamp_1_1PluginBase.html#3b6bb4bbd86affe1ca9deceea1aad4f8">ParameterList</a> list;
cannam@0 211 <a name="l00190"></a>00190 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#e6271dc3ea0cea959c84a64185492cab" title="Number of parameter inputs.">parameterCount</a>; ++i) {
cannam@0 212 <a name="l00191"></a>00191 <span class="keyword">const</span> <a class="code" href="struct__VampParameterDescriptor.html" title="C language API for Vamp plugins.">VampParameterDescriptor</a> *spd = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#64d614862604c31d6b84c49005f51913" title="Fixed descriptors for parameter inputs.">parameters</a>[i];
cannam@0 213 <a name="l00192"></a>00192 <a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html">ParameterDescriptor</a> pd;
cannam@0 214 <a name="l00193"></a>00193 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#116fd9f0dc94c2bc4bbc60b5443c598c" title="The name of the parameter, in computer-usable form.">identifier</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#26d74afd6a3341a673f15955031845ab" title="Computer-usable name of the parameter.">identifier</a>;
cannam@0 215 <a name="l00194"></a>00194 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#0ecebb94fb4ada4aad2640e20aa57084" title="The human-readable name of the parameter.">name</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#bba810bce9656f6002777f6c3f655957" title="Human-readable name of the parameter.">name</a>;
cannam@0 216 <a name="l00195"></a>00195 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#780ddad41e433d85c82f9ea4d959cbaf" title="A human-readable short text describing the parameter.">description</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#95489272d6cf5a5b487e949da8e4fac6" title="Human-readable short text about the parameter.">description</a>;
cannam@0 217 <a name="l00196"></a>00196 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#3bc3df322e4c02e17e96bc6d44982d7b" title="The unit of the parameter, in human-readable form.">unit</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#8ca235f816b56dc99125e010eee08fc7" title="Human-readable unit of the parameter.">unit</a>;
cannam@0 218 <a name="l00197"></a>00197 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#b3e4d84f5bc199eea8b642b27e425ec8" title="The minimum value of the parameter.">minValue</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#b59c84f0bbe0d4d0c578d893c087b0db" title="Minimum value.">minValue</a>;
cannam@0 219 <a name="l00198"></a>00198 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#b934b20dd708228a0e3c2811a3e2cec4" title="The maximum value of the parameter.">maxValue</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#6e7646babdb265c4abfc107ba4350d80" title="Maximum value.">maxValue</a>;
cannam@0 220 <a name="l00199"></a>00199 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#ec4ef77451ec02193ecc4a0856673fbc" title="The default value of the parameter.">defaultValue</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#3d37f986ee152ab55feb9902b35f7aca" title="Default value.">defaultValue</a>;
cannam@0 221 <a name="l00200"></a>00200 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#7c556d58d552f737ee5a34efdf7f9425" title="True if the parameter values are quantized to a particular resolution.">isQuantized</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#3f41e3b6b69c7a95ff0ce8625794f83a" title="1 if parameter values are quantized to a particular resolution.">isQuantized</a>;
cannam@0 222 <a name="l00201"></a>00201 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#01f8387e7c853d5e4e35d4e9a37353d7" title="Quantization resolution of the parameter values (e.g.">quantizeStep</a> = spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#68c91fd3fc0b0b3617c2d343fe32d0e5" title="Quantization resolution, if isQuantized.">quantizeStep</a>;
cannam@0 223 <a name="l00202"></a>00202 <span class="keywordflow">if</span> (pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#7c556d58d552f737ee5a34efdf7f9425" title="True if the parameter values are quantized to a particular resolution.">isQuantized</a> &amp;&amp; spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#188883325ab1e4a898e3dc53a8f88f9d" title="Human-readable names of the values, if isQuantized.">valueNames</a>) {
cannam@0 224 <a name="l00203"></a>00203 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 0; spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#188883325ab1e4a898e3dc53a8f88f9d" title="Human-readable names of the values, if isQuantized.">valueNames</a>[j]; ++j) {
cannam@0 225 <a name="l00204"></a>00204 pd.<a class="code" href="structVamp_1_1PluginBase_1_1ParameterDescriptor.html#94df96f53835980b4739965007ff222b" title="Names for the quantized values.">valueNames</a>.push_back(spd-&gt;<a class="code" href="struct__VampParameterDescriptor.html#188883325ab1e4a898e3dc53a8f88f9d" title="Human-readable names of the values, if isQuantized.">valueNames</a>[j]);
cannam@0 226 <a name="l00205"></a>00205 }
cannam@0 227 <a name="l00206"></a>00206 }
cannam@0 228 <a name="l00207"></a>00207 list.push_back(pd);
cannam@0 229 <a name="l00208"></a>00208 }
cannam@0 230 <a name="l00209"></a>00209 <span class="keywordflow">return</span> list;
cannam@0 231 <a name="l00210"></a>00210 }
cannam@0 232 <a name="l00211"></a>00211
cannam@0 233 <a name="l00212"></a>00212 <span class="keywordtype">float</span>
cannam@0 234 <a name="l00213"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#f0c46d4f67ca93be7c76f3ea2e6c8efb">00213</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#f0c46d4f67ca93be7c76f3ea2e6c8efb" title="Get the value of a named parameter.">PluginHostAdapter::getParameter</a>(std::string param)<span class="keyword"> const</span>
cannam@0 235 <a name="l00214"></a>00214 <span class="keyword"></span>{
cannam@0 236 <a name="l00215"></a>00215 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> 0.0;
cannam@0 237 <a name="l00216"></a>00216
cannam@0 238 <a name="l00217"></a>00217 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#e6271dc3ea0cea959c84a64185492cab" title="Number of parameter inputs.">parameterCount</a>; ++i) {
cannam@0 239 <a name="l00218"></a>00218 <span class="keywordflow">if</span> (param == <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#64d614862604c31d6b84c49005f51913" title="Fixed descriptors for parameter inputs.">parameters</a>[i]-&gt;<a class="code" href="struct__VampParameterDescriptor.html#26d74afd6a3341a673f15955031845ab" title="Computer-usable name of the parameter.">identifier</a>) {
cannam@0 240 <a name="l00219"></a>00219 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#07174981875b55ee2ec7521a7f4fc395" title="Get a parameter value.">getParameter</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>, i);
cannam@0 241 <a name="l00220"></a>00220 }
cannam@0 242 <a name="l00221"></a>00221 }
cannam@0 243 <a name="l00222"></a>00222
cannam@0 244 <a name="l00223"></a>00223 <span class="keywordflow">return</span> 0.0;
cannam@0 245 <a name="l00224"></a>00224 }
cannam@0 246 <a name="l00225"></a>00225
cannam@0 247 <a name="l00226"></a>00226 <span class="keywordtype">void</span>
cannam@0 248 <a name="l00227"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#29f75395aa75b9de0228aa11edf9c6d6">00227</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#29f75395aa75b9de0228aa11edf9c6d6" title="Set a named parameter.">PluginHostAdapter::setParameter</a>(std::string param,
cannam@0 249 <a name="l00228"></a>00228 <span class="keywordtype">float</span> value)
cannam@0 250 <a name="l00229"></a>00229 {
cannam@0 251 <a name="l00230"></a>00230 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span>;
cannam@0 252 <a name="l00231"></a>00231
cannam@0 253 <a name="l00232"></a>00232 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#e6271dc3ea0cea959c84a64185492cab" title="Number of parameter inputs.">parameterCount</a>; ++i) {
cannam@0 254 <a name="l00233"></a>00233 <span class="keywordflow">if</span> (param == <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#64d614862604c31d6b84c49005f51913" title="Fixed descriptors for parameter inputs.">parameters</a>[i]-&gt;<a class="code" href="struct__VampParameterDescriptor.html#26d74afd6a3341a673f15955031845ab" title="Computer-usable name of the parameter.">identifier</a>) {
cannam@0 255 <a name="l00234"></a>00234 <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#ad3cfc7a3b432df40bd9db13eee6a481" title="Set a parameter value.">setParameter</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>, i, value);
cannam@0 256 <a name="l00235"></a>00235 <span class="keywordflow">return</span>;
cannam@0 257 <a name="l00236"></a>00236 }
cannam@0 258 <a name="l00237"></a>00237 }
cannam@0 259 <a name="l00238"></a>00238 }
cannam@0 260 <a name="l00239"></a>00239
cannam@0 261 <a name="l00240"></a>00240 <a class="code" href="classVamp_1_1PluginBase.html#7f66f00437b21e5f694fe02356b12f20">PluginHostAdapter::ProgramList</a>
cannam@0 262 <a name="l00241"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#7ac5681dcfe08b7b8a796bffc0aff3e3">00241</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#7ac5681dcfe08b7b8a796bffc0aff3e3" title="Get the program settings available in this plugin.">PluginHostAdapter::getPrograms</a>()<span class="keyword"> const</span>
cannam@0 263 <a name="l00242"></a>00242 <span class="keyword"></span>{
cannam@0 264 <a name="l00243"></a>00243 <a class="code" href="classVamp_1_1PluginBase.html#7f66f00437b21e5f694fe02356b12f20">ProgramList</a> list;
cannam@0 265 <a name="l00244"></a>00244
cannam@0 266 <a name="l00245"></a>00245 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#1962666aa173e7a9a2c30dc82e4b2e00" title="Number of programs.">programCount</a>; ++i) {
cannam@0 267 <a name="l00246"></a>00246 list.push_back(<a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d488470c582d8472d86455889d71c5ec" title="Fixed names for programs.">programs</a>[i]);
cannam@0 268 <a name="l00247"></a>00247 }
cannam@0 269 <a name="l00248"></a>00248
cannam@0 270 <a name="l00249"></a>00249 <span class="keywordflow">return</span> list;
cannam@0 271 <a name="l00250"></a>00250 }
cannam@0 272 <a name="l00251"></a>00251
cannam@0 273 <a name="l00252"></a>00252 std::string
cannam@0 274 <a name="l00253"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#34859eff8ca8d862af39be9636ec1867">00253</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#34859eff8ca8d862af39be9636ec1867" title="Get the current program.">PluginHostAdapter::getCurrentProgram</a>()<span class="keyword"> const</span>
cannam@0 275 <a name="l00254"></a>00254 <span class="keyword"></span>{
cannam@0 276 <a name="l00255"></a>00255 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> <span class="stringliteral">""</span>;
cannam@0 277 <a name="l00256"></a>00256
cannam@0 278 <a name="l00257"></a>00257 <span class="keywordtype">int</span> pn = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#861a77525a95d424cb846820b018af53" title="Get the current program (if programCount &amp;gt; 0).">getCurrentProgram</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 279 <a name="l00258"></a>00258 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d488470c582d8472d86455889d71c5ec" title="Fixed names for programs.">programs</a>[pn];
cannam@0 280 <a name="l00259"></a>00259 }
cannam@0 281 <a name="l00260"></a>00260
cannam@0 282 <a name="l00261"></a>00261 <span class="keywordtype">void</span>
cannam@0 283 <a name="l00262"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#8f5515ab34cc13d9403ccc6b4b788683">00262</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#8f5515ab34cc13d9403ccc6b4b788683" title="Select a program.">PluginHostAdapter::selectProgram</a>(std::string program)
cannam@0 284 <a name="l00263"></a>00263 {
cannam@0 285 <a name="l00264"></a>00264 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span>;
cannam@0 286 <a name="l00265"></a>00265
cannam@0 287 <a name="l00266"></a>00266 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#1962666aa173e7a9a2c30dc82e4b2e00" title="Number of programs.">programCount</a>; ++i) {
cannam@0 288 <a name="l00267"></a>00267 <span class="keywordflow">if</span> (program == <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d488470c582d8472d86455889d71c5ec" title="Fixed names for programs.">programs</a>[i]) {
cannam@0 289 <a name="l00268"></a>00268 <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d9af40cb165ca187e49250964af5f5cf" title="Set the current program.">selectProgram</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>, i);
cannam@0 290 <a name="l00269"></a>00269 <span class="keywordflow">return</span>;
cannam@0 291 <a name="l00270"></a>00270 }
cannam@0 292 <a name="l00271"></a>00271 }
cannam@0 293 <a name="l00272"></a>00272 }
cannam@0 294 <a name="l00273"></a>00273
cannam@0 295 <a name="l00274"></a>00274 <span class="keywordtype">size_t</span>
cannam@0 296 <a name="l00275"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#859ad5d59402691daed3cf1af1899ebe">00275</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#859ad5d59402691daed3cf1af1899ebe" title="Get the preferred step size (window increment -- the distance in sample frames between...">PluginHostAdapter::getPreferredStepSize</a>()<span class="keyword"> const</span>
cannam@0 297 <a name="l00276"></a>00276 <span class="keyword"></span>{
cannam@0 298 <a name="l00277"></a>00277 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> 0;
cannam@0 299 <a name="l00278"></a>00278 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#2beddf2ce156c05dd24477ac663adcbb" title="Get the plugin&amp;#39;s preferred processing window increment in samples.">getPreferredStepSize</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 300 <a name="l00279"></a>00279 }
cannam@0 301 <a name="l00280"></a>00280
cannam@0 302 <a name="l00281"></a>00281 <span class="keywordtype">size_t</span>
cannam@0 303 <a name="l00282"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#d5e0ea8042bdec4dd18428991117e07a">00282</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#d5e0ea8042bdec4dd18428991117e07a" title="Get the preferred block size (window size -- the number of sample frames passed in...">PluginHostAdapter::getPreferredBlockSize</a>()<span class="keyword"> const</span>
cannam@0 304 <a name="l00283"></a>00283 <span class="keyword"></span>{
cannam@0 305 <a name="l00284"></a>00284 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> 0;
cannam@0 306 <a name="l00285"></a>00285 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#c626e42554ab1532c8d8b5132a0faee8" title="Get the plugin&amp;#39;s preferred processing window size in samples.">getPreferredBlockSize</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 307 <a name="l00286"></a>00286 }
cannam@0 308 <a name="l00287"></a>00287
cannam@0 309 <a name="l00288"></a>00288 <span class="keywordtype">size_t</span>
cannam@0 310 <a name="l00289"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#67d1198c0e58d3f0076d0eda599ff28d">00289</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#67d1198c0e58d3f0076d0eda599ff28d" title="Get the minimum supported number of input channels.">PluginHostAdapter::getMinChannelCount</a>()<span class="keyword"> const</span>
cannam@0 311 <a name="l00290"></a>00290 <span class="keyword"></span>{
cannam@0 312 <a name="l00291"></a>00291 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> 0;
cannam@0 313 <a name="l00292"></a>00292 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#f175ca17716db5a7545b61b01caabd92" title="Get the minimum number of input channels this plugin can handle.">getMinChannelCount</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 314 <a name="l00293"></a>00293 }
cannam@0 315 <a name="l00294"></a>00294
cannam@0 316 <a name="l00295"></a>00295 <span class="keywordtype">size_t</span>
cannam@0 317 <a name="l00296"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#25091905e97e39d515d8ffc1a9f2b9e0">00296</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#25091905e97e39d515d8ffc1a9f2b9e0" title="Get the maximum supported number of input channels.">PluginHostAdapter::getMaxChannelCount</a>()<span class="keyword"> const</span>
cannam@0 318 <a name="l00297"></a>00297 <span class="keyword"></span>{
cannam@0 319 <a name="l00298"></a>00298 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> 0;
cannam@0 320 <a name="l00299"></a>00299 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d1600203418d9646332f5b917284261b" title="Get the maximum number of input channels this plugin can handle.">getMaxChannelCount</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 321 <a name="l00300"></a>00300 }
cannam@0 322 <a name="l00301"></a>00301
cannam@0 323 <a name="l00302"></a>00302 <a class="code" href="classVamp_1_1Plugin.html#30f531b8fb69fac41a24e3d2a6a08ed9">PluginHostAdapter::OutputList</a>
cannam@0 324 <a name="l00303"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#e02670cca9d25cdc4100cbe7a12e3e68">00303</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#e02670cca9d25cdc4100cbe7a12e3e68" title="Get the outputs of this plugin.">PluginHostAdapter::getOutputDescriptors</a>()<span class="keyword"> const</span>
cannam@0 325 <a name="l00304"></a>00304 <span class="keyword"></span>{
cannam@0 326 <a name="l00305"></a>00305 <a class="code" href="classVamp_1_1Plugin.html#30f531b8fb69fac41a24e3d2a6a08ed9">OutputList</a> list;
cannam@0 327 <a name="l00306"></a>00306 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) {
cannam@0 328 <a name="l00307"></a>00307 <span class="comment">// std::cerr &lt;&lt; "PluginHostAdapter::getOutputDescriptors: no handle " &lt;&lt; std::endl;</span>
cannam@0 329 <a name="l00308"></a>00308 <span class="keywordflow">return</span> list;
cannam@0 330 <a name="l00309"></a>00309 }
cannam@0 331 <a name="l00310"></a>00310
cannam@0 332 <a name="l00311"></a>00311 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#a8fc88da704e24b2b5f674821dd380c1" title="Get the number of feature outputs (distinct sets of results).">getOutputCount</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 333 <a name="l00312"></a>00312
cannam@0 334 <a name="l00313"></a>00313 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; count; ++i) {
cannam@0 335 <a name="l00314"></a>00314 <a class="code" href="struct__VampOutputDescriptor.html">VampOutputDescriptor</a> *sd = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#92c58b8ff99ad0c23a42333aa55c144d" title="Get a descriptor for a given feature output.">getOutputDescriptor</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>, i);
cannam@0 336 <a name="l00315"></a>00315 <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html">OutputDescriptor</a> d;
cannam@0 337 <a name="l00316"></a>00316 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#e2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#461161b2010370176115967e4f58a5f5" title="Computer-usable name of the output.">identifier</a>;
cannam@0 338 <a name="l00317"></a>00317 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#b824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#f4fca576bd47167fd2bf9b43d588815f" title="Human-readable name of the output.">name</a>;
cannam@0 339 <a name="l00318"></a>00318 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#f9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#bfa911b138cfb80cf63e8f2e0fa0fb89" title="Human-readable short text about the output.">description</a>;
cannam@0 340 <a name="l00319"></a>00319 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#d038caa8e596dfd037035637202f1d63" title="Human-readable name of the unit of the output.">unit</a>;
cannam@0 341 <a name="l00320"></a>00320 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#f0e577e1a256ff6eed6ea42133fec77d" title="True if the output has the same number of values per sample for every output sample...">hasFixedBinCount</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#e8571f5a2bc740738af0cb7dda0c4749" title="1 if output has equal number of values for each returned result.">hasFixedBinCount</a>;
cannam@0 342 <a name="l00321"></a>00321 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#fdd006959a995e40ef7d565a3a4df6dc" title="The number of values per result of the output.">binCount</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#652ee422092720e44d23d98bdb68f978" title="Number of values per result, if hasFixedBinCount.">binCount</a>;
cannam@0 343 <a name="l00322"></a>00322 <span class="keywordflow">if</span> (d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#f0e577e1a256ff6eed6ea42133fec77d" title="True if the output has the same number of values per sample for every output sample...">hasFixedBinCount</a>) {
cannam@0 344 <a name="l00323"></a>00323 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 0; j &lt; sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#652ee422092720e44d23d98bdb68f978" title="Number of values per result, if hasFixedBinCount.">binCount</a>; ++j) {
cannam@0 345 <a name="l00324"></a>00324 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#31d9b79e2d8241344f551a22fcb5c8c7" title="The (human-readable) names of each of the bins, if appropriate.">binNames</a>.push_back(sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#10fffaa32bd894843ff7592240dfe447" title="Names of returned value bins, if hasFixedBinCount.">binNames</a>[j] ? sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#10fffaa32bd894843ff7592240dfe447" title="Names of returned value bins, if hasFixedBinCount.">binNames</a>[j] : <span class="stringliteral">""</span>);
cannam@0 346 <a name="l00325"></a>00325 }
cannam@0 347 <a name="l00326"></a>00326 }
cannam@0 348 <a name="l00327"></a>00327 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#e9ccb65f99f477096b65dd031f4c5e31" title="True if the results in each output bin fall within a fixed numeric range (minimum...">hasKnownExtents</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#f6b512d772023b4e852216689c1c4465" title="1 if each returned value falls within the same fixed min/max range.">hasKnownExtents</a>;
cannam@0 349 <a name="l00328"></a>00328 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#c9f5924c0be7571bba8e7ae7e7a921f4" title="Minimum value of the results in the output.">minValue</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#9a28180989e3d028c12a98517479dc46" title="Minimum value for a returned result in any bin, if hasKnownExtents.">minValue</a>;
cannam@0 350 <a name="l00329"></a>00329 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#907b4e8fbb48a46ac5a05f880d72719f" title="Maximum value of the results in the output.">maxValue</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#4cbe540a247df60f85b00b2aa16461ee" title="Maximum value for a returned result in any bin, if hasKnownExtents.">maxValue</a>;
cannam@0 351 <a name="l00330"></a>00330 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#1b4858928d23bfd7d5bc557c82a83fb4" title="True if the output values are quantized to a particular resolution.">isQuantized</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#b56cf0bbb17136819024574d5cc65e30" title="1 if returned results are quantized to a particular resolution.">isQuantized</a>;
cannam@0 352 <a name="l00331"></a>00331 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#3bed37153067b625b95acb40b60dbf0b" title="Quantization resolution of the output values (e.g.">quantizeStep</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#71aa40222dda4321030cccd0bb655fe3" title="Quantization resolution for returned results, if isQuantized.">quantizeStep</a>;
cannam@0 353 <a name="l00332"></a>00332
cannam@0 354 <a name="l00333"></a>00333 <span class="keywordflow">switch</span> (sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#5da1d27cc99badc214640e859b882072" title="Time positioning method for returned results (see VampSampleType).">sampleType</a>) {
cannam@0 355 <a name="l00334"></a>00334 <span class="keywordflow">case</span> <a class="code" href="vamp_8h.html#a24a8cee023d8b7659d25cbe0584b821b546deafd57f175fb1e7f9cbea1c5113" title="Each process call returns results aligned with call&amp;#39;s block start.">vampOneSamplePerStep</a>:
cannam@0 356 <a name="l00335"></a>00335 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#0d1194980d44e31b25ef3b4b070d6b5d" title="Positioning in time of the output results.">sampleType</a> = <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#bffa9ed50cd756df70fd51f0355f448c0459d5d0d2198d21e8bc90abe4fdccca" title="Results from each process() align with that call&amp;#39;s block start.">OutputDescriptor::OneSamplePerStep</a>; <span class="keywordflow">break</span>;
cannam@0 357 <a name="l00336"></a>00336 <span class="keywordflow">case</span> <a class="code" href="vamp_8h.html#a24a8cee023d8b7659d25cbe0584b821afc8a05f722bc83ecce227e12e838cf8" title="Returned results are evenly spaced at samplerate specified below.">vampFixedSampleRate</a>:
cannam@0 358 <a name="l00337"></a>00337 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#0d1194980d44e31b25ef3b4b070d6b5d" title="Positioning in time of the output results.">sampleType</a> = <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#bffa9ed50cd756df70fd51f0355f448c4c74bd2fc96dfe2815623f94b40e5629" title="Results are evenly spaced in time (sampleRate specified below).">OutputDescriptor::FixedSampleRate</a>; <span class="keywordflow">break</span>;
cannam@0 359 <a name="l00338"></a>00338 <span class="keywordflow">case</span> <a class="code" href="vamp_8h.html#a24a8cee023d8b7659d25cbe0584b821bae8a21a9e30eb73e16d6abc6c7415e8" title="Returned results have their own individual timestamps.">vampVariableSampleRate</a>:
cannam@0 360 <a name="l00339"></a>00339 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#0d1194980d44e31b25ef3b4b070d6b5d" title="Positioning in time of the output results.">sampleType</a> = <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#bffa9ed50cd756df70fd51f0355f448cdea995a737867f7b22b52f1c43c5432e" title="Results are unevenly spaced and have individual timestamps.">OutputDescriptor::VariableSampleRate</a>; <span class="keywordflow">break</span>;
cannam@0 361 <a name="l00340"></a>00340 }
cannam@0 362 <a name="l00341"></a>00341
cannam@0 363 <a name="l00342"></a>00342 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#dd0cbbdfa9c91764037c39365b1d42af" title="Sample rate of the output results, as samples per second.">sampleRate</a> = sd-&gt;<a class="code" href="struct__VampOutputDescriptor.html#1ccf193317b2b9c2eb0dbd8dcf61d26e" title="Sample rate of returned results, if sampleType is vampFixedSampleRate.">sampleRate</a>;
cannam@0 364 <a name="l00343"></a>00343
cannam@0 365 <a name="l00344"></a>00344 list.push_back(d);
cannam@0 366 <a name="l00345"></a>00345
cannam@0 367 <a name="l00346"></a>00346 <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#8cc38edc921616e67e551aa03397ec79" title="Destroy a descriptor for a feature output.">releaseOutputDescriptor</a>(sd);
cannam@0 368 <a name="l00347"></a>00347 }
cannam@0 369 <a name="l00348"></a>00348
cannam@0 370 <a name="l00349"></a>00349 <span class="keywordflow">return</span> list;
cannam@0 371 <a name="l00350"></a>00350 }
cannam@0 372 <a name="l00351"></a>00351
cannam@0 373 <a name="l00352"></a>00352 <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">PluginHostAdapter::FeatureSet</a>
cannam@0 374 <a name="l00353"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#82c29a512c0587ea0121eee4b0c2a684">00353</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#82c29a512c0587ea0121eee4b0c2a684" title="Process a single block of input data.">PluginHostAdapter::process</a>(<span class="keyword">const</span> <span class="keywordtype">float</span> *<span class="keyword">const</span> *inputBuffers,
cannam@0 375 <a name="l00354"></a>00354 <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic...">RealTime</a> timestamp)
cannam@0 376 <a name="l00355"></a>00355 {
cannam@0 377 <a name="l00356"></a>00356 <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> fs;
cannam@0 378 <a name="l00357"></a>00357 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> fs;
cannam@0 379 <a name="l00358"></a>00358
cannam@0 380 <a name="l00359"></a>00359 <span class="keywordtype">int</span> sec = timestamp.<a class="code" href="structVamp_1_1RealTime.html#b4d81983384a9f57ce064e6c343f2267">sec</a>;
cannam@0 381 <a name="l00360"></a>00360 <span class="keywordtype">int</span> nsec = timestamp.<a class="code" href="structVamp_1_1RealTime.html#2078835bef7bb92514a65b6051cfc6c8">nsec</a>;
cannam@0 382 <a name="l00361"></a>00361
cannam@0 383 <a name="l00362"></a>00362 <a class="code" href="struct__VampFeatureList.html">VampFeatureList</a> *features = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#c5a0a75b6e68b22fed536765d1f2f254" title="Process an input block and return a set of features.">process</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>,
cannam@0 384 <a name="l00363"></a>00363 inputBuffers,
cannam@0 385 <a name="l00364"></a>00364 sec, nsec);
cannam@0 386 <a name="l00365"></a>00365
cannam@0 387 <a name="l00366"></a>00366 <a class="code" href="classVamp_1_1PluginHostAdapter.html#ee417a4c9ba9dbb63777c963d5f9452a">convertFeatures</a>(features, fs);
cannam@0 388 <a name="l00367"></a>00367 <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#c4bafe8ad2734d21a433d745b18e7d63" title="Release a feature set returned from process or getRemainingFeatures.">releaseFeatureSet</a>(features);
cannam@0 389 <a name="l00368"></a>00368 <span class="keywordflow">return</span> fs;
cannam@0 390 <a name="l00369"></a>00369 }
cannam@0 391 <a name="l00370"></a>00370
cannam@0 392 <a name="l00371"></a>00371 <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">PluginHostAdapter::FeatureSet</a>
cannam@0 393 <a name="l00372"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#d3f5f16a89a821da2ec1186fd2062e83">00372</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#d3f5f16a89a821da2ec1186fd2062e83" title="After all blocks have been processed, calculate and return any remaining features...">PluginHostAdapter::getRemainingFeatures</a>()
cannam@0 394 <a name="l00373"></a>00373 {
cannam@0 395 <a name="l00374"></a>00374 <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> fs;
cannam@0 396 <a name="l00375"></a>00375 <span class="keywordflow">if</span> (!<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>) <span class="keywordflow">return</span> fs;
cannam@0 397 <a name="l00376"></a>00376
cannam@0 398 <a name="l00377"></a>00377 <a class="code" href="struct__VampFeatureList.html">VampFeatureList</a> *features = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#d22c666188aadab83c354a0edb18fcf0" title="Return any remaining features at the end of processing.">getRemainingFeatures</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 399 <a name="l00378"></a>00378
cannam@0 400 <a name="l00379"></a>00379 <a class="code" href="classVamp_1_1PluginHostAdapter.html#ee417a4c9ba9dbb63777c963d5f9452a">convertFeatures</a>(features, fs);
cannam@0 401 <a name="l00380"></a>00380 <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#c4bafe8ad2734d21a433d745b18e7d63" title="Release a feature set returned from process or getRemainingFeatures.">releaseFeatureSet</a>(features);
cannam@0 402 <a name="l00381"></a>00381 <span class="keywordflow">return</span> fs;
cannam@0 403 <a name="l00382"></a>00382 }
cannam@0 404 <a name="l00383"></a>00383
cannam@0 405 <a name="l00384"></a>00384 <span class="keywordtype">void</span>
cannam@0 406 <a name="l00385"></a><a class="code" href="classVamp_1_1PluginHostAdapter.html#ee417a4c9ba9dbb63777c963d5f9452a">00385</a> <a class="code" href="classVamp_1_1PluginHostAdapter.html#ee417a4c9ba9dbb63777c963d5f9452a">PluginHostAdapter::convertFeatures</a>(<a class="code" href="struct__VampFeatureList.html">VampFeatureList</a> *features,
cannam@0 407 <a name="l00386"></a>00386 <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a> &amp;fs)
cannam@0 408 <a name="l00387"></a>00387 {
cannam@0 409 <a name="l00388"></a>00388 <span class="keywordflow">if</span> (!features) <span class="keywordflow">return</span>;
cannam@0 410 <a name="l00389"></a>00389
cannam@0 411 <a name="l00390"></a>00390 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputs = <a class="code" href="classVamp_1_1PluginHostAdapter.html#0c9f252aca8ac298e30cadd0de032ec2">m_descriptor</a>-&gt;<a class="code" href="struct__VampPluginDescriptor.html#a8fc88da704e24b2b5f674821dd380c1" title="Get the number of feature outputs (distinct sets of results).">getOutputCount</a>(<a class="code" href="classVamp_1_1PluginHostAdapter.html#02ebd03b226b4a467cad747ce77e79ee">m_handle</a>);
cannam@0 412 <a name="l00391"></a>00391
cannam@0 413 <a name="l00392"></a>00392 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i &lt; outputs; ++i) {
cannam@0 414 <a name="l00393"></a>00393
cannam@0 415 <a name="l00394"></a>00394 <a class="code" href="struct__VampFeatureList.html">VampFeatureList</a> &amp;list = features[i];
cannam@0 416 <a name="l00395"></a>00395
cannam@0 417 <a name="l00396"></a>00396 <span class="keywordflow">if</span> (list.<a class="code" href="struct__VampFeatureList.html#01db33a31ae5e04a4bd097f4b6aa75f1" title="Number of features in this feature list.">featureCount</a> &gt; 0) {
cannam@0 418 <a name="l00397"></a>00397
cannam@0 419 <a name="l00398"></a>00398 <a class="code" href="structVamp_1_1Plugin_1_1Feature.html">Feature</a> feature;
cannam@0 420 <a name="l00399"></a>00399 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.reserve(list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[0].<a class="code" href="struct__VampFeature.html#b1ce7c8a2b489e9b0694a967497a29fd" title="Number of values.">valueCount</a>);
cannam@0 421 <a name="l00400"></a>00400
cannam@0 422 <a name="l00401"></a>00401 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 0; j &lt; list.<a class="code" href="struct__VampFeatureList.html#01db33a31ae5e04a4bd097f4b6aa75f1" title="Number of features in this feature list.">featureCount</a>; ++j) {
cannam@0 423 <a name="l00402"></a>00402
cannam@0 424 <a name="l00403"></a>00403 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#98907091d0b6a589720ae35ae588a82b" title="True if an output feature has its own timestamp.">hasTimestamp</a> = list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#be6aa7a08185beeb9deca2d08d99859f" title="1 if the feature has a timestamp (i.e.">hasTimestamp</a>;
cannam@0 425 <a name="l00404"></a>00404 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#caa605f36839c07e76f4882f5e22d8d7" title="Timestamp of the output feature.">timestamp</a> = <a class="code" href="structVamp_1_1RealTime.html" title="RealTime represents time values to nanosecond precision with accurate arithmetic...">RealTime</a>(list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#31f0b57050e33d082692536097953d9c" title="Seconds component of timestamp.">sec</a>,
cannam@0 426 <a name="l00405"></a>00405 list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#8874cb23600c6b10ca6e8a40920d999e" title="Nanoseconds component of timestamp.">nsec</a>);
cannam@0 427 <a name="l00406"></a>00406
cannam@0 428 <a name="l00407"></a>00407 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> k = 0; k &lt; list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#b1ce7c8a2b489e9b0694a967497a29fd" title="Number of values.">valueCount</a>; ++k) {
cannam@0 429 <a name="l00408"></a>00408 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.push_back(list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#e4030f941ddb2bab8bc147b88e1f1c15" title="Values for this returned sample.">values</a>[k]);
cannam@0 430 <a name="l00409"></a>00409 }
cannam@0 431 <a name="l00410"></a>00410
cannam@0 432 <a name="l00411"></a>00411 <span class="keywordflow">if</span> (list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#6662b7489a7890cae713bf4e8f6d52cd" title="Label for this returned sample.">label</a>) {
cannam@0 433 <a name="l00412"></a>00412 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#6662b7489a7890cae713bf4e8f6d52cd" title="Label for this returned sample.">label</a>;
cannam@0 434 <a name="l00413"></a>00413 }
cannam@0 435 <a name="l00414"></a>00414
cannam@0 436 <a name="l00415"></a>00415 fs[i].push_back(feature);
cannam@0 437 <a name="l00416"></a>00416
cannam@0 438 <a name="l00417"></a>00417 <span class="keywordflow">if</span> (list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#b1ce7c8a2b489e9b0694a967497a29fd" title="Number of values.">valueCount</a> &gt; 0) {
cannam@0 439 <a name="l00418"></a>00418 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.clear();
cannam@0 440 <a name="l00419"></a>00419 }
cannam@0 441 <a name="l00420"></a>00420
cannam@0 442 <a name="l00421"></a>00421 <span class="keywordflow">if</span> (list.<a class="code" href="struct__VampFeatureList.html#a2d18873fd5e58354460ea77fc48692f" title="Features in this feature list.">features</a>[j].<a class="code" href="struct__VampFeature.html#6662b7489a7890cae713bf4e8f6d52cd" title="Label for this returned sample.">label</a>) {
cannam@0 443 <a name="l00422"></a>00422 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#8eb1fb35f73b247ed13de9527c18f036" title="Label for the sample of this feature.">label</a> = <span class="stringliteral">""</span>;
cannam@0 444 <a name="l00423"></a>00423 }
cannam@0 445 <a name="l00424"></a>00424 }
cannam@0 446 <a name="l00425"></a>00425 }
cannam@0 447 <a name="l00426"></a>00426 }
cannam@0 448 <a name="l00427"></a>00427 }
cannam@0 449 <a name="l00428"></a>00428
cannam@0 450 <a name="l00429"></a>00429 }
cannam@0 451 </pre></div></div>
cannam@0 452 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jul 9 11:36:06 2008 for VampPluginSDK by&nbsp;
cannam@0 453 <a href="http://www.doxygen.org/index.html">
cannam@0 454 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
cannam@0 455 </body>
cannam@0 456 </html>