Mercurial > hg > vamp-website
comparison code-doc/PowerSpectrum_8cpp-source.html @ 35:0976232e353b website
* Update for 2.1 release; add wiki link
author | cannam |
---|---|
date | Fri, 25 Sep 2009 15:40:18 +0000 |
parents | cc0be37dc9d3 |
children |
comparison
equal
deleted
inserted
replaced
34:4b4db9230e94 | 35:0976232e353b |
---|---|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> | 2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
3 <title>VampPluginSDK: PowerSpectrum.cpp Source File</title> | 3 <title>VampPluginSDK: PowerSpectrum.cpp Source File</title> |
4 <link href="tabs.css" rel="stylesheet" type="text/css"> | |
4 <link href="doxygen.css" rel="stylesheet" type="text/css"> | 5 <link href="doxygen.css" rel="stylesheet" type="text/css"> |
5 <link href="tabs.css" rel="stylesheet" type="text/css"> | |
6 </head><body> | 6 </head><body> |
7 <!-- Generated by Doxygen 1.5.6 --> | 7 <!-- Generated by Doxygen 1.5.8 --> |
8 <div class="navigation" id="top"> | 8 <div class="navigation" id="top"> |
9 <div class="tabs"> | 9 <div class="tabs"> |
10 <ul> | 10 <ul> |
11 <li><a href="main.html"><span>Main Page</span></a></li> | 11 <li><a href="main.html"><span>Main Page</span></a></li> |
12 <li><a href="namespaces.html"><span>Namespaces</span></a></li> | 12 <li><a href="namespaces.html"><span>Namespaces</span></a></li> |
13 <li><a href="annotated.html"><span>Classes</span></a></li> | 13 <li><a href="annotated.html"><span>Classes</span></a></li> |
14 <li class="current"><a href="files.html"><span>Files</span></a></li> | 14 <li class="current"><a href="files.html"><span>Files</span></a></li> |
15 <li><a href="dirs.html"><span>Directories</span></a></li> | 15 <li><a href="dirs.html"><span>Directories</span></a></li> |
16 </ul> | |
17 </div> | |
18 <div class="tabs"> | |
19 <ul> | |
20 <li><a href="files.html"><span>File List</span></a></li> | |
21 <li><a href="globals.html"><span>File Members</span></a></li> | |
16 </ul> | 22 </ul> |
17 </div> | 23 </div> |
18 <div class="navpath"><a class="el" href="dir_35887283b966ca996e4ff77f459c38ce.html">examples</a> | 24 <div class="navpath"><a class="el" href="dir_35887283b966ca996e4ff77f459c38ce.html">examples</a> |
19 </div> | 25 </div> |
20 </div> | 26 </div> |
129 <a name="l00108"></a><a class="code" href="classPowerSpectrum.html#6aac5f93e3a8c033026d739fed427242">00108</a> <a class="code" href="classPowerSpectrum.html#6aac5f93e3a8c033026d739fed427242" title="Get the outputs of this plugin.">PowerSpectrum::getOutputDescriptors</a>()<span class="keyword"> const</span> | 135 <a name="l00108"></a><a class="code" href="classPowerSpectrum.html#6aac5f93e3a8c033026d739fed427242">00108</a> <a class="code" href="classPowerSpectrum.html#6aac5f93e3a8c033026d739fed427242" title="Get the outputs of this plugin.">PowerSpectrum::getOutputDescriptors</a>()<span class="keyword"> const</span> |
130 <a name="l00109"></a>00109 <span class="keyword"></span>{ | 136 <a name="l00109"></a>00109 <span class="keyword"></span>{ |
131 <a name="l00110"></a>00110 <a class="code" href="classVamp_1_1Plugin.html#30f531b8fb69fac41a24e3d2a6a08ed9">OutputList</a> list; | 137 <a name="l00110"></a>00110 <a class="code" href="classVamp_1_1Plugin.html#30f531b8fb69fac41a24e3d2a6a08ed9">OutputList</a> list; |
132 <a name="l00111"></a>00111 | 138 <a name="l00111"></a>00111 |
133 <a name="l00112"></a>00112 <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html">OutputDescriptor</a> d; | 139 <a name="l00112"></a>00112 <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html">OutputDescriptor</a> d; |
134 <a name="l00113"></a>00113 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#e2c893ddb1860589517ab7eaa989a18b" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">"powerspectrum"</span>; | 140 <a name="l00113"></a>00113 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#2e6f77bcb12d4c95da25348ac85b8696" title="The name of the output, in computer-usable form.">identifier</a> = <span class="stringliteral">"powerspectrum"</span>; |
135 <a name="l00114"></a>00114 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#b824b2b34ee50f897a30901c620e8d87" title="The human-readable name of the output.">name</a> = <span class="stringliteral">"Power Spectrum"</span>; | 141 <a name="l00114"></a>00114 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#0992e05ea70425878365ba85663400a7" title="The human-readable name of the output.">name</a> = <span class="stringliteral">"Power Spectrum"</span>; |
136 <a name="l00115"></a>00115 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#f9b4fe8f78e7126ead820ba5dc55efd1" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">"Power values of the frequency spectrum bins calculated from the input signal"</span>; | 142 <a name="l00115"></a>00115 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#8b44602d8ccea8bb862fd766e74efa1c" title="A human-readable short text describing the output.">description</a> = <span class="stringliteral">"Power values of the frequency spectrum bins calculated from the input signal"</span>; |
137 <a name="l00116"></a>00116 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#a057a8833fa037f06ac9f7b85b85d5e4" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">""</span>; | 143 <a name="l00116"></a>00116 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#52f4b3d8d7070cc9c5ab4aa6ff0c01a0" title="The unit of the output, in human-readable form.">unit</a> = <span class="stringliteral">""</span>; |
138 <a name="l00117"></a>00117 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> = <span class="keyword">true</span>; | 144 <a name="l00117"></a>00117 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#0653d3a85fdc226e60fd5e612b399e0c" title="True if the output has the same number of values per sample for every output sample...">hasFixedBinCount</a> = <span class="keyword">true</span>; |
139 <a name="l00118"></a>00118 <span class="keywordflow">if</span> (<a class="code" href="classPowerSpectrum.html#399e997c033f26b07edb7cc83cd5a6d8">m_blockSize</a> == 0) { | 145 <a name="l00118"></a>00118 <span class="keywordflow">if</span> (<a class="code" href="classPowerSpectrum.html#399e997c033f26b07edb7cc83cd5a6d8">m_blockSize</a> == 0) { |
140 <a name="l00119"></a>00119 <span class="comment">// Just so as not to return "1". This is the bin count that</span> | 146 <a name="l00119"></a>00119 <span class="comment">// Just so as not to return "1". This is the bin count that</span> |
141 <a name="l00120"></a>00120 <span class="comment">// would result from a block size of 1024, which is a likely</span> | 147 <a name="l00120"></a>00120 <span class="comment">// would result from a block size of 1024, which is a likely</span> |
142 <a name="l00121"></a>00121 <span class="comment">// default -- but the host should always set the block size</span> | 148 <a name="l00121"></a>00121 <span class="comment">// default -- but the host should always set the block size</span> |
143 <a name="l00122"></a>00122 <span class="comment">// before querying the bin count for certain.</span> | 149 <a name="l00122"></a>00122 <span class="comment">// before querying the bin count for certain.</span> |
144 <a name="l00123"></a>00123 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#fdd006959a995e40ef7d565a3a4df6dc" title="The number of values per result of the output.">binCount</a> = 513; | 150 <a name="l00123"></a>00123 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#238a4781ebb4151832cbf521feb0fedc" title="The number of values per result of the output.">binCount</a> = 513; |
145 <a name="l00124"></a>00124 } <span class="keywordflow">else</span> { | 151 <a name="l00124"></a>00124 } <span class="keywordflow">else</span> { |
146 <a name="l00125"></a>00125 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#fdd006959a995e40ef7d565a3a4df6dc" title="The number of values per result of the output.">binCount</a> = <a class="code" href="classPowerSpectrum.html#399e997c033f26b07edb7cc83cd5a6d8">m_blockSize</a> / 2 + 1; | 152 <a name="l00125"></a>00125 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#238a4781ebb4151832cbf521feb0fedc" title="The number of values per result of the output.">binCount</a> = <a class="code" href="classPowerSpectrum.html#399e997c033f26b07edb7cc83cd5a6d8">m_blockSize</a> / 2 + 1; |
147 <a name="l00126"></a>00126 } | 153 <a name="l00126"></a>00126 } |
148 <a name="l00127"></a>00127 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> = <span class="keyword">false</span>; | 154 <a name="l00127"></a>00127 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#4b8d0d88bee613709e91b48402e28c8e" title="True if the results in each output bin fall within a fixed numeric range (minimum...">hasKnownExtents</a> = <span class="keyword">false</span>; |
149 <a name="l00128"></a>00128 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> = <span class="keyword">false</span>; | 155 <a name="l00128"></a>00128 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#43673cd31b2b65af427a8e8b8746b6e8" title="True if the output values are quantized to a particular resolution.">isQuantized</a> = <span class="keyword">false</span>; |
150 <a name="l00129"></a>00129 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&#39;s block start.">OutputDescriptor::OneSamplePerStep</a>; | 156 <a name="l00129"></a>00129 d.<a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#3cd2e0b7a6da19c32bbb6809a83d9adf" title="Positioning in time of the output results.">sampleType</a> = <a class="code" href="structVamp_1_1Plugin_1_1OutputDescriptor.html#bffa9ed50cd756df70fd51f0355f448c8915f78de285a79dd415e0c6012d1ead" title="Results from each process() align with that call&#39;s block start.">OutputDescriptor::OneSamplePerStep</a>; |
151 <a name="l00130"></a>00130 list.push_back(d); | 157 <a name="l00130"></a>00130 list.push_back(d); |
152 <a name="l00131"></a>00131 | 158 <a name="l00131"></a>00131 |
153 <a name="l00132"></a>00132 <span class="keywordflow">return</span> list; | 159 <a name="l00132"></a>00132 <span class="keywordflow">return</span> list; |
154 <a name="l00133"></a>00133 } | 160 <a name="l00133"></a>00133 } |
155 <a name="l00134"></a>00134 | 161 <a name="l00134"></a>00134 |
165 <a name="l00144"></a>00144 | 171 <a name="l00144"></a>00144 |
166 <a name="l00145"></a>00145 <span class="keywordtype">size_t</span> n = <a class="code" href="classPowerSpectrum.html#399e997c033f26b07edb7cc83cd5a6d8">m_blockSize</a> / 2 + 1; | 172 <a name="l00145"></a>00145 <span class="keywordtype">size_t</span> n = <a class="code" href="classPowerSpectrum.html#399e997c033f26b07edb7cc83cd5a6d8">m_blockSize</a> / 2 + 1; |
167 <a name="l00146"></a>00146 <span class="keyword">const</span> <span class="keywordtype">float</span> *fbuf = inputBuffers[0]; | 173 <a name="l00146"></a>00146 <span class="keyword">const</span> <span class="keywordtype">float</span> *fbuf = inputBuffers[0]; |
168 <a name="l00147"></a>00147 | 174 <a name="l00147"></a>00147 |
169 <a name="l00148"></a>00148 <a class="code" href="structVamp_1_1Plugin_1_1Feature.html">Feature</a> feature; | 175 <a name="l00148"></a>00148 <a class="code" href="structVamp_1_1Plugin_1_1Feature.html">Feature</a> feature; |
170 <a name="l00149"></a>00149 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#98907091d0b6a589720ae35ae588a82b" title="True if an output feature has its own timestamp.">hasTimestamp</a> = <span class="keyword">false</span>; | 176 <a name="l00149"></a>00149 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#116bb1b3420a067fc1290b75982fdf62" title="True if an output feature has its own timestamp.">hasTimestamp</a> = <span class="keyword">false</span>; |
171 <a name="l00150"></a>00150 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#60b9f3057386820dbcaec0eb1189ce71" title="Results for a single sample of this feature.">values</a>.reserve(n); <span class="comment">// optional</span> | 177 <a name="l00150"></a>00150 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#106162977cdc92a02146fcb5ed18a34d" title="Results for a single sample of this feature.">values</a>.reserve(n); <span class="comment">// optional</span> |
172 <a name="l00151"></a>00151 | 178 <a name="l00151"></a>00151 |
173 <a name="l00152"></a>00152 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < n; ++i) { | 179 <a name="l00152"></a>00152 <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i < n; ++i) { |
174 <a name="l00153"></a>00153 | 180 <a name="l00153"></a>00153 |
175 <a name="l00154"></a>00154 <span class="keywordtype">double</span> real = fbuf[i * 2]; | 181 <a name="l00154"></a>00154 <span class="keywordtype">double</span> real = fbuf[i * 2]; |
176 <a name="l00155"></a>00155 <span class="keywordtype">double</span> imag = fbuf[i * 2 + 1]; | 182 <a name="l00155"></a>00155 <span class="keywordtype">double</span> imag = fbuf[i * 2 + 1]; |
177 <a name="l00156"></a>00156 | 183 <a name="l00156"></a>00156 |
178 <a name="l00157"></a>00157 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(real * real + imag * imag); | 184 <a name="l00157"></a>00157 feature.<a class="code" href="structVamp_1_1Plugin_1_1Feature.html#106162977cdc92a02146fcb5ed18a34d" title="Results for a single sample of this feature.">values</a>.push_back(real * real + imag * imag); |
179 <a name="l00158"></a>00158 } | 185 <a name="l00158"></a>00158 } |
180 <a name="l00159"></a>00159 | 186 <a name="l00159"></a>00159 |
181 <a name="l00160"></a>00160 fs[0].push_back(feature); | 187 <a name="l00160"></a>00160 fs[0].push_back(feature); |
182 <a name="l00161"></a>00161 | 188 <a name="l00161"></a>00161 |
183 <a name="l00162"></a>00162 <span class="keywordflow">return</span> fs; | 189 <a name="l00162"></a>00162 <span class="keywordflow">return</span> fs; |
188 <a name="l00167"></a>00167 { | 194 <a name="l00167"></a>00167 { |
189 <a name="l00168"></a>00168 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a>(); | 195 <a name="l00168"></a>00168 <span class="keywordflow">return</span> <a class="code" href="classVamp_1_1Plugin.html#448fb57dc245d47923ec9eeaf9856c5f">FeatureSet</a>(); |
190 <a name="l00169"></a>00169 } | 196 <a name="l00169"></a>00169 } |
191 <a name="l00170"></a>00170 | 197 <a name="l00170"></a>00170 |
192 </pre></div></div> | 198 </pre></div></div> |
193 <hr size="1"><address style="text-align: right;"><small>Generated on Mon Dec 8 14:37:18 2008 for VampPluginSDK by | 199 <hr size="1"><address style="text-align: right;"><small>Generated on Thu Sep 24 13:40:13 2009 for VampPluginSDK by |
194 <a href="http://www.doxygen.org/index.html"> | 200 <a href="http://www.doxygen.org/index.html"> |
195 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> | 201 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> |
196 </body> | 202 </body> |
197 </html> | 203 </html> |