# HG changeset patch # User Chris Cannam # Date 1317736567 -3600 # Node ID 3c430ef1ed662f623db7004f90e95a38ecca332f # Parent 895ae8fffdb73f647f3e61258bae8dcf57527131 Add code docs from SDK 2.3 diff -r 895ae8fffdb7 -r 3c430ef1ed66 code-docs/AmplitudeFollower_8cpp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code-docs/AmplitudeFollower_8cpp.html Tue Oct 04 14:56:07 2011 +0100 @@ -0,0 +1,94 @@ + + +
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 This file copyright 2006 Dan Stowell. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #include "AmplitudeFollower.h" +00038 +00039 #include <cmath> +00040 +00041 #include <string> +00042 #include <vector> +00043 #include <iostream> +00044 +00045 using std::string; +00046 using std::vector; +00047 using std::cerr; +00048 using std::endl; +00049 +00055 AmplitudeFollower::AmplitudeFollower(float inputSampleRate) : +00056 Plugin(inputSampleRate), +00057 m_stepSize(0), +00058 m_previn(0.0f), +00059 m_clampcoef(0.01f), +00060 m_relaxcoef(0.01f) +00061 { +00062 } +00063 +00064 AmplitudeFollower::~AmplitudeFollower() +00065 { +00066 } +00067 +00068 string +00069 AmplitudeFollower::getIdentifier() const +00070 { +00071 return "amplitudefollower"; +00072 } +00073 +00074 string +00075 AmplitudeFollower::getName() const +00076 { +00077 return "Amplitude Follower"; +00078 } +00079 +00080 string +00081 AmplitudeFollower::getDescription() const +00082 { +00083 return "Track the amplitude of the audio signal"; +00084 } +00085 +00086 string +00087 AmplitudeFollower::getMaker() const +00088 { +00089 return "Vamp SDK Example Plugins"; +00090 } +00091 +00092 int +00093 AmplitudeFollower::getPluginVersion() const +00094 { +00095 return 1; +00096 } +00097 +00098 string +00099 AmplitudeFollower::getCopyright() const +00100 { +00101 return "Code copyright 2006 Dan Stowell; method from SuperCollider. Freely redistributable (BSD license)"; +00102 } +00103 +00104 bool +00105 AmplitudeFollower::initialise(size_t channels, size_t stepSize, size_t blockSize) +00106 { +00107 if (channels < getMinChannelCount() || +00108 channels > getMaxChannelCount()) return false; +00109 +00110 m_stepSize = std::min(stepSize, blockSize); +00111 +00112 // Translate the coefficients +00113 // from their "convenient" 60dB convergence-time values +00114 // to real coefficients +00115 m_clampcoef = m_clampcoef==0.0 ? 0.0 : exp(log(0.1)/(m_clampcoef * m_inputSampleRate)); +00116 m_relaxcoef = m_relaxcoef==0.0 ? 0.0 : exp(log(0.1)/(m_relaxcoef * m_inputSampleRate)); +00117 +00118 return true; +00119 } +00120 +00121 void +00122 AmplitudeFollower::reset() +00123 { +00124 m_previn = 0.0f; +00125 } +00126 +00127 AmplitudeFollower::OutputList +00128 AmplitudeFollower::getOutputDescriptors() const +00129 { +00130 OutputList list; +00131 +00132 OutputDescriptor sca; +00133 sca.identifier = "amplitude"; +00134 sca.name = "Amplitude"; +00135 sca.description = "The peak tracked amplitude for the current processing block"; +00136 sca.unit = "V"; +00137 sca.hasFixedBinCount = true; +00138 sca.binCount = 1; +00139 sca.hasKnownExtents = false; +00140 sca.isQuantized = false; +00141 sca.sampleType = OutputDescriptor::OneSamplePerStep; +00142 list.push_back(sca); +00143 +00144 return list; +00145 } +00146 +00147 AmplitudeFollower::ParameterList +00148 AmplitudeFollower::getParameterDescriptors() const +00149 { +00150 ParameterList list; +00151 +00152 ParameterDescriptor att; +00153 att.identifier = "attack"; +00154 att.name = "Attack time"; +00155 att.description = "The 60dB convergence time for an increase in amplitude"; +00156 att.unit = "s"; +00157 att.minValue = 0.0f; +00158 att.maxValue = 1.f; +00159 att.defaultValue = 0.01f; +00160 att.isQuantized = false; +00161 +00162 list.push_back(att); +00163 +00164 ParameterDescriptor dec; +00165 dec.identifier = "release"; +00166 dec.name = "Release time"; +00167 dec.description = "The 60dB convergence time for a decrease in amplitude"; +00168 dec.unit = "s"; +00169 dec.minValue = 0.0f; +00170 dec.maxValue = 1.f; +00171 dec.defaultValue = 0.01f; +00172 dec.isQuantized = false; +00173 +00174 list.push_back(dec); +00175 +00176 return list; +00177 } +00178 +00179 void AmplitudeFollower::setParameter(std::string paramid, float newval) +00180 { +00181 if (paramid == "attack") { +00182 m_clampcoef = newval; +00183 } else if (paramid == "release") { +00184 m_relaxcoef = newval; +00185 } +00186 } +00187 +00188 float AmplitudeFollower::getParameter(std::string paramid) const +00189 { +00190 if (paramid == "attack") { +00191 return m_clampcoef; +00192 } else if (paramid == "release") { +00193 return m_relaxcoef; +00194 } +00195 +00196 return 0.0f; +00197 } +00198 +00199 AmplitudeFollower::FeatureSet +00200 AmplitudeFollower::process(const float *const *inputBuffers, +00201 Vamp::RealTime timestamp) +00202 { +00203 if (m_stepSize == 0) { +00204 cerr << "ERROR: AmplitudeFollower::process: " +00205 << "AmplitudeFollower has not been initialised" +00206 << endl; +00207 return FeatureSet(); +00208 } +00209 +00210 float previn = m_previn; +00211 +00212 FeatureSet returnFeatures; +00213 +00214 float val; +00215 float peak = 0.0f; +00216 +00217 for (size_t i = 0; i < m_stepSize; ++i) { +00218 +00219 val = fabs(inputBuffers[0][i]); +00220 +00221 if (val < previn) { +00222 val = val + (previn - val) * m_relaxcoef; +00223 } else { +00224 val = val + (previn - val) * m_clampcoef; +00225 } +00226 +00227 if (val > peak) peak = val; +00228 previn = val; +00229 } +00230 +00231 m_previn = previn; +00232 +00233 // Now store the "feature" (peak amp) for this sample +00234 Feature feature; +00235 feature.hasTimestamp = false; +00236 feature.values.push_back(peak); +00237 returnFeatures[0].push_back(feature); +00238 +00239 return returnFeatures; +00240 } +00241 +00242 AmplitudeFollower::FeatureSet +00243 AmplitudeFollower::getRemainingFeatures() +00244 { +00245 return FeatureSet(); +00246 } +00247 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | AmplitudeFollower |
Example plugin implementing the SuperCollider amplitude follower function. More... |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 This file copyright 2006 Dan Stowell. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _AMPLITUDE_FOLLOWER_PLUGIN_H_ +00038 #define _AMPLITUDE_FOLLOWER_PLUGIN_H_ +00039 +00040 #include "vamp-sdk/Plugin.h" +00041 +00047 class AmplitudeFollower : public Vamp::Plugin +00048 { +00049 public: +00050 AmplitudeFollower(float inputSampleRate); +00051 virtual ~AmplitudeFollower(); +00052 +00053 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00054 void reset(); +00055 +00056 InputDomain getInputDomain() const { return TimeDomain; } +00057 +00058 std::string getIdentifier() const; +00059 std::string getName() const; +00060 std::string getDescription() const; +00061 std::string getMaker() const; +00062 int getPluginVersion() const; +00063 std::string getCopyright() const; +00064 +00065 OutputList getOutputDescriptors() const; +00066 +00067 ParameterList getParameterDescriptors() const; +00068 float getParameter(std::string paramid) const; +00069 void setParameter(std::string paramid, float newval); +00070 +00071 FeatureSet process(const float *const *inputBuffers, +00072 Vamp::RealTime timestamp); +00073 +00074 FeatureSet getRemainingFeatures(); +00075 +00076 protected: +00077 size_t m_stepSize; +00078 float m_previn; +00079 float m_clampcoef; +00080 float m_relaxcoef; +00081 }; +00082 +00083 +00084 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | FixedTempoEstimator::D |
+Variables | |
static int | TempoOutput = 0 |
static int | CandidatesOutput = 1 |
static int | DFOutput = 2 |
static int | ACFOutput = 3 |
static int | FilteredACFOutput = 4 |
int TempoOutput = 0 [static] |
+
Definition at line 183 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures().
+ +int CandidatesOutput = 1 [static] |
+
Definition at line 184 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures().
+ +int DFOutput = 2 [static] |
+
Definition at line 185 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures().
+ +int ACFOutput = 3 [static] |
+
Definition at line 186 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures().
+ +int FilteredACFOutput = 4 [static] |
+
Definition at line 187 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #include "FixedTempoEstimator.h" +00038 +00039 using std::string; +00040 using std::vector; +00041 using std::cerr; +00042 using std::endl; +00043 +00044 using Vamp::RealTime; +00045 +00046 #include <cmath> +00047 #include <cstdio> +00048 +00049 +00050 class FixedTempoEstimator::D +00051 // this class just avoids us having to declare any data members in the header +00052 { +00053 public: +00054 D(float inputSampleRate); +00055 ~D(); +00056 +00057 size_t getPreferredStepSize() const { return 64; } +00058 size_t getPreferredBlockSize() const { return 256; } +00059 +00060 ParameterList getParameterDescriptors() const; +00061 float getParameter(string id) const; +00062 void setParameter(string id, float value); +00063 +00064 OutputList getOutputDescriptors() const; +00065 +00066 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00067 void reset(); +00068 FeatureSet process(const float *const *, RealTime); +00069 FeatureSet getRemainingFeatures(); +00070 +00071 private: +00072 void calculate(); +00073 FeatureSet assembleFeatures(); +00074 +00075 float lag2tempo(int); +00076 int tempo2lag(float); +00077 +00078 float m_inputSampleRate; +00079 size_t m_stepSize; +00080 size_t m_blockSize; +00081 +00082 float m_minbpm; +00083 float m_maxbpm; +00084 float m_maxdflen; +00085 +00086 float *m_priorMagnitudes; +00087 +00088 size_t m_dfsize; +00089 float *m_df; +00090 float *m_r; +00091 float *m_fr; +00092 float *m_t; +00093 size_t m_n; +00094 +00095 Vamp::RealTime m_start; +00096 Vamp::RealTime m_lasttime; +00097 }; +00098 +00099 FixedTempoEstimator::D::D(float inputSampleRate) : +00100 m_inputSampleRate(inputSampleRate), +00101 m_stepSize(0), +00102 m_blockSize(0), +00103 m_minbpm(50), +00104 m_maxbpm(190), +00105 m_maxdflen(10), +00106 m_priorMagnitudes(0), +00107 m_df(0), +00108 m_r(0), +00109 m_fr(0), +00110 m_t(0), +00111 m_n(0) +00112 { +00113 } +00114 +00115 FixedTempoEstimator::D::~D() +00116 { +00117 delete[] m_priorMagnitudes; +00118 delete[] m_df; +00119 delete[] m_r; +00120 delete[] m_fr; +00121 delete[] m_t; +00122 } +00123 +00124 FixedTempoEstimator::ParameterList +00125 FixedTempoEstimator::D::getParameterDescriptors() const +00126 { +00127 ParameterList list; +00128 +00129 ParameterDescriptor d; +00130 d.identifier = "minbpm"; +00131 d.name = "Minimum estimated tempo"; +00132 d.description = "Minimum beat-per-minute value which the tempo estimator is able to return"; +00133 d.unit = "bpm"; +00134 d.minValue = 10; +00135 d.maxValue = 360; +00136 d.defaultValue = 50; +00137 d.isQuantized = false; +00138 list.push_back(d); +00139 +00140 d.identifier = "maxbpm"; +00141 d.name = "Maximum estimated tempo"; +00142 d.description = "Maximum beat-per-minute value which the tempo estimator is able to return"; +00143 d.defaultValue = 190; +00144 list.push_back(d); +00145 +00146 d.identifier = "maxdflen"; +00147 d.name = "Input duration to study"; +00148 d.description = "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."; +00149 d.unit = "s"; +00150 d.minValue = 2; +00151 d.maxValue = 40; +00152 d.defaultValue = 10; +00153 list.push_back(d); +00154 +00155 return list; +00156 } +00157 +00158 float +00159 FixedTempoEstimator::D::getParameter(string id) const +00160 { +00161 if (id == "minbpm") { +00162 return m_minbpm; +00163 } else if (id == "maxbpm") { +00164 return m_maxbpm; +00165 } else if (id == "maxdflen") { +00166 return m_maxdflen; +00167 } +00168 return 0.f; +00169 } +00170 +00171 void +00172 FixedTempoEstimator::D::setParameter(string id, float value) +00173 { +00174 if (id == "minbpm") { +00175 m_minbpm = value; +00176 } else if (id == "maxbpm") { +00177 m_maxbpm = value; +00178 } else if (id == "maxdflen") { +00179 m_maxdflen = value; +00180 } +00181 } +00182 +00183 static int TempoOutput = 0; +00184 static int CandidatesOutput = 1; +00185 static int DFOutput = 2; +00186 static int ACFOutput = 3; +00187 static int FilteredACFOutput = 4; +00188 +00189 FixedTempoEstimator::OutputList +00190 FixedTempoEstimator::D::getOutputDescriptors() const +00191 { +00192 OutputList list; +00193 +00194 OutputDescriptor d; +00195 d.identifier = "tempo"; +00196 d.name = "Tempo"; +00197 d.description = "Estimated tempo"; +00198 d.unit = "bpm"; +00199 d.hasFixedBinCount = true; +00200 d.binCount = 1; +00201 d.hasKnownExtents = false; +00202 d.isQuantized = false; +00203 d.sampleType = OutputDescriptor::VariableSampleRate; +00204 d.sampleRate = m_inputSampleRate; +00205 d.hasDuration = true; // our returned tempo spans a certain range +00206 list.push_back(d); +00207 +00208 d.identifier = "candidates"; +00209 d.name = "Tempo candidates"; +00210 d.description = "Possible tempo estimates, one per bin with the most likely in the first bin"; +00211 d.unit = "bpm"; +00212 d.hasFixedBinCount = false; +00213 list.push_back(d); +00214 +00215 d.identifier = "detectionfunction"; +00216 d.name = "Detection Function"; +00217 d.description = "Onset detection function"; +00218 d.unit = ""; +00219 d.hasFixedBinCount = 1; +00220 d.binCount = 1; +00221 d.hasKnownExtents = true; +00222 d.minValue = 0.0; +00223 d.maxValue = 1.0; +00224 d.isQuantized = false; +00225 d.quantizeStep = 0.0; +00226 d.sampleType = OutputDescriptor::FixedSampleRate; +00227 if (m_stepSize) { +00228 d.sampleRate = m_inputSampleRate / m_stepSize; +00229 } else { +00230 d.sampleRate = m_inputSampleRate / (getPreferredBlockSize()/2); +00231 } +00232 d.hasDuration = false; +00233 list.push_back(d); +00234 +00235 d.identifier = "acf"; +00236 d.name = "Autocorrelation Function"; +00237 d.description = "Autocorrelation of onset detection function"; +00238 d.hasKnownExtents = false; +00239 d.unit = "r"; +00240 list.push_back(d); +00241 +00242 d.identifier = "filtered_acf"; +00243 d.name = "Filtered Autocorrelation"; +00244 d.description = "Filtered autocorrelation of onset detection function"; +00245 d.unit = "r"; +00246 list.push_back(d); +00247 +00248 return list; +00249 } +00250 +00251 bool +00252 FixedTempoEstimator::D::initialise(size_t, size_t stepSize, size_t blockSize) +00253 { +00254 m_stepSize = stepSize; +00255 m_blockSize = blockSize; +00256 +00257 float dfLengthSecs = m_maxdflen; +00258 m_dfsize = (dfLengthSecs * m_inputSampleRate) / m_stepSize; +00259 +00260 m_priorMagnitudes = new float[m_blockSize/2]; +00261 m_df = new float[m_dfsize]; +00262 +00263 for (size_t i = 0; i < m_blockSize/2; ++i) { +00264 m_priorMagnitudes[i] = 0.f; +00265 } +00266 for (size_t i = 0; i < m_dfsize; ++i) { +00267 m_df[i] = 0.f; +00268 } +00269 +00270 m_n = 0; +00271 +00272 return true; +00273 } +00274 +00275 void +00276 FixedTempoEstimator::D::reset() +00277 { +00278 if (!m_priorMagnitudes) return; +00279 +00280 for (size_t i = 0; i < m_blockSize/2; ++i) { +00281 m_priorMagnitudes[i] = 0.f; +00282 } +00283 for (size_t i = 0; i < m_dfsize; ++i) { +00284 m_df[i] = 0.f; +00285 } +00286 +00287 delete[] m_r; +00288 m_r = 0; +00289 +00290 delete[] m_fr; +00291 m_fr = 0; +00292 +00293 delete[] m_t; +00294 m_t = 0; +00295 +00296 m_n = 0; +00297 +00298 m_start = RealTime::zeroTime; +00299 m_lasttime = RealTime::zeroTime; +00300 } +00301 +00302 FixedTempoEstimator::FeatureSet +00303 FixedTempoEstimator::D::process(const float *const *inputBuffers, RealTime ts) +00304 { +00305 FeatureSet fs; +00306 +00307 if (m_stepSize == 0) { +00308 cerr << "ERROR: FixedTempoEstimator::process: " +00309 << "FixedTempoEstimator has not been initialised" +00310 << endl; +00311 return fs; +00312 } +00313 +00314 if (m_n == 0) m_start = ts; +00315 m_lasttime = ts; +00316 +00317 if (m_n == m_dfsize) { +00318 // If we have seen enough input, do the estimation and return +00319 calculate(); +00320 fs = assembleFeatures(); +00321 ++m_n; +00322 return fs; +00323 } +00324 +00325 // If we have seen more than enough, just discard and return! +00326 if (m_n > m_dfsize) return FeatureSet(); +00327 +00328 float value = 0.f; +00329 +00330 // m_df will contain an onset detection function based on the rise +00331 // in overall power from one spectral frame to the next -- +00332 // simplistic but reasonably effective for our purposes. +00333 +00334 for (size_t i = 1; i < m_blockSize/2; ++i) { +00335 +00336 float real = inputBuffers[0][i*2]; +00337 float imag = inputBuffers[0][i*2 + 1]; +00338 +00339 float sqrmag = real * real + imag * imag; +00340 value += fabsf(sqrmag - m_priorMagnitudes[i]); +00341 +00342 m_priorMagnitudes[i] = sqrmag; +00343 } +00344 +00345 m_df[m_n] = value; +00346 +00347 ++m_n; +00348 return fs; +00349 } +00350 +00351 FixedTempoEstimator::FeatureSet +00352 FixedTempoEstimator::D::getRemainingFeatures() +00353 { +00354 FeatureSet fs; +00355 if (m_n > m_dfsize) return fs; +00356 calculate(); +00357 fs = assembleFeatures(); +00358 ++m_n; +00359 return fs; +00360 } +00361 +00362 float +00363 FixedTempoEstimator::D::lag2tempo(int lag) +00364 { +00365 return 60.f / ((lag * m_stepSize) / m_inputSampleRate); +00366 } +00367 +00368 int +00369 FixedTempoEstimator::D::tempo2lag(float tempo) +00370 { +00371 return ((60.f / tempo) * m_inputSampleRate) / m_stepSize; +00372 } +00373 +00374 void +00375 FixedTempoEstimator::D::calculate() +00376 { +00377 if (m_r) { +00378 cerr << "FixedTempoEstimator::calculate: calculation already happened?" << endl; +00379 return; +00380 } +00381 +00382 if (m_n < m_dfsize / 9 && +00383 m_n < (1.0 * m_inputSampleRate) / m_stepSize) { // 1 second +00384 cerr << "FixedTempoEstimator::calculate: Input is too short" << endl; +00385 return; +00386 } +00387 +00388 // This function takes m_df (the detection function array filled +00389 // out in process()) and calculates m_r (the raw autocorrelation) +00390 // and m_fr (the filtered autocorrelation from whose peaks tempo +00391 // estimates will be taken). +00392 +00393 int n = m_n; // length of actual df array (m_dfsize is the theoretical max) +00394 +00395 m_r = new float[n/2]; // raw autocorrelation +00396 m_fr = new float[n/2]; // filtered autocorrelation +00397 m_t = new float[n/2]; // averaged tempo estimate for each lag value +00398 +00399 for (int i = 0; i < n/2; ++i) { +00400 m_r[i] = 0.f; +00401 m_fr[i] = 0.f; +00402 m_t[i] = lag2tempo(i); +00403 } +00404 +00405 // Calculate the raw autocorrelation of the detection function +00406 +00407 for (int i = 0; i < n/2; ++i) { +00408 +00409 for (int j = i; j < n; ++j) { +00410 m_r[i] += m_df[j] * m_df[j - i]; +00411 } +00412 +00413 m_r[i] /= n - i - 1; +00414 } +00415 +00416 // Filter the autocorrelation and average out the tempo estimates +00417 +00418 float related[] = { 0.5, 2, 4, 8 }; +00419 +00420 for (int i = 1; i < n/2-1; ++i) { +00421 +00422 m_fr[i] = m_r[i]; +00423 +00424 int div = 1; +00425 +00426 for (int j = 0; j < int(sizeof(related)/sizeof(related[0])); ++j) { +00427 +00428 // Check for an obvious peak at each metrically related lag +00429 +00430 int k0 = int(i * related[j] + 0.5); +00431 +00432 if (k0 >= 0 && k0 < int(n/2)) { +00433 +00434 int kmax = 0, kmin = 0; +00435 float kvmax = 0, kvmin = 0; +00436 bool have = false; +00437 +00438 for (int k = k0 - 1; k <= k0 + 1; ++k) { +00439 +00440 if (k < 0 || k >= n/2) continue; +00441 +00442 if (!have || (m_r[k] > kvmax)) { kmax = k; kvmax = m_r[k]; } +00443 if (!have || (m_r[k] < kvmin)) { kmin = k; kvmin = m_r[k]; } +00444 +00445 have = true; +00446 } +00447 +00448 // Boost the original lag according to the strongest +00449 // value found close to this related lag +00450 +00451 m_fr[i] += m_r[kmax] / 5; +00452 +00453 if ((kmax == 0 || m_r[kmax] > m_r[kmax-1]) && +00454 (kmax == n/2-1 || m_r[kmax] > m_r[kmax+1]) && +00455 kvmax > kvmin * 1.05) { +00456 +00457 // The strongest value close to the related lag is +00458 // also a pretty good looking peak, so use it to +00459 // improve our tempo estimate for the original lag +00460 +00461 m_t[i] = m_t[i] + lag2tempo(kmax) * related[j]; +00462 ++div; +00463 } +00464 } +00465 } +00466 +00467 m_t[i] /= div; +00468 +00469 // Finally apply a primitive perceptual weighting (to prefer +00470 // tempi of around 120-130) +00471 +00472 float weight = 1.f - fabsf(128.f - lag2tempo(i)) * 0.005; +00473 if (weight < 0.f) weight = 0.f; +00474 weight = weight * weight * weight; +00475 +00476 m_fr[i] += m_fr[i] * (weight / 3); +00477 } +00478 } +00479 +00480 FixedTempoEstimator::FeatureSet +00481 FixedTempoEstimator::D::assembleFeatures() +00482 { +00483 FeatureSet fs; +00484 if (!m_r) return fs; // No autocorrelation: no results +00485 +00486 Feature feature; +00487 feature.hasTimestamp = true; +00488 feature.hasDuration = false; +00489 feature.label = ""; +00490 feature.values.clear(); +00491 feature.values.push_back(0.f); +00492 +00493 char buffer[40]; +00494 +00495 int n = m_n; +00496 +00497 for (int i = 0; i < n; ++i) { +00498 +00499 // Return the detection function in the DF output +00500 +00501 feature.timestamp = m_start + +00502 RealTime::frame2RealTime(i * m_stepSize, m_inputSampleRate); +00503 feature.values[0] = m_df[i]; +00504 feature.label = ""; +00505 fs[DFOutput].push_back(feature); +00506 } +00507 +00508 for (int i = 1; i < n/2; ++i) { +00509 +00510 // Return the raw autocorrelation in the ACF output, each +00511 // value labelled according to its corresponding tempo +00512 +00513 feature.timestamp = m_start + +00514 RealTime::frame2RealTime(i * m_stepSize, m_inputSampleRate); +00515 feature.values[0] = m_r[i]; +00516 sprintf(buffer, "%.1f bpm", lag2tempo(i)); +00517 if (i == n/2-1) feature.label = ""; +00518 else feature.label = buffer; +00519 fs[ACFOutput].push_back(feature); +00520 } +00521 +00522 float t0 = m_minbpm; // our minimum detected tempo +00523 float t1 = m_maxbpm; // our maximum detected tempo +00524 +00525 int p0 = tempo2lag(t1); +00526 int p1 = tempo2lag(t0); +00527 +00528 std::map<float, int> candidates; +00529 +00530 for (int i = p0; i <= p1 && i+1 < n/2; ++i) { +00531 +00532 if (m_fr[i] > m_fr[i-1] && +00533 m_fr[i] > m_fr[i+1]) { +00534 +00535 // This is a peak in the filtered autocorrelation: stick +00536 // it into the map from filtered autocorrelation to lag +00537 // index -- this sorts our peaks by filtered acf value +00538 +00539 candidates[m_fr[i]] = i; +00540 } +00541 +00542 // Also return the filtered autocorrelation in its own output +00543 +00544 feature.timestamp = m_start + +00545 RealTime::frame2RealTime(i * m_stepSize, m_inputSampleRate); +00546 feature.values[0] = m_fr[i]; +00547 sprintf(buffer, "%.1f bpm", lag2tempo(i)); +00548 if (i == p1 || i == n/2-2) feature.label = ""; +00549 else feature.label = buffer; +00550 fs[FilteredACFOutput].push_back(feature); +00551 } +00552 +00553 if (candidates.empty()) { +00554 cerr << "No tempo candidates!" << endl; +00555 return fs; +00556 } +00557 +00558 feature.hasTimestamp = true; +00559 feature.timestamp = m_start; +00560 +00561 feature.hasDuration = true; +00562 feature.duration = m_lasttime - m_start; +00563 +00564 // The map contains only peaks and is sorted by filtered acf +00565 // value, so the final element in it is our "best" tempo guess +00566 +00567 std::map<float, int>::const_iterator ci = candidates.end(); +00568 --ci; +00569 int maxpi = ci->second; +00570 +00571 if (m_t[maxpi] > 0) { +00572 +00573 // This lag has an adjusted tempo from the averaging process: +00574 // use it +00575 +00576 feature.values[0] = m_t[maxpi]; +00577 +00578 } else { +00579 +00580 // shouldn't happen -- it would imply that this high value was +00581 // not a peak! +00582 +00583 feature.values[0] = lag2tempo(maxpi); +00584 cerr << "WARNING: No stored tempo for index " << maxpi << endl; +00585 } +00586 +00587 sprintf(buffer, "%.1f bpm", feature.values[0]); +00588 feature.label = buffer; +00589 +00590 // Return the best tempo in the main output +00591 +00592 fs[TempoOutput].push_back(feature); +00593 +00594 // And return the other estimates (up to the arbitrarily chosen +00595 // number of 10 of them) in the candidates output +00596 +00597 feature.values.clear(); +00598 feature.label = ""; +00599 +00600 while (feature.values.size() < 10) { +00601 if (m_t[ci->second] > 0) { +00602 feature.values.push_back(m_t[ci->second]); +00603 } else { +00604 feature.values.push_back(lag2tempo(ci->second)); +00605 } +00606 if (ci == candidates.begin()) break; +00607 --ci; +00608 } +00609 +00610 fs[CandidatesOutput].push_back(feature); +00611 +00612 return fs; +00613 } +00614 +00615 +00616 +00617 FixedTempoEstimator::FixedTempoEstimator(float inputSampleRate) : +00618 Plugin(inputSampleRate), +00619 m_d(new D(inputSampleRate)) +00620 { +00621 } +00622 +00623 FixedTempoEstimator::~FixedTempoEstimator() +00624 { +00625 delete m_d; +00626 } +00627 +00628 string +00629 FixedTempoEstimator::getIdentifier() const +00630 { +00631 return "fixedtempo"; +00632 } +00633 +00634 string +00635 FixedTempoEstimator::getName() const +00636 { +00637 return "Simple Fixed Tempo Estimator"; +00638 } +00639 +00640 string +00641 FixedTempoEstimator::getDescription() const +00642 { +00643 return "Study a short section of audio and estimate its tempo, assuming the tempo is constant"; +00644 } +00645 +00646 string +00647 FixedTempoEstimator::getMaker() const +00648 { +00649 return "Vamp SDK Example Plugins"; +00650 } +00651 +00652 int +00653 FixedTempoEstimator::getPluginVersion() const +00654 { +00655 return 1; +00656 } +00657 +00658 string +00659 FixedTempoEstimator::getCopyright() const +00660 { +00661 return "Code copyright 2008 Queen Mary, University of London. Freely redistributable (BSD license)"; +00662 } +00663 +00664 size_t +00665 FixedTempoEstimator::getPreferredStepSize() const +00666 { +00667 return m_d->getPreferredStepSize(); +00668 } +00669 +00670 size_t +00671 FixedTempoEstimator::getPreferredBlockSize() const +00672 { +00673 return m_d->getPreferredBlockSize(); +00674 } +00675 +00676 bool +00677 FixedTempoEstimator::initialise(size_t channels, size_t stepSize, size_t blockSize) +00678 { +00679 if (channels < getMinChannelCount() || +00680 channels > getMaxChannelCount()) return false; +00681 +00682 return m_d->initialise(channels, stepSize, blockSize); +00683 } +00684 +00685 void +00686 FixedTempoEstimator::reset() +00687 { +00688 return m_d->reset(); +00689 } +00690 +00691 FixedTempoEstimator::ParameterList +00692 FixedTempoEstimator::getParameterDescriptors() const +00693 { +00694 return m_d->getParameterDescriptors(); +00695 } +00696 +00697 float +00698 FixedTempoEstimator::getParameter(std::string id) const +00699 { +00700 return m_d->getParameter(id); +00701 } +00702 +00703 void +00704 FixedTempoEstimator::setParameter(std::string id, float value) +00705 { +00706 m_d->setParameter(id, value); +00707 } +00708 +00709 FixedTempoEstimator::OutputList +00710 FixedTempoEstimator::getOutputDescriptors() const +00711 { +00712 return m_d->getOutputDescriptors(); +00713 } +00714 +00715 FixedTempoEstimator::FeatureSet +00716 FixedTempoEstimator::process(const float *const *inputBuffers, RealTime ts) +00717 { +00718 return m_d->process(inputBuffers, ts); +00719 } +00720 +00721 FixedTempoEstimator::FeatureSet +00722 FixedTempoEstimator::getRemainingFeatures() +00723 { +00724 return m_d->getRemainingFeatures(); +00725 } +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | FixedTempoEstimator |
Example plugin that estimates the tempo of a short fixed-tempo sample. More... |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _FIXED_TEMPO_ESTIMATOR_PLUGIN_H_ +00038 #define _FIXED_TEMPO_ESTIMATOR_PLUGIN_H_ +00039 +00040 #include "vamp-sdk/Plugin.h" +00041 +00046 class FixedTempoEstimator : public Vamp::Plugin +00047 { +00048 public: +00049 FixedTempoEstimator(float inputSampleRate); +00050 virtual ~FixedTempoEstimator(); +00051 +00052 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00053 void reset(); +00054 +00055 InputDomain getInputDomain() const { return FrequencyDomain; } +00056 +00057 std::string getIdentifier() const; +00058 std::string getName() const; +00059 std::string getDescription() const; +00060 std::string getMaker() const; +00061 int getPluginVersion() const; +00062 std::string getCopyright() const; +00063 +00064 size_t getPreferredStepSize() const; +00065 size_t getPreferredBlockSize() const; +00066 +00067 ParameterList getParameterDescriptors() const; +00068 float getParameter(std::string id) const; +00069 void setParameter(std::string id, float value); +00070 +00071 OutputList getOutputDescriptors() const; +00072 +00073 FeatureSet process(const float *const *inputBuffers, +00074 Vamp::RealTime timestamp); +00075 +00076 FeatureSet getRemainingFeatures(); +00077 +00078 protected: +00079 class D; +00080 D *m_d; +00081 }; +00082 +00083 +00084 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #include "PercussionOnsetDetector.h" +00038 +00039 using std::string; +00040 using std::vector; +00041 using std::cerr; +00042 using std::endl; +00043 +00044 #include <cmath> +00045 +00046 +00047 PercussionOnsetDetector::PercussionOnsetDetector(float inputSampleRate) : +00048 Plugin(inputSampleRate), +00049 m_stepSize(0), +00050 m_blockSize(0), +00051 m_threshold(3), +00052 m_sensitivity(40), +00053 m_priorMagnitudes(0), +00054 m_dfMinus1(0), +00055 m_dfMinus2(0) +00056 { +00057 } +00058 +00059 PercussionOnsetDetector::~PercussionOnsetDetector() +00060 { +00061 delete[] m_priorMagnitudes; +00062 } +00063 +00064 string +00065 PercussionOnsetDetector::getIdentifier() const +00066 { +00067 return "percussiononsets"; +00068 } +00069 +00070 string +00071 PercussionOnsetDetector::getName() const +00072 { +00073 return "Simple Percussion Onset Detector"; +00074 } +00075 +00076 string +00077 PercussionOnsetDetector::getDescription() const +00078 { +00079 return "Detect percussive note onsets by identifying broadband energy rises"; +00080 } +00081 +00082 string +00083 PercussionOnsetDetector::getMaker() const +00084 { +00085 return "Vamp SDK Example Plugins"; +00086 } +00087 +00088 int +00089 PercussionOnsetDetector::getPluginVersion() const +00090 { +00091 return 2; +00092 } +00093 +00094 string +00095 PercussionOnsetDetector::getCopyright() const +00096 { +00097 return "Code copyright 2006 Queen Mary, University of London, after Dan Barry et al 2005. Freely redistributable (BSD license)"; +00098 } +00099 +00100 size_t +00101 PercussionOnsetDetector::getPreferredStepSize() const +00102 { +00103 return 0; +00104 } +00105 +00106 size_t +00107 PercussionOnsetDetector::getPreferredBlockSize() const +00108 { +00109 return 1024; +00110 } +00111 +00112 bool +00113 PercussionOnsetDetector::initialise(size_t channels, size_t stepSize, size_t blockSize) +00114 { +00115 if (channels < getMinChannelCount() || +00116 channels > getMaxChannelCount()) return false; +00117 +00118 m_stepSize = stepSize; +00119 m_blockSize = blockSize; +00120 +00121 m_priorMagnitudes = new float[m_blockSize/2]; +00122 +00123 for (size_t i = 0; i < m_blockSize/2; ++i) { +00124 m_priorMagnitudes[i] = 0.f; +00125 } +00126 +00127 m_dfMinus1 = 0.f; +00128 m_dfMinus2 = 0.f; +00129 +00130 return true; +00131 } +00132 +00133 void +00134 PercussionOnsetDetector::reset() +00135 { +00136 for (size_t i = 0; i < m_blockSize/2; ++i) { +00137 m_priorMagnitudes[i] = 0.f; +00138 } +00139 +00140 m_dfMinus1 = 0.f; +00141 m_dfMinus2 = 0.f; +00142 } +00143 +00144 PercussionOnsetDetector::ParameterList +00145 PercussionOnsetDetector::getParameterDescriptors() const +00146 { +00147 ParameterList list; +00148 +00149 ParameterDescriptor d; +00150 d.identifier = "threshold"; +00151 d.name = "Energy rise threshold"; +00152 d.description = "Energy rise within a frequency bin necessary to count toward broadband total"; +00153 d.unit = "dB"; +00154 d.minValue = 0; +00155 d.maxValue = 20; +00156 d.defaultValue = 3; +00157 d.isQuantized = false; +00158 list.push_back(d); +00159 +00160 d.identifier = "sensitivity"; +00161 d.name = "Sensitivity"; +00162 d.description = "Sensitivity of peak detector applied to broadband detection function"; +00163 d.unit = "%"; +00164 d.minValue = 0; +00165 d.maxValue = 100; +00166 d.defaultValue = 40; +00167 d.isQuantized = false; +00168 list.push_back(d); +00169 +00170 return list; +00171 } +00172 +00173 float +00174 PercussionOnsetDetector::getParameter(std::string id) const +00175 { +00176 if (id == "threshold") return m_threshold; +00177 if (id == "sensitivity") return m_sensitivity; +00178 return 0.f; +00179 } +00180 +00181 void +00182 PercussionOnsetDetector::setParameter(std::string id, float value) +00183 { +00184 if (id == "threshold") { +00185 if (value < 0) value = 0; +00186 if (value > 20) value = 20; +00187 m_threshold = value; +00188 } else if (id == "sensitivity") { +00189 if (value < 0) value = 0; +00190 if (value > 100) value = 100; +00191 m_sensitivity = value; +00192 } +00193 } +00194 +00195 PercussionOnsetDetector::OutputList +00196 PercussionOnsetDetector::getOutputDescriptors() const +00197 { +00198 OutputList list; +00199 +00200 OutputDescriptor d; +00201 d.identifier = "onsets"; +00202 d.name = "Onsets"; +00203 d.description = "Percussive note onset locations"; +00204 d.unit = ""; +00205 d.hasFixedBinCount = true; +00206 d.binCount = 0; +00207 d.hasKnownExtents = false; +00208 d.isQuantized = false; +00209 d.sampleType = OutputDescriptor::VariableSampleRate; +00210 d.sampleRate = m_inputSampleRate; +00211 list.push_back(d); +00212 +00213 d.identifier = "detectionfunction"; +00214 d.name = "Detection Function"; +00215 d.description = "Broadband energy rise detection function"; +00216 d.binCount = 1; +00217 d.isQuantized = true; +00218 d.quantizeStep = 1.0; +00219 d.sampleType = OutputDescriptor::OneSamplePerStep; +00220 list.push_back(d); +00221 +00222 return list; +00223 } +00224 +00225 PercussionOnsetDetector::FeatureSet +00226 PercussionOnsetDetector::process(const float *const *inputBuffers, +00227 Vamp::RealTime ts) +00228 { +00229 if (m_stepSize == 0) { +00230 cerr << "ERROR: PercussionOnsetDetector::process: " +00231 << "PercussionOnsetDetector has not been initialised" +00232 << endl; +00233 return FeatureSet(); +00234 } +00235 +00236 int count = 0; +00237 +00238 for (size_t i = 1; i < m_blockSize/2; ++i) { +00239 +00240 float real = inputBuffers[0][i*2]; +00241 float imag = inputBuffers[0][i*2 + 1]; +00242 +00243 float sqrmag = real * real + imag * imag; +00244 +00245 if (m_priorMagnitudes[i] > 0.f) { +00246 float diff = 10.f * log10f(sqrmag / m_priorMagnitudes[i]); +00247 +00248 // std::cout << "i=" << i << ", sqrmag=" << sqrmag << ", prior=" << m_priorMagnitudes[i] << ", diff=" << diff << ", threshold=" << m_threshold << " " << (diff >= m_threshold ? "[*]" : "") << std::endl; +00249 +00250 if (diff >= m_threshold) ++count; +00251 } +00252 +00253 m_priorMagnitudes[i] = sqrmag; +00254 } +00255 +00256 FeatureSet returnFeatures; +00257 +00258 Feature detectionFunction; +00259 detectionFunction.hasTimestamp = false; +00260 detectionFunction.values.push_back(count); +00261 returnFeatures[1].push_back(detectionFunction); +00262 +00263 if (m_dfMinus2 < m_dfMinus1 && +00264 m_dfMinus1 >= count && +00265 m_dfMinus1 > ((100 - m_sensitivity) * m_blockSize) / 200) { +00266 +00267 //std::cout << "result at " << ts << "! (count == " << count << ", prev == " << m_dfMinus1 << ")" << std::endl; +00268 +00269 Feature onset; +00270 onset.hasTimestamp = true; +00271 onset.timestamp = ts - Vamp::RealTime::frame2RealTime +00272 (m_stepSize, int(m_inputSampleRate + 0.5)); +00273 returnFeatures[0].push_back(onset); +00274 } +00275 +00276 m_dfMinus2 = m_dfMinus1; +00277 m_dfMinus1 = count; +00278 +00279 return returnFeatures; +00280 } +00281 +00282 PercussionOnsetDetector::FeatureSet +00283 PercussionOnsetDetector::getRemainingFeatures() +00284 { +00285 return FeatureSet(); +00286 } +00287 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | PercussionOnsetDetector |
Example plugin that detects percussive events. More... |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_ +00038 #define _PERCUSSION_ONSET_DETECTOR_PLUGIN_H_ +00039 +00040 #include "vamp-sdk/Plugin.h" +00041 +00046 class PercussionOnsetDetector : public Vamp::Plugin +00047 { +00048 public: +00049 PercussionOnsetDetector(float inputSampleRate); +00050 virtual ~PercussionOnsetDetector(); +00051 +00052 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00053 void reset(); +00054 +00055 InputDomain getInputDomain() const { return FrequencyDomain; } +00056 +00057 std::string getIdentifier() const; +00058 std::string getName() const; +00059 std::string getDescription() const; +00060 std::string getMaker() const; +00061 int getPluginVersion() const; +00062 std::string getCopyright() const; +00063 +00064 size_t getPreferredStepSize() const; +00065 size_t getPreferredBlockSize() const; +00066 +00067 ParameterList getParameterDescriptors() const; +00068 float getParameter(std::string id) const; +00069 void setParameter(std::string id, float value); +00070 +00071 OutputList getOutputDescriptors() const; +00072 +00073 FeatureSet process(const float *const *inputBuffers, +00074 Vamp::RealTime timestamp); +00075 +00076 FeatureSet getRemainingFeatures(); +00077 +00078 protected: +00079 size_t m_stepSize; +00080 size_t m_blockSize; +00081 +00082 float m_threshold; +00083 float m_sensitivity; +00084 float *m_priorMagnitudes; +00085 float m_dfMinus1; +00086 float m_dfMinus2; +00087 }; +00088 +00089 +00090 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::PluginAdapterBase |
PluginAdapter and PluginAdapterBase provide a wrapper class that a plugin library can use to make its C++ Vamp::Plugin objects available through the Vamp C API. More... | |
class | Vamp::PluginAdapter< P > |
PluginAdapter turns a PluginAdapterBase into a specific wrapper for a particular plugin implementation. More... | |
+Namespaces | |
namespace | Vamp |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_ADAPTER_H_ +00038 #define _VAMP_PLUGIN_ADAPTER_H_ +00039 +00040 #include <map> +00041 #include <vamp/vamp.h> +00042 +00043 #include "Plugin.h" +00044 +00045 #include "plugguard.h" +00046 _VAMP_SDK_PLUGSPACE_BEGIN(PluginAdapter.h) +00047 +00048 namespace Vamp { +00049 +00065 class PluginAdapterBase +00066 { +00067 public: +00068 virtual ~PluginAdapterBase(); +00069 +00074 const VampPluginDescriptor *getDescriptor(); +00075 +00076 protected: +00077 PluginAdapterBase(); +00078 +00079 virtual Plugin *createPlugin(float inputSampleRate) = 0; +00080 +00081 class Impl; +00082 Impl *m_impl; +00083 }; +00084 +00094 template <typename P> +00095 class PluginAdapter : public PluginAdapterBase +00096 { +00097 public: +00098 PluginAdapter() : PluginAdapterBase() { } +00099 virtual ~PluginAdapter() { } +00100 +00101 protected: +00102 Plugin *createPlugin(float inputSampleRate) { +00103 P *p = new P(inputSampleRate); +00104 Plugin *plugin = dynamic_cast<Plugin *>(p); +00105 if (!plugin) { +00106 std::cerr << "ERROR: PluginAdapter::createPlugin: " +00107 << "Template type is not a plugin!" +00108 << std::endl; +00109 delete p; +00110 return 0; +00111 } +00112 return plugin; +00113 } +00114 }; +00115 +00116 } +00117 +00118 _VAMP_SDK_PLUGSPACE_END(PluginAdapter.h) +00119 +00120 #endif +00121 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::HostExt::PluginBufferingAdapter |
PluginBufferingAdapter is a Vamp plugin adapter that allows plugins to be used by a host supplying an audio stream in non-overlapping buffers of arbitrary size. More... | |
+Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 This file by Mark Levy and Chris Cannam, Copyright 2007-2008 QMUL. +00011 +00012 Permission is hereby granted, free of charge, to any person +00013 obtaining a copy of this software and associated documentation +00014 files (the "Software"), to deal in the Software without +00015 restriction, including without limitation the rights to use, copy, +00016 modify, merge, publish, distribute, sublicense, and/or sell copies +00017 of the Software, and to permit persons to whom the Software is +00018 furnished to do so, subject to the following conditions: +00019 +00020 The above copyright notice and this permission notice shall be +00021 included in all copies or substantial portions of the Software. +00022 +00023 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00024 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00025 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00026 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00027 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00028 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00029 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00030 +00031 Except as contained in this notice, the names of the Centre for +00032 Digital Music; Queen Mary, University of London; and Chris Cannam +00033 shall not be used in advertising or otherwise to promote the sale, +00034 use or other dealings in this Software without prior written +00035 authorization. +00036 */ +00037 +00038 #ifndef _VAMP_PLUGIN_BUFFERING_ADAPTER_H_ +00039 #define _VAMP_PLUGIN_BUFFERING_ADAPTER_H_ +00040 +00041 #include "hostguard.h" +00042 #include "PluginWrapper.h" +00043 +00044 _VAMP_SDK_HOSTSPACE_BEGIN(PluginBufferingAdapter.h) +00045 +00046 namespace Vamp { +00047 +00048 namespace HostExt { +00049 +00075 class PluginBufferingAdapter : public PluginWrapper +00076 { +00077 public: +00083 PluginBufferingAdapter(Plugin *plugin); +00084 virtual ~PluginBufferingAdapter(); +00085 +00095 size_t getPreferredStepSize() const; +00096 +00107 size_t getPreferredBlockSize() const; +00108 +00118 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00119 +00131 size_t getPluginPreferredStepSize() const; +00132 +00139 size_t getPluginPreferredBlockSize() const; +00140 +00148 void setPluginStepSize(size_t stepSize); +00149 +00157 void setPluginBlockSize(size_t blockSize); +00158 +00170 void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize); +00171 +00172 void setParameter(std::string, float); +00173 void selectProgram(std::string); +00174 +00175 OutputList getOutputDescriptors() const; +00176 +00177 void reset(); +00178 +00179 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00180 +00181 FeatureSet getRemainingFeatures(); +00182 +00183 protected: +00184 class Impl; +00185 Impl *m_impl; +00186 }; +00187 +00188 } +00189 +00190 } +00191 +00192 _VAMP_SDK_HOSTSPACE_END(PluginBufferingAdapter.h) +00193 +00194 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::HostExt::PluginChannelAdapter |
PluginChannelAdapter is a Vamp plugin adapter that implements a policy for management of plugins that expect a different number of input channels from the number actually available in the source audio data. More... | |
+Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_CHANNEL_ADAPTER_H_ +00038 #define _VAMP_PLUGIN_CHANNEL_ADAPTER_H_ +00039 +00040 #include "hostguard.h" +00041 #include "PluginWrapper.h" +00042 +00043 _VAMP_SDK_HOSTSPACE_BEGIN(PluginChannelAdapter.h) +00044 +00045 namespace Vamp { +00046 +00047 namespace HostExt { +00048 +00112 class PluginChannelAdapter : public PluginWrapper +00113 { +00114 public: +00120 PluginChannelAdapter(Plugin *plugin); +00121 virtual ~PluginChannelAdapter(); +00122 +00123 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00124 +00125 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00126 +00136 FeatureSet processInterleaved(const float *inputBuffer, RealTime timestamp); +00137 +00138 protected: +00139 class Impl; +00140 Impl *m_impl; +00141 }; +00142 +00143 } +00144 +00145 } +00146 +00147 _VAMP_SDK_HOSTSPACE_END(PluginChannelAdapter.h) +00148 +00149 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::PluginHostAdapter |
PluginHostAdapter is a wrapper class that a Vamp host can use to make the C-language VampPluginDescriptor object appear as a C++ Vamp::Plugin object. More... | |
+Namespaces | |
namespace | Vamp |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_HOST_ADAPTER_H_ +00038 #define _VAMP_PLUGIN_HOST_ADAPTER_H_ +00039 +00040 #include "hostguard.h" +00041 #include "Plugin.h" +00042 +00043 #include <vamp/vamp.h> +00044 +00045 #include <vector> +00046 +00047 _VAMP_SDK_HOSTSPACE_BEGIN(PluginHostAdapter.h) +00048 +00049 namespace Vamp { +00050 +00068 class PluginHostAdapter : public Plugin +00069 { +00070 public: +00071 PluginHostAdapter(const VampPluginDescriptor *descriptor, +00072 float inputSampleRate); +00073 virtual ~PluginHostAdapter(); +00074 +00075 static std::vector<std::string> getPluginPath(); +00076 +00077 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00078 void reset(); +00079 +00080 InputDomain getInputDomain() const; +00081 +00082 unsigned int getVampApiVersion() const; +00083 std::string getIdentifier() const; +00084 std::string getName() const; +00085 std::string getDescription() const; +00086 std::string getMaker() const; +00087 int getPluginVersion() const; +00088 std::string getCopyright() const; +00089 +00090 ParameterList getParameterDescriptors() const; +00091 float getParameter(std::string) const; +00092 void setParameter(std::string, float); +00093 +00094 ProgramList getPrograms() const; +00095 std::string getCurrentProgram() const; +00096 void selectProgram(std::string); +00097 +00098 size_t getPreferredStepSize() const; +00099 size_t getPreferredBlockSize() const; +00100 +00101 size_t getMinChannelCount() const; +00102 size_t getMaxChannelCount() const; +00103 +00104 OutputList getOutputDescriptors() const; +00105 +00106 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00107 +00108 FeatureSet getRemainingFeatures(); +00109 +00110 protected: +00111 void convertFeatures(VampFeatureList *, FeatureSet &); +00112 +00113 const VampPluginDescriptor *m_descriptor; +00114 VampPluginHandle m_handle; +00115 }; +00116 +00117 } +00118 +00119 _VAMP_SDK_HOSTSPACE_END(PluginHostAdapter.h) +00120 +00121 #endif +00122 +00123 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::HostExt::PluginInputDomainAdapter |
PluginInputDomainAdapter is a Vamp plugin adapter that converts time-domain input into frequency-domain input for plugins that need it. More... | |
+Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_INPUT_DOMAIN_ADAPTER_H_ +00038 #define _VAMP_PLUGIN_INPUT_DOMAIN_ADAPTER_H_ +00039 +00040 #include "hostguard.h" +00041 #include "PluginWrapper.h" +00042 +00043 _VAMP_SDK_HOSTSPACE_BEGIN(PluginInputDomainAdapter.h) +00044 +00045 namespace Vamp { +00046 +00047 namespace HostExt { +00048 +00087 class PluginInputDomainAdapter : public PluginWrapper +00088 { +00089 public: +00095 PluginInputDomainAdapter(Plugin *plugin); +00096 virtual ~PluginInputDomainAdapter(); +00097 +00098 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00099 void reset(); +00100 +00101 InputDomain getInputDomain() const; +00102 +00103 size_t getPreferredStepSize() const; +00104 size_t getPreferredBlockSize() const; +00105 +00106 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00107 +00142 enum ProcessTimestampMethod { +00143 ShiftTimestamp, +00144 ShiftData, +00145 NoShift +00146 }; +00147 +00156 void setProcessTimestampMethod(ProcessTimestampMethod); +00157 +00163 ProcessTimestampMethod getProcessTimestampMethod() const; +00164 +00190 RealTime getTimestampAdjustment() const; +00191 +00195 enum WindowType { +00196 +00197 RectangularWindow = 0, +00198 +00199 BartlettWindow = 1, +00200 TriangularWindow = 1, +00201 +00202 HammingWindow = 2, +00203 +00204 HanningWindow = 3, +00205 HannWindow = 3, +00206 +00207 BlackmanWindow = 4, +00208 +00209 NuttallWindow = 7, +00210 +00211 BlackmanHarrisWindow = 8 +00212 }; +00213 +00217 WindowType getWindowType() const; +00218 +00222 void setWindowType(WindowType type); +00223 +00224 +00225 protected: +00226 class Impl; +00227 Impl *m_impl; +00228 }; +00229 +00230 } +00231 +00232 } +00233 +00234 _VAMP_SDK_HOSTSPACE_END(PluginInputDomainAdapter.h) +00235 +00236 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::HostExt::PluginLoader |
Vamp::HostExt::PluginLoader is a convenience class for discovering and loading Vamp plugins using the typical plugin-path, library naming, and categorisation conventions described in the Vamp SDK documentation. More... | |
+Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_LOADER_H_ +00038 #define _VAMP_PLUGIN_LOADER_H_ +00039 +00040 #include <vector> +00041 #include <string> +00042 #include <map> +00043 +00044 #include "hostguard.h" +00045 #include "PluginWrapper.h" +00046 +00047 _VAMP_SDK_HOSTSPACE_BEGIN(PluginLoader.h) +00048 +00049 namespace Vamp { +00050 +00051 class Plugin; +00052 +00053 namespace HostExt { +00054 +00072 class PluginLoader +00073 { +00074 public: +00079 static PluginLoader *getInstance(); +00080 +00101 typedef std::string PluginKey; +00102 +00107 typedef std::vector<PluginKey> PluginKeyList; +00108 +00119 typedef std::vector<std::string> PluginCategoryHierarchy; +00120 +00125 PluginKeyList listPlugins(); +00126 +00169 enum AdapterFlags { +00170 +00171 ADAPT_INPUT_DOMAIN = 0x01, +00172 ADAPT_CHANNEL_COUNT = 0x02, +00173 ADAPT_BUFFER_SIZE = 0x04, +00174 +00175 ADAPT_ALL_SAFE = 0x03, +00176 +00177 ADAPT_ALL = 0xff +00178 }; +00179 +00197 Plugin *loadPlugin(PluginKey key, +00198 float inputSampleRate, +00199 int adapterFlags = 0); +00200 +00206 PluginKey composePluginKey(std::string libraryName, +00207 std::string identifier); +00208 +00218 PluginCategoryHierarchy getPluginCategory(PluginKey plugin); +00219 +00224 std::string getLibraryPathForPlugin(PluginKey plugin); +00225 +00226 protected: +00227 PluginLoader(); +00228 virtual ~PluginLoader(); +00229 +00230 class Impl; +00231 Impl *m_impl; +00232 +00233 static PluginLoader *m_instance; +00234 }; +00235 +00236 } +00237 +00238 } +00239 +00240 _VAMP_SDK_HOSTSPACE_END(PluginLoader.h) +00241 +00242 #endif +00243 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::HostExt::PluginSummarisingAdapter |
PluginSummarisingAdapter is a Vamp plugin adapter that provides summarisation methods such as mean and median averages of output features, for use in any context where an available plugin produces individual values but the result that is actually needed is some sort of aggregate. More... | |
+Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_SUMMARISING_ADAPTER_H_ +00038 #define _VAMP_PLUGIN_SUMMARISING_ADAPTER_H_ +00039 +00040 #include "hostguard.h" +00041 #include "PluginWrapper.h" +00042 +00043 #include <set> +00044 +00045 _VAMP_SDK_HOSTSPACE_BEGIN(PluginSummarisingAdapter.h) +00046 +00047 namespace Vamp { +00048 +00049 namespace HostExt { +00050 +00086 class PluginSummarisingAdapter : public PluginWrapper +00087 { +00088 public: +00094 PluginSummarisingAdapter(Plugin *plugin); +00095 virtual ~PluginSummarisingAdapter(); +00096 +00097 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00098 +00099 void reset(); +00100 +00101 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00102 FeatureSet getRemainingFeatures(); +00103 +00104 typedef std::set<RealTime> SegmentBoundaries; +00105 +00119 void setSummarySegmentBoundaries(const SegmentBoundaries &); +00120 +00121 enum SummaryType { +00122 Minimum = 0, +00123 Maximum = 1, +00124 Mean = 2, +00125 Median = 3, +00126 Mode = 4, +00127 Sum = 5, +00128 Variance = 6, +00129 StandardDeviation = 7, +00130 Count = 8, +00131 +00132 UnknownSummaryType = 999 +00133 }; +00134 +00157 enum AveragingMethod { +00158 SampleAverage = 0, +00159 ContinuousTimeAverage = 1 +00160 }; +00161 +00170 FeatureList getSummaryForOutput(int output, +00171 SummaryType type, +00172 AveragingMethod method = SampleAverage); +00173 +00183 FeatureSet getSummaryForAllOutputs(SummaryType type, +00184 AveragingMethod method = SampleAverage); +00185 +00186 protected: +00187 class Impl; +00188 Impl *m_impl; +00189 }; +00190 +00191 } +00192 +00193 } +00194 +00195 _VAMP_SDK_HOSTSPACE_END(PluginSummarisingAdapter.h) +00196 +00197 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | Vamp::HostExt::PluginWrapper |
PluginWrapper is a simple base class for adapter plugins. More... | |
+Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006-2009 Chris Cannam and QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_PLUGIN_WRAPPER_H_ +00038 #define _VAMP_PLUGIN_WRAPPER_H_ +00039 +00040 #include "hostguard.h" +00041 #include <vamp-hostsdk/Plugin.h> +00042 +00043 _VAMP_SDK_HOSTSPACE_BEGIN(PluginWrapper.h) +00044 +00045 namespace Vamp { +00046 +00047 namespace HostExt { +00048 +00062 class PluginWrapper : public Plugin +00063 { +00064 public: +00065 virtual ~PluginWrapper(); +00066 +00067 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00068 void reset(); +00069 +00070 InputDomain getInputDomain() const; +00071 +00072 unsigned int getVampApiVersion() const; +00073 std::string getIdentifier() const; +00074 std::string getName() const; +00075 std::string getDescription() const; +00076 std::string getMaker() const; +00077 int getPluginVersion() const; +00078 std::string getCopyright() const; +00079 +00080 ParameterList getParameterDescriptors() const; +00081 float getParameter(std::string) const; +00082 void setParameter(std::string, float); +00083 +00084 ProgramList getPrograms() const; +00085 std::string getCurrentProgram() const; +00086 void selectProgram(std::string); +00087 +00088 size_t getPreferredStepSize() const; +00089 size_t getPreferredBlockSize() const; +00090 +00091 size_t getMinChannelCount() const; +00092 size_t getMaxChannelCount() const; +00093 +00094 OutputList getOutputDescriptors() const; +00095 +00096 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00097 +00098 FeatureSet getRemainingFeatures(); +00099 +00115 template <typename WrapperType> +00116 WrapperType *getWrapper() { +00117 WrapperType *w = dynamic_cast<WrapperType *>(this); +00118 if (w) return w; +00119 PluginWrapper *pw = dynamic_cast<PluginWrapper *>(m_plugin); +00120 if (pw) return pw->getWrapper<WrapperType>(); +00121 return 0; +00122 } +00123 +00124 protected: +00125 PluginWrapper(Plugin *plugin); // I take ownership of plugin +00126 Plugin *m_plugin; +00127 }; +00128 +00129 } +00130 +00131 } +00132 +00133 _VAMP_SDK_HOSTSPACE_END(PluginWrapper.h) +00134 +00135 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2008 QMUL. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #include "PowerSpectrum.h" +00038 +00039 using std::string; +00040 using std::cerr; +00041 using std::endl; +00042 +00043 #include <math.h> +00044 +00045 PowerSpectrum::PowerSpectrum(float inputSampleRate) : +00046 Plugin(inputSampleRate), +00047 m_blockSize(0) +00048 { +00049 } +00050 +00051 PowerSpectrum::~PowerSpectrum() +00052 { +00053 } +00054 +00055 string +00056 PowerSpectrum::getIdentifier() const +00057 { +00058 return "powerspectrum"; +00059 } +00060 +00061 string +00062 PowerSpectrum::getName() const +00063 { +00064 return "Simple Power Spectrum"; +00065 } +00066 +00067 string +00068 PowerSpectrum::getDescription() const +00069 { +00070 return "Return the power spectrum of a signal"; +00071 } +00072 +00073 string +00074 PowerSpectrum::getMaker() const +00075 { +00076 return "Vamp SDK Example Plugins"; +00077 } +00078 +00079 int +00080 PowerSpectrum::getPluginVersion() const +00081 { +00082 return 1; +00083 } +00084 +00085 string +00086 PowerSpectrum::getCopyright() const +00087 { +00088 return "Freely redistributable (BSD license)"; +00089 } +00090 +00091 bool +00092 PowerSpectrum::initialise(size_t channels, size_t stepSize, size_t blockSize) +00093 { +00094 if (channels < getMinChannelCount() || +00095 channels > getMaxChannelCount()) return false; +00096 +00097 m_blockSize = blockSize; +00098 +00099 return true; +00100 } +00101 +00102 void +00103 PowerSpectrum::reset() +00104 { +00105 } +00106 +00107 PowerSpectrum::OutputList +00108 PowerSpectrum::getOutputDescriptors() const +00109 { +00110 OutputList list; +00111 +00112 OutputDescriptor d; +00113 d.identifier = "powerspectrum"; +00114 d.name = "Power Spectrum"; +00115 d.description = "Power values of the frequency spectrum bins calculated from the input signal"; +00116 d.unit = ""; +00117 d.hasFixedBinCount = true; +00118 if (m_blockSize == 0) { +00119 // Just so as not to return "1". This is the bin count that +00120 // would result from a block size of 1024, which is a likely +00121 // default -- but the host should always set the block size +00122 // before querying the bin count for certain. +00123 d.binCount = 513; +00124 } else { +00125 d.binCount = m_blockSize / 2 + 1; +00126 } +00127 d.hasKnownExtents = false; +00128 d.isQuantized = false; +00129 d.sampleType = OutputDescriptor::OneSamplePerStep; +00130 list.push_back(d); +00131 +00132 return list; +00133 } +00134 +00135 PowerSpectrum::FeatureSet +00136 PowerSpectrum::process(const float *const *inputBuffers, Vamp::RealTime timestamp) +00137 { +00138 FeatureSet fs; +00139 +00140 if (m_blockSize == 0) { +00141 cerr << "ERROR: PowerSpectrum::process: Not initialised" << endl; +00142 return fs; +00143 } +00144 +00145 size_t n = m_blockSize / 2 + 1; +00146 const float *fbuf = inputBuffers[0]; +00147 +00148 Feature feature; +00149 feature.hasTimestamp = false; +00150 feature.values.reserve(n); // optional +00151 +00152 for (size_t i = 0; i < n; ++i) { +00153 +00154 double real = fbuf[i * 2]; +00155 double imag = fbuf[i * 2 + 1]; +00156 +00157 feature.values.push_back(real * real + imag * imag); +00158 } +00159 +00160 fs[0].push_back(feature); +00161 +00162 return fs; +00163 } +00164 +00165 PowerSpectrum::FeatureSet +00166 PowerSpectrum::getRemainingFeatures() +00167 { +00168 return FeatureSet(); +00169 } +00170 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | PowerSpectrum |
Example plugin that returns a power spectrum calculated (trivially) from the frequency domain representation of each block of audio. More... |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _POWER_SPECTRUM_PLUGIN_H_ +00038 #define _POWER_SPECTRUM_PLUGIN_H_ +00039 +00040 #include "vamp-sdk/Plugin.h" +00041 +00050 class PowerSpectrum : public Vamp::Plugin +00051 { +00052 public: +00053 PowerSpectrum(float inputSampleRate); +00054 virtual ~PowerSpectrum(); +00055 +00056 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00057 void reset(); +00058 +00059 InputDomain getInputDomain() const { return FrequencyDomain; } +00060 +00061 std::string getIdentifier() const; +00062 std::string getName() const; +00063 std::string getDescription() const; +00064 std::string getMaker() const; +00065 int getPluginVersion() const; +00066 std::string getCopyright() const; +00067 +00068 OutputList getOutputDescriptors() const; +00069 +00070 FeatureSet process(const float *const *inputBuffers, +00071 Vamp::RealTime timestamp); +00072 +00073 FeatureSet getRemainingFeatures(); +00074 +00075 protected: +00076 size_t m_blockSize; +00077 }; +00078 +00079 +00080 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #include "SpectralCentroid.h" +00038 +00039 using std::string; +00040 using std::vector; +00041 using std::cerr; +00042 using std::endl; +00043 +00044 #include <math.h> +00045 +00046 #ifdef __SUNPRO_CC +00047 #include <ieeefp.h> +00048 #define isinf(x) (!finite(x)) +00049 #endif +00050 +00051 #ifdef WIN32 +00052 #define isnan(x) false +00053 #define isinf(x) false +00054 #endif +00055 +00056 SpectralCentroid::SpectralCentroid(float inputSampleRate) : +00057 Plugin(inputSampleRate), +00058 m_stepSize(0), +00059 m_blockSize(0) +00060 { +00061 } +00062 +00063 SpectralCentroid::~SpectralCentroid() +00064 { +00065 } +00066 +00067 string +00068 SpectralCentroid::getIdentifier() const +00069 { +00070 return "spectralcentroid"; +00071 } +00072 +00073 string +00074 SpectralCentroid::getName() const +00075 { +00076 return "Spectral Centroid"; +00077 } +00078 +00079 string +00080 SpectralCentroid::getDescription() const +00081 { +00082 return "Calculate the centroid frequency of the spectrum of the input signal"; +00083 } +00084 +00085 string +00086 SpectralCentroid::getMaker() const +00087 { +00088 return "Vamp SDK Example Plugins"; +00089 } +00090 +00091 int +00092 SpectralCentroid::getPluginVersion() const +00093 { +00094 return 2; +00095 } +00096 +00097 string +00098 SpectralCentroid::getCopyright() const +00099 { +00100 return "Freely redistributable (BSD license)"; +00101 } +00102 +00103 bool +00104 SpectralCentroid::initialise(size_t channels, size_t stepSize, size_t blockSize) +00105 { +00106 if (channels < getMinChannelCount() || +00107 channels > getMaxChannelCount()) return false; +00108 +00109 m_stepSize = stepSize; +00110 m_blockSize = blockSize; +00111 +00112 return true; +00113 } +00114 +00115 void +00116 SpectralCentroid::reset() +00117 { +00118 } +00119 +00120 SpectralCentroid::OutputList +00121 SpectralCentroid::getOutputDescriptors() const +00122 { +00123 OutputList list; +00124 +00125 OutputDescriptor d; +00126 d.identifier = "logcentroid"; +00127 d.name = "Log Frequency Centroid"; +00128 d.description = "Centroid of the log weighted frequency spectrum"; +00129 d.unit = "Hz"; +00130 d.hasFixedBinCount = true; +00131 d.binCount = 1; +00132 d.hasKnownExtents = false; +00133 d.isQuantized = false; +00134 d.sampleType = OutputDescriptor::OneSamplePerStep; +00135 list.push_back(d); +00136 +00137 d.identifier = "linearcentroid"; +00138 d.name = "Linear Frequency Centroid"; +00139 d.description = "Centroid of the linear frequency spectrum"; +00140 list.push_back(d); +00141 +00142 return list; +00143 } +00144 +00145 SpectralCentroid::FeatureSet +00146 SpectralCentroid::process(const float *const *inputBuffers, Vamp::RealTime timestamp) +00147 { +00148 if (m_stepSize == 0) { +00149 cerr << "ERROR: SpectralCentroid::process: " +00150 << "SpectralCentroid has not been initialised" +00151 << endl; +00152 return FeatureSet(); +00153 } +00154 +00155 double numLin = 0.0, numLog = 0.0, denom = 0.0; +00156 +00157 for (size_t i = 1; i <= m_blockSize/2; ++i) { +00158 double freq = (double(i) * m_inputSampleRate) / m_blockSize; +00159 double real = inputBuffers[0][i*2]; +00160 double imag = inputBuffers[0][i*2 + 1]; +00161 double scalemag = sqrt(real * real + imag * imag) / (m_blockSize/2); +00162 numLin += freq * scalemag; +00163 numLog += log10f(freq) * scalemag; +00164 denom += scalemag; +00165 } +00166 +00167 FeatureSet returnFeatures; +00168 +00169 if (denom != 0.0) { +00170 float centroidLin = float(numLin / denom); +00171 float centroidLog = powf(10, float(numLog / denom)); +00172 +00173 Feature feature; +00174 feature.hasTimestamp = false; +00175 +00176 if (!isnan(centroidLog) && !isinf(centroidLog)) { +00177 feature.values.push_back(centroidLog); +00178 } +00179 returnFeatures[0].push_back(feature); +00180 +00181 feature.values.clear(); +00182 if (!isnan(centroidLin) && !isinf(centroidLin)) { +00183 feature.values.push_back(centroidLin); +00184 } +00185 returnFeatures[1].push_back(feature); +00186 } +00187 +00188 return returnFeatures; +00189 } +00190 +00191 SpectralCentroid::FeatureSet +00192 SpectralCentroid::getRemainingFeatures() +00193 { +00194 return FeatureSet(); +00195 } +00196 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | SpectralCentroid |
Example plugin that calculates the centre of gravity of the frequency domain representation of each block of audio. More... |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _SPECTRAL_CENTROID_PLUGIN_H_ +00038 #define _SPECTRAL_CENTROID_PLUGIN_H_ +00039 +00040 #include "vamp-sdk/Plugin.h" +00041 +00047 class SpectralCentroid : public Vamp::Plugin +00048 { +00049 public: +00050 SpectralCentroid(float inputSampleRate); +00051 virtual ~SpectralCentroid(); +00052 +00053 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00054 void reset(); +00055 +00056 InputDomain getInputDomain() const { return FrequencyDomain; } +00057 +00058 std::string getIdentifier() const; +00059 std::string getName() const; +00060 std::string getDescription() const; +00061 std::string getMaker() const; +00062 int getPluginVersion() const; +00063 std::string getCopyright() const; +00064 +00065 OutputList getOutputDescriptors() const; +00066 +00067 FeatureSet process(const float *const *inputBuffers, +00068 Vamp::RealTime timestamp); +00069 +00070 FeatureSet getRemainingFeatures(); +00071 +00072 protected: +00073 size_t m_stepSize; +00074 size_t m_blockSize; +00075 }; +00076 +00077 +00078 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #include "ZeroCrossing.h" +00038 +00039 using std::string; +00040 using std::vector; +00041 using std::cerr; +00042 using std::endl; +00043 +00044 #include <cmath> +00045 +00046 ZeroCrossing::ZeroCrossing(float inputSampleRate) : +00047 Plugin(inputSampleRate), +00048 m_stepSize(0), +00049 m_previousSample(0.0f) +00050 { +00051 } +00052 +00053 ZeroCrossing::~ZeroCrossing() +00054 { +00055 } +00056 +00057 string +00058 ZeroCrossing::getIdentifier() const +00059 { +00060 return "zerocrossing"; +00061 } +00062 +00063 string +00064 ZeroCrossing::getName() const +00065 { +00066 return "Zero Crossings"; +00067 } +00068 +00069 string +00070 ZeroCrossing::getDescription() const +00071 { +00072 return "Detect and count zero crossing points"; +00073 } +00074 +00075 string +00076 ZeroCrossing::getMaker() const +00077 { +00078 return "Vamp SDK Example Plugins"; +00079 } +00080 +00081 int +00082 ZeroCrossing::getPluginVersion() const +00083 { +00084 return 2; +00085 } +00086 +00087 string +00088 ZeroCrossing::getCopyright() const +00089 { +00090 return "Freely redistributable (BSD license)"; +00091 } +00092 +00093 bool +00094 ZeroCrossing::initialise(size_t channels, size_t stepSize, size_t blockSize) +00095 { +00096 if (channels < getMinChannelCount() || +00097 channels > getMaxChannelCount()) return false; +00098 +00099 m_stepSize = std::min(stepSize, blockSize); +00100 +00101 return true; +00102 } +00103 +00104 void +00105 ZeroCrossing::reset() +00106 { +00107 m_previousSample = 0.0f; +00108 } +00109 +00110 ZeroCrossing::OutputList +00111 ZeroCrossing::getOutputDescriptors() const +00112 { +00113 OutputList list; +00114 +00115 OutputDescriptor zc; +00116 zc.identifier = "counts"; +00117 zc.name = "Zero Crossing Counts"; +00118 zc.description = "The number of zero crossing points per processing block"; +00119 zc.unit = "crossings"; +00120 zc.hasFixedBinCount = true; +00121 zc.binCount = 1; +00122 zc.hasKnownExtents = false; +00123 zc.isQuantized = true; +00124 zc.quantizeStep = 1.0; +00125 zc.sampleType = OutputDescriptor::OneSamplePerStep; +00126 list.push_back(zc); +00127 +00128 zc.identifier = "zerocrossings"; +00129 zc.name = "Zero Crossings"; +00130 zc.description = "The locations of zero crossing points"; +00131 zc.unit = ""; +00132 zc.hasFixedBinCount = true; +00133 zc.binCount = 0; +00134 zc.sampleType = OutputDescriptor::VariableSampleRate; +00135 zc.sampleRate = m_inputSampleRate; +00136 list.push_back(zc); +00137 +00138 return list; +00139 } +00140 +00141 ZeroCrossing::FeatureSet +00142 ZeroCrossing::process(const float *const *inputBuffers, +00143 Vamp::RealTime timestamp) +00144 { +00145 if (m_stepSize == 0) { +00146 cerr << "ERROR: ZeroCrossing::process: " +00147 << "ZeroCrossing has not been initialised" +00148 << endl; +00149 return FeatureSet(); +00150 } +00151 +00152 float prev = m_previousSample; +00153 size_t count = 0; +00154 +00155 FeatureSet returnFeatures; +00156 +00157 for (size_t i = 0; i < m_stepSize; ++i) { +00158 +00159 float sample = inputBuffers[0][i]; +00160 bool crossing = false; +00161 +00162 if (sample <= 0.0) { +00163 if (prev > 0.0) crossing = true; +00164 } else if (sample > 0.0) { +00165 if (prev <= 0.0) crossing = true; +00166 } +00167 +00168 if (crossing) { +00169 ++count; +00170 Feature feature; +00171 feature.hasTimestamp = true; +00172 feature.timestamp = timestamp + +00173 Vamp::RealTime::frame2RealTime(i, (size_t)m_inputSampleRate); +00174 returnFeatures[1].push_back(feature); +00175 } +00176 +00177 prev = sample; +00178 } +00179 +00180 m_previousSample = prev; +00181 +00182 Feature feature; +00183 feature.hasTimestamp = false; +00184 feature.values.push_back(float(count)); +00185 +00186 returnFeatures[0].push_back(feature); +00187 return returnFeatures; +00188 } +00189 +00190 ZeroCrossing::FeatureSet +00191 ZeroCrossing::getRemainingFeatures() +00192 { +00193 return FeatureSet(); +00194 } +00195 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Classes | |
class | ZeroCrossing |
Example plugin that calculates the positions and density of zero-crossing points in an audio waveform. More... |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _ZERO_CROSSING_PLUGIN_H_ +00038 #define _ZERO_CROSSING_PLUGIN_H_ +00039 +00040 #include "vamp-sdk/Plugin.h" +00041 +00047 class ZeroCrossing : public Vamp::Plugin +00048 { +00049 public: +00050 ZeroCrossing(float inputSampleRate); +00051 virtual ~ZeroCrossing(); +00052 +00053 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00054 void reset(); +00055 +00056 InputDomain getInputDomain() const { return TimeDomain; } +00057 +00058 std::string getIdentifier() const; +00059 std::string getName() const; +00060 std::string getDescription() const; +00061 std::string getMaker() const; +00062 int getPluginVersion() const; +00063 std::string getCopyright() const; +00064 +00065 OutputList getOutputDescriptors() const; +00066 +00067 FeatureSet process(const float *const *inputBuffers, +00068 Vamp::RealTime timestamp); +00069 +00070 FeatureSet getRemainingFeatures(); +00071 +00072 protected: +00073 size_t m_stepSize; +00074 float m_previousSample; +00075 }; +00076 +00077 +00078 #endif +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
_VampFeature | |
_VampFeatureList | |
_VampFeatureUnion | |
_VampFeatureV2 | |
_VampOutputDescriptor | |
_VampParameterDescriptor | C language API for Vamp plugins |
_VampPluginDescriptor | |
AmplitudeFollower | Example plugin implementing the SuperCollider amplitude follower function |
FixedTempoEstimator::D | |
Vamp::Plugin::Feature | |
FixedTempoEstimator | Example plugin that estimates the tempo of a short fixed-tempo sample |
Vamp::Plugin::OutputDescriptor | |
Vamp::PluginBase::ParameterDescriptor | |
PercussionOnsetDetector | Example plugin that detects percussive events |
Vamp::Plugin | Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio or related data |
Vamp::PluginAdapter< P > | PluginAdapter turns a PluginAdapterBase into a specific wrapper for a particular plugin implementation |
Vamp::PluginAdapterBase | PluginAdapter and PluginAdapterBase provide a wrapper class that a plugin library can use to make its C++ Vamp::Plugin objects available through the Vamp C API |
Vamp::PluginBase | A base class for plugins with optional configurable parameters, programs, etc |
Vamp::HostExt::PluginBufferingAdapter | PluginBufferingAdapter is a Vamp plugin adapter that allows plugins to be used by a host supplying an audio stream in non-overlapping buffers of arbitrary size |
Vamp::HostExt::PluginChannelAdapter | PluginChannelAdapter is a Vamp plugin adapter that implements a policy for management of plugins that expect a different number of input channels from the number actually available in the source audio data |
Vamp::PluginHostAdapter | PluginHostAdapter is a wrapper class that a Vamp host can use to make the C-language VampPluginDescriptor object appear as a C++ Vamp::Plugin object |
Vamp::HostExt::PluginInputDomainAdapter | PluginInputDomainAdapter is a Vamp plugin adapter that converts time-domain input into frequency-domain input for plugins that need it |
Vamp::HostExt::PluginLoader | Vamp::HostExt::PluginLoader is a convenience class for discovering and loading Vamp plugins using the typical plugin-path, library naming, and categorisation conventions described in the Vamp SDK documentation |
Vamp::HostExt::PluginSummarisingAdapter | PluginSummarisingAdapter is a Vamp plugin adapter that provides summarisation methods such as mean and median averages of output features, for use in any context where an available plugin produces individual values but the result that is actually needed is some sort of aggregate |
Vamp::HostExt::PluginWrapper | PluginWrapper is a simple base class for adapter plugins |
PowerSpectrum | Example plugin that returns a power spectrum calculated (trivially) from the frequency domain representation of each block of audio |
Vamp::RealTime | RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions |
SpectralCentroid | Example plugin that calculates the centre of gravity of the frequency domain representation of each block of audio |
ZeroCrossing | Example plugin that calculates the positions and density of zero-crossing points in an audio waveform |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Example plugin implementing the SuperCollider amplitude follower function. + More...
+ +#include <AmplitudeFollower.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
AmplitudeFollower (float inputSampleRate) | |
An implementation of SuperCollider's amplitude-follower algorithm as a simple Vamp plugin. | |
virtual | ~AmplitudeFollower () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string paramid) const |
Get the value of a named parameter. | |
void | setParameter (std::string paramid, float newval) |
Set a named parameter. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
virtual size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Attributes | |
size_t | m_stepSize |
float | m_previn |
float | m_clampcoef |
float | m_relaxcoef |
float | m_inputSampleRate |
Example plugin implementing the SuperCollider amplitude follower function.
+ +Definition at line 47 of file AmplitudeFollower.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +AmplitudeFollower::AmplitudeFollower | +( | +float | +inputSampleRate | ) | ++ |
An implementation of SuperCollider's amplitude-follower algorithm as a simple Vamp plugin.
+ +Definition at line 55 of file AmplitudeFollower.cpp.
+ +AmplitudeFollower::~AmplitudeFollower | +( | +) | + [virtual] |
+
Definition at line 64 of file AmplitudeFollower.cpp.
+ +bool AmplitudeFollower::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Definition at line 105 of file AmplitudeFollower.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), m_clampcoef, Vamp::Plugin::m_inputSampleRate, m_relaxcoef, and m_stepSize.
+ +void AmplitudeFollower::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Definition at line 122 of file AmplitudeFollower.cpp.
+ +References m_previn.
+ +InputDomain AmplitudeFollower::getInputDomain | +( | +) | + const [inline, virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Definition at line 56 of file AmplitudeFollower.h.
+ +References Vamp::Plugin::TimeDomain.
+ +string AmplitudeFollower::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 69 of file AmplitudeFollower.cpp.
+ +string AmplitudeFollower::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 75 of file AmplitudeFollower.cpp.
+ +string AmplitudeFollower::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +Definition at line 81 of file AmplitudeFollower.cpp.
+ +string AmplitudeFollower::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +Definition at line 87 of file AmplitudeFollower.cpp.
+ +int AmplitudeFollower::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +Definition at line 93 of file AmplitudeFollower.cpp.
+ +string AmplitudeFollower::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +Definition at line 99 of file AmplitudeFollower.cpp.
+ +AmplitudeFollower::OutputList AmplitudeFollower::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Definition at line 128 of file AmplitudeFollower.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::sampleType, and Vamp::Plugin::OutputDescriptor::unit.
+ +AmplitudeFollower::ParameterList AmplitudeFollower::getParameterDescriptors | +( | +) | + const [virtual] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 148 of file AmplitudeFollower.cpp.
+ +References Vamp::PluginBase::ParameterDescriptor::defaultValue, Vamp::PluginBase::ParameterDescriptor::description, Vamp::PluginBase::ParameterDescriptor::identifier, Vamp::PluginBase::ParameterDescriptor::isQuantized, Vamp::PluginBase::ParameterDescriptor::maxValue, Vamp::PluginBase::ParameterDescriptor::minValue, Vamp::PluginBase::ParameterDescriptor::name, and Vamp::PluginBase::ParameterDescriptor::unit.
+ +float AmplitudeFollower::getParameter | +( | +std::string | +) | + const [virtual] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 188 of file AmplitudeFollower.cpp.
+ +References m_clampcoef, and m_relaxcoef.
+ +void AmplitudeFollower::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 179 of file AmplitudeFollower.cpp.
+ +References m_clampcoef, and m_relaxcoef.
+ +AmplitudeFollower::FeatureSet AmplitudeFollower::process | +( | +const float *const * | +inputBuffers, | +
+ | + | Vamp::RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Definition at line 200 of file AmplitudeFollower.cpp.
+ +References Vamp::Plugin::Feature::hasTimestamp, m_clampcoef, m_previn, m_relaxcoef, m_stepSize, and Vamp::Plugin::Feature::values.
+ +AmplitudeFollower::FeatureSet AmplitudeFollower::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Definition at line 243 of file AmplitudeFollower.cpp.
+ +virtual size_t Vamp::Plugin::getPreferredBlockSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 179 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getPreferredStepSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 194 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +size_t AmplitudeFollower::m_stepSize [protected] |
+
Definition at line 77 of file AmplitudeFollower.h.
+ +Referenced by initialise(), and process().
+ +float AmplitudeFollower::m_previn [protected] |
+
Definition at line 78 of file AmplitudeFollower.h.
+ + + +float AmplitudeFollower::m_clampcoef [protected] |
+
Definition at line 79 of file AmplitudeFollower.h.
+ +Referenced by getParameter(), initialise(), process(), and setParameter().
+ +float AmplitudeFollower::m_relaxcoef [protected] |
+
Definition at line 80 of file AmplitudeFollower.h.
+ +Referenced by getParameter(), initialise(), process(), and setParameter().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), SpectralCentroid::process(), ZeroCrossing::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Example plugin that estimates the tempo of a short fixed-tempo sample. + More...
+ +#include <FixedTempoEstimator.h>
+Classes | |
class | D |
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
FixedTempoEstimator (float inputSampleRate) | |
virtual | ~FixedTempoEstimator () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string id) const |
Get the value of a named parameter. | |
void | setParameter (std::string id, float value) |
Set a named parameter. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Attributes | |
D * | m_d |
float | m_inputSampleRate |
Example plugin that estimates the tempo of a short fixed-tempo sample.
+ +Definition at line 46 of file FixedTempoEstimator.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +FixedTempoEstimator::FixedTempoEstimator | +( | +float | +inputSampleRate | ) | ++ |
Definition at line 617 of file FixedTempoEstimator.cpp.
+ +FixedTempoEstimator::~FixedTempoEstimator | +( | +) | + [virtual] |
+
Definition at line 623 of file FixedTempoEstimator.cpp.
+ +References m_d.
+ +bool FixedTempoEstimator::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Definition at line 677 of file FixedTempoEstimator.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), FixedTempoEstimator::D::initialise(), and m_d.
+ +void FixedTempoEstimator::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Definition at line 686 of file FixedTempoEstimator.cpp.
+ +References m_d, and FixedTempoEstimator::D::reset().
+ +InputDomain FixedTempoEstimator::getInputDomain | +( | +) | + const [inline, virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Definition at line 55 of file FixedTempoEstimator.h.
+ +References Vamp::Plugin::FrequencyDomain.
+ +string FixedTempoEstimator::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 629 of file FixedTempoEstimator.cpp.
+ +string FixedTempoEstimator::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 635 of file FixedTempoEstimator.cpp.
+ +string FixedTempoEstimator::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +Definition at line 641 of file FixedTempoEstimator.cpp.
+ +string FixedTempoEstimator::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +Definition at line 647 of file FixedTempoEstimator.cpp.
+ +int FixedTempoEstimator::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +Definition at line 653 of file FixedTempoEstimator.cpp.
+ +string FixedTempoEstimator::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +Definition at line 659 of file FixedTempoEstimator.cpp.
+ +size_t FixedTempoEstimator::getPreferredStepSize | +( | +) | + const [virtual] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Definition at line 665 of file FixedTempoEstimator.cpp.
+ +References FixedTempoEstimator::D::getPreferredStepSize(), and m_d.
+ +size_t FixedTempoEstimator::getPreferredBlockSize | +( | +) | + const [virtual] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Definition at line 671 of file FixedTempoEstimator.cpp.
+ +References FixedTempoEstimator::D::getPreferredBlockSize(), and m_d.
+ +Referenced by FixedTempoEstimator::D::getOutputDescriptors().
+ +FixedTempoEstimator::ParameterList FixedTempoEstimator::getParameterDescriptors | +( | +) | + const [virtual] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 692 of file FixedTempoEstimator.cpp.
+ +References FixedTempoEstimator::D::getParameterDescriptors(), and m_d.
+ +float FixedTempoEstimator::getParameter | +( | +std::string | +) | + const [virtual] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 698 of file FixedTempoEstimator.cpp.
+ +References FixedTempoEstimator::D::getParameter(), and m_d.
+ +void FixedTempoEstimator::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 704 of file FixedTempoEstimator.cpp.
+ +References m_d, and FixedTempoEstimator::D::setParameter().
+ +FixedTempoEstimator::OutputList FixedTempoEstimator::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Definition at line 710 of file FixedTempoEstimator.cpp.
+ +References FixedTempoEstimator::D::getOutputDescriptors(), and m_d.
+ +FixedTempoEstimator::FeatureSet FixedTempoEstimator::process | +( | +const float *const * | +inputBuffers, | +
+ | + | Vamp::RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Definition at line 716 of file FixedTempoEstimator.cpp.
+ +References m_d, and FixedTempoEstimator::D::process().
+ +FixedTempoEstimator::FeatureSet FixedTempoEstimator::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Definition at line 722 of file FixedTempoEstimator.cpp.
+ +References FixedTempoEstimator::D::getRemainingFeatures(), and m_d.
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +D* FixedTempoEstimator::m_d [protected] |
+
Definition at line 79 of file FixedTempoEstimator.h.
+ +Referenced by getOutputDescriptors(), getParameter(), getParameterDescriptors(), getPreferredBlockSize(), getPreferredStepSize(), getRemainingFeatures(), initialise(), process(), reset(), setParameter(), and ~FixedTempoEstimator().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+Public Member Functions | |
D (float inputSampleRate) | |
~D () | |
size_t | getPreferredStepSize () const |
size_t | getPreferredBlockSize () const |
ParameterList | getParameterDescriptors () const |
float | getParameter (string id) const |
void | setParameter (string id, float value) |
OutputList | getOutputDescriptors () const |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
void | reset () |
FeatureSet | process (const float *const *, RealTime) |
FeatureSet | getRemainingFeatures () |
+Private Member Functions | |
void | calculate () |
FeatureSet | assembleFeatures () |
float | lag2tempo (int) |
int | tempo2lag (float) |
+Private Attributes | |
float | m_inputSampleRate |
size_t | m_stepSize |
size_t | m_blockSize |
float | m_minbpm |
float | m_maxbpm |
float | m_maxdflen |
float * | m_priorMagnitudes |
size_t | m_dfsize |
float * | m_df |
float * | m_r |
float * | m_fr |
float * | m_t |
size_t | m_n |
Vamp::RealTime | m_start |
Vamp::RealTime | m_lasttime |
Definition at line 50 of file FixedTempoEstimator.cpp.
+FixedTempoEstimator::D::D | +( | +float | +inputSampleRate | ) | ++ |
Definition at line 99 of file FixedTempoEstimator.cpp.
+ +FixedTempoEstimator::D::~D | +( | +) | ++ |
Definition at line 115 of file FixedTempoEstimator.cpp.
+ +size_t FixedTempoEstimator::D::getPreferredStepSize | +( | +) | + const [inline] |
+
Definition at line 57 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::getPreferredStepSize().
+ +size_t FixedTempoEstimator::D::getPreferredBlockSize | +( | +) | + const [inline] |
+
Definition at line 58 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::getPreferredBlockSize().
+ +FixedTempoEstimator::ParameterList FixedTempoEstimator::D::getParameterDescriptors | +( | +) | +const | +
Definition at line 125 of file FixedTempoEstimator.cpp.
+ +References Vamp::PluginBase::ParameterDescriptor::defaultValue, Vamp::PluginBase::ParameterDescriptor::description, Vamp::PluginBase::ParameterDescriptor::identifier, Vamp::PluginBase::ParameterDescriptor::isQuantized, Vamp::PluginBase::ParameterDescriptor::maxValue, Vamp::PluginBase::ParameterDescriptor::minValue, Vamp::PluginBase::ParameterDescriptor::name, and Vamp::PluginBase::ParameterDescriptor::unit.
+ +Referenced by FixedTempoEstimator::getParameterDescriptors().
+ +float FixedTempoEstimator::D::getParameter | +( | +string | +id | ) | +const | +
Definition at line 159 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::getParameter().
+ +void FixedTempoEstimator::D::setParameter | +( | +string | +id, | +
+ | + | float | +value | +
+ | ) | ++ |
Definition at line 172 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::setParameter().
+ +FixedTempoEstimator::OutputList FixedTempoEstimator::D::getOutputDescriptors | +( | +) | +const | +
Definition at line 190 of file FixedTempoEstimator.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::FixedSampleRate, FixedTempoEstimator::getPreferredBlockSize(), Vamp::Plugin::OutputDescriptor::hasDuration, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, Vamp::Plugin::m_inputSampleRate, Vamp::Plugin::OutputDescriptor::maxValue, Vamp::Plugin::OutputDescriptor::minValue, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::quantizeStep, Vamp::Plugin::OutputDescriptor::sampleRate, Vamp::Plugin::OutputDescriptor::sampleType, Vamp::Plugin::OutputDescriptor::unit, and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +Referenced by FixedTempoEstimator::getOutputDescriptors().
+ +bool FixedTempoEstimator::D::initialise | +( | +size_t | +channels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | ++ |
Definition at line 252 of file FixedTempoEstimator.cpp.
+ +References Vamp::Plugin::m_inputSampleRate.
+ +Referenced by FixedTempoEstimator::initialise().
+ +void FixedTempoEstimator::D::reset | +( | +) | ++ |
Definition at line 276 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::reset().
+ +FixedTempoEstimator::FeatureSet FixedTempoEstimator::D::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +ts | +
+ | ) | ++ |
Definition at line 303 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::process().
+ +FixedTempoEstimator::FeatureSet FixedTempoEstimator::D::getRemainingFeatures | +( | +) | ++ |
Definition at line 352 of file FixedTempoEstimator.cpp.
+ +Referenced by FixedTempoEstimator::getRemainingFeatures().
+ +void FixedTempoEstimator::D::calculate | +( | +) | + [private] |
+
Definition at line 375 of file FixedTempoEstimator.cpp.
+ +References Vamp::Plugin::m_inputSampleRate.
+ +FixedTempoEstimator::FeatureSet FixedTempoEstimator::D::assembleFeatures | +( | +) | + [private] |
+
Definition at line 481 of file FixedTempoEstimator.cpp.
+ +References ACFOutput, CandidatesOutput, DFOutput, Vamp::Plugin::Feature::duration, FilteredACFOutput, Vamp::Plugin::Feature::hasDuration, Vamp::Plugin::Feature::hasTimestamp, Vamp::Plugin::Feature::label, Vamp::Plugin::m_inputSampleRate, TempoOutput, Vamp::Plugin::Feature::timestamp, and Vamp::Plugin::Feature::values.
+ +float FixedTempoEstimator::D::lag2tempo | +( | +int | +lag | ) | + [private] |
+
Definition at line 363 of file FixedTempoEstimator.cpp.
+ +References Vamp::Plugin::m_inputSampleRate.
+ +int FixedTempoEstimator::D::tempo2lag | +( | +float | +tempo | ) | + [private] |
+
Definition at line 369 of file FixedTempoEstimator.cpp.
+ +References Vamp::Plugin::m_inputSampleRate.
+ +float FixedTempoEstimator::D::m_inputSampleRate [private] |
+
Definition at line 78 of file FixedTempoEstimator.cpp.
+ +size_t FixedTempoEstimator::D::m_stepSize [private] |
+
Definition at line 79 of file FixedTempoEstimator.cpp.
+ +size_t FixedTempoEstimator::D::m_blockSize [private] |
+
Definition at line 80 of file FixedTempoEstimator.cpp.
+ +float FixedTempoEstimator::D::m_minbpm [private] |
+
Definition at line 82 of file FixedTempoEstimator.cpp.
+ +float FixedTempoEstimator::D::m_maxbpm [private] |
+
Definition at line 83 of file FixedTempoEstimator.cpp.
+ +float FixedTempoEstimator::D::m_maxdflen [private] |
+
Definition at line 84 of file FixedTempoEstimator.cpp.
+ +float* FixedTempoEstimator::D::m_priorMagnitudes [private] |
+
Definition at line 86 of file FixedTempoEstimator.cpp.
+ +size_t FixedTempoEstimator::D::m_dfsize [private] |
+
Definition at line 88 of file FixedTempoEstimator.cpp.
+ +float* FixedTempoEstimator::D::m_df [private] |
+
Definition at line 89 of file FixedTempoEstimator.cpp.
+ +float* FixedTempoEstimator::D::m_r [private] |
+
Definition at line 90 of file FixedTempoEstimator.cpp.
+ +float* FixedTempoEstimator::D::m_fr [private] |
+
Definition at line 91 of file FixedTempoEstimator.cpp.
+ +float* FixedTempoEstimator::D::m_t [private] |
+
Definition at line 92 of file FixedTempoEstimator.cpp.
+ +size_t FixedTempoEstimator::D::m_n [private] |
+
Definition at line 93 of file FixedTempoEstimator.cpp.
+ +Vamp::RealTime FixedTempoEstimator::D::m_start [private] |
+
Definition at line 95 of file FixedTempoEstimator.cpp.
+ +Vamp::RealTime FixedTempoEstimator::D::m_lasttime [private] |
+
Definition at line 96 of file FixedTempoEstimator.cpp.
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Example plugin that detects percussive events. + More...
+ +#include <PercussionOnsetDetector.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PercussionOnsetDetector (float inputSampleRate) | |
virtual | ~PercussionOnsetDetector () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string id) const |
Get the value of a named parameter. | |
void | setParameter (std::string id, float value) |
Set a named parameter. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Attributes | |
size_t | m_stepSize |
size_t | m_blockSize |
float | m_threshold |
float | m_sensitivity |
float * | m_priorMagnitudes |
float | m_dfMinus1 |
float | m_dfMinus2 |
float | m_inputSampleRate |
Example plugin that detects percussive events.
+ +Definition at line 46 of file PercussionOnsetDetector.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +PercussionOnsetDetector::PercussionOnsetDetector | +( | +float | +inputSampleRate | ) | ++ |
Definition at line 47 of file PercussionOnsetDetector.cpp.
+ +PercussionOnsetDetector::~PercussionOnsetDetector | +( | +) | + [virtual] |
+
Definition at line 59 of file PercussionOnsetDetector.cpp.
+ +References m_priorMagnitudes.
+ +bool PercussionOnsetDetector::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Definition at line 113 of file PercussionOnsetDetector.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), m_blockSize, m_dfMinus1, m_dfMinus2, m_priorMagnitudes, and m_stepSize.
+ +void PercussionOnsetDetector::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Definition at line 134 of file PercussionOnsetDetector.cpp.
+ +References m_blockSize, m_dfMinus1, m_dfMinus2, and m_priorMagnitudes.
+ +InputDomain PercussionOnsetDetector::getInputDomain | +( | +) | + const [inline, virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Definition at line 55 of file PercussionOnsetDetector.h.
+ +References Vamp::Plugin::FrequencyDomain.
+ +string PercussionOnsetDetector::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 65 of file PercussionOnsetDetector.cpp.
+ +string PercussionOnsetDetector::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 71 of file PercussionOnsetDetector.cpp.
+ +string PercussionOnsetDetector::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +Definition at line 77 of file PercussionOnsetDetector.cpp.
+ +string PercussionOnsetDetector::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +Definition at line 83 of file PercussionOnsetDetector.cpp.
+ +int PercussionOnsetDetector::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +Definition at line 89 of file PercussionOnsetDetector.cpp.
+ +string PercussionOnsetDetector::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +Definition at line 95 of file PercussionOnsetDetector.cpp.
+ +size_t PercussionOnsetDetector::getPreferredStepSize | +( | +) | + const [virtual] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Definition at line 101 of file PercussionOnsetDetector.cpp.
+ +size_t PercussionOnsetDetector::getPreferredBlockSize | +( | +) | + const [virtual] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Definition at line 107 of file PercussionOnsetDetector.cpp.
+ +PercussionOnsetDetector::ParameterList PercussionOnsetDetector::getParameterDescriptors | +( | +) | + const [virtual] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 145 of file PercussionOnsetDetector.cpp.
+ +References Vamp::PluginBase::ParameterDescriptor::defaultValue, Vamp::PluginBase::ParameterDescriptor::description, Vamp::PluginBase::ParameterDescriptor::identifier, Vamp::PluginBase::ParameterDescriptor::isQuantized, Vamp::PluginBase::ParameterDescriptor::maxValue, Vamp::PluginBase::ParameterDescriptor::minValue, Vamp::PluginBase::ParameterDescriptor::name, and Vamp::PluginBase::ParameterDescriptor::unit.
+ +float PercussionOnsetDetector::getParameter | +( | +std::string | +) | + const [virtual] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 174 of file PercussionOnsetDetector.cpp.
+ +References m_sensitivity, and m_threshold.
+ +void PercussionOnsetDetector::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Definition at line 182 of file PercussionOnsetDetector.cpp.
+ +References m_sensitivity, and m_threshold.
+ +PercussionOnsetDetector::OutputList PercussionOnsetDetector::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Definition at line 196 of file PercussionOnsetDetector.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, Vamp::Plugin::m_inputSampleRate, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::quantizeStep, Vamp::Plugin::OutputDescriptor::sampleRate, Vamp::Plugin::OutputDescriptor::sampleType, Vamp::Plugin::OutputDescriptor::unit, and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +PercussionOnsetDetector::FeatureSet PercussionOnsetDetector::process | +( | +const float *const * | +inputBuffers, | +
+ | + | Vamp::RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Definition at line 226 of file PercussionOnsetDetector.cpp.
+ +References Vamp::RealTime::frame2RealTime(), Vamp::Plugin::Feature::hasTimestamp, m_blockSize, m_dfMinus1, m_dfMinus2, Vamp::Plugin::m_inputSampleRate, m_priorMagnitudes, m_sensitivity, m_stepSize, m_threshold, Vamp::Plugin::Feature::timestamp, and Vamp::Plugin::Feature::values.
+ +PercussionOnsetDetector::FeatureSet PercussionOnsetDetector::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Definition at line 283 of file PercussionOnsetDetector.cpp.
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +size_t PercussionOnsetDetector::m_stepSize [protected] |
+
Definition at line 79 of file PercussionOnsetDetector.h.
+ +Referenced by initialise(), and process().
+ +size_t PercussionOnsetDetector::m_blockSize [protected] |
+
Definition at line 80 of file PercussionOnsetDetector.h.
+ +Referenced by initialise(), process(), and reset().
+ +float PercussionOnsetDetector::m_threshold [protected] |
+
Definition at line 82 of file PercussionOnsetDetector.h.
+ +Referenced by getParameter(), process(), and setParameter().
+ +float PercussionOnsetDetector::m_sensitivity [protected] |
+
Definition at line 83 of file PercussionOnsetDetector.h.
+ +Referenced by getParameter(), process(), and setParameter().
+ +float* PercussionOnsetDetector::m_priorMagnitudes [protected] |
+
Definition at line 84 of file PercussionOnsetDetector.h.
+ +Referenced by initialise(), process(), reset(), and ~PercussionOnsetDetector().
+ +float PercussionOnsetDetector::m_dfMinus1 [protected] |
+
Definition at line 85 of file PercussionOnsetDetector.h.
+ +Referenced by initialise(), process(), and reset().
+ +float PercussionOnsetDetector::m_dfMinus2 [protected] |
+
Definition at line 86 of file PercussionOnsetDetector.h.
+ +Referenced by initialise(), process(), and reset().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), SpectralCentroid::process(), ZeroCrossing::process(), process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Example plugin that returns a power spectrum calculated (trivially) from the frequency domain representation of each block of audio. + More...
+ +#include <PowerSpectrum.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PowerSpectrum (float inputSampleRate) | |
virtual | ~PowerSpectrum () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
virtual size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
virtual float | getParameter (std::string) const |
Get the value of a named parameter. | |
virtual void | setParameter (std::string, float) |
Set a named parameter. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Attributes | |
size_t | m_blockSize |
float | m_inputSampleRate |
Example plugin that returns a power spectrum calculated (trivially) from the frequency domain representation of each block of audio.
+This is one of the simplest possible Vamp plugins, included as an example of how to return the appropriate value structure for this sort of visualisation.
+ +Definition at line 50 of file PowerSpectrum.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +PowerSpectrum::PowerSpectrum | +( | +float | +inputSampleRate | ) | ++ |
Definition at line 45 of file PowerSpectrum.cpp.
+ +PowerSpectrum::~PowerSpectrum | +( | +) | + [virtual] |
+
Definition at line 51 of file PowerSpectrum.cpp.
+ +bool PowerSpectrum::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Definition at line 92 of file PowerSpectrum.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), and m_blockSize.
+ +void PowerSpectrum::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Definition at line 103 of file PowerSpectrum.cpp.
+ +InputDomain PowerSpectrum::getInputDomain | +( | +) | + const [inline, virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Definition at line 59 of file PowerSpectrum.h.
+ +References Vamp::Plugin::FrequencyDomain.
+ +string PowerSpectrum::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 56 of file PowerSpectrum.cpp.
+ +string PowerSpectrum::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 62 of file PowerSpectrum.cpp.
+ +string PowerSpectrum::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +Definition at line 68 of file PowerSpectrum.cpp.
+ +string PowerSpectrum::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +Definition at line 74 of file PowerSpectrum.cpp.
+ +int PowerSpectrum::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +Definition at line 80 of file PowerSpectrum.cpp.
+ +string PowerSpectrum::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +Definition at line 86 of file PowerSpectrum.cpp.
+ +PowerSpectrum::OutputList PowerSpectrum::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Definition at line 108 of file PowerSpectrum.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, m_blockSize, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::sampleType, and Vamp::Plugin::OutputDescriptor::unit.
+ +PowerSpectrum::FeatureSet PowerSpectrum::process | +( | +const float *const * | +inputBuffers, | +
+ | + | Vamp::RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Definition at line 136 of file PowerSpectrum.cpp.
+ +References Vamp::Plugin::Feature::hasTimestamp, m_blockSize, and Vamp::Plugin::Feature::values.
+ +PowerSpectrum::FeatureSet PowerSpectrum::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Definition at line 166 of file PowerSpectrum.cpp.
+ +virtual size_t Vamp::Plugin::getPreferredBlockSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 179 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getPreferredStepSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 194 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), initialise(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | +) | + const [inline, virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 208 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual float Vamp::PluginBase::getParameter | +( | +std::string | +) | + const [inline, virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 216 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [inline, virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 222 of file vamp-sdk/PluginBase.h.
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +size_t PowerSpectrum::m_blockSize [protected] |
+
Definition at line 76 of file PowerSpectrum.h.
+ +Referenced by getOutputDescriptors(), initialise(), and process().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Example plugin that calculates the centre of gravity of the frequency domain representation of each block of audio. + More...
+ +#include <SpectralCentroid.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
SpectralCentroid (float inputSampleRate) | |
virtual | ~SpectralCentroid () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
virtual size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
virtual float | getParameter (std::string) const |
Get the value of a named parameter. | |
virtual void | setParameter (std::string, float) |
Set a named parameter. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Attributes | |
size_t | m_stepSize |
size_t | m_blockSize |
float | m_inputSampleRate |
Example plugin that calculates the centre of gravity of the frequency domain representation of each block of audio.
+ +Definition at line 47 of file SpectralCentroid.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +SpectralCentroid::SpectralCentroid | +( | +float | +inputSampleRate | ) | ++ |
Definition at line 56 of file SpectralCentroid.cpp.
+ +SpectralCentroid::~SpectralCentroid | +( | +) | + [virtual] |
+
Definition at line 63 of file SpectralCentroid.cpp.
+ +bool SpectralCentroid::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Definition at line 104 of file SpectralCentroid.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), m_blockSize, and m_stepSize.
+ +void SpectralCentroid::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Definition at line 116 of file SpectralCentroid.cpp.
+ +InputDomain SpectralCentroid::getInputDomain | +( | +) | + const [inline, virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Definition at line 56 of file SpectralCentroid.h.
+ +References Vamp::Plugin::FrequencyDomain.
+ +string SpectralCentroid::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 68 of file SpectralCentroid.cpp.
+ +string SpectralCentroid::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 74 of file SpectralCentroid.cpp.
+ +string SpectralCentroid::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +Definition at line 80 of file SpectralCentroid.cpp.
+ +string SpectralCentroid::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +Definition at line 86 of file SpectralCentroid.cpp.
+ +int SpectralCentroid::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +Definition at line 92 of file SpectralCentroid.cpp.
+ +string SpectralCentroid::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +Definition at line 98 of file SpectralCentroid.cpp.
+ +SpectralCentroid::OutputList SpectralCentroid::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Definition at line 121 of file SpectralCentroid.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::sampleType, and Vamp::Plugin::OutputDescriptor::unit.
+ +SpectralCentroid::FeatureSet SpectralCentroid::process | +( | +const float *const * | +inputBuffers, | +
+ | + | Vamp::RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Definition at line 146 of file SpectralCentroid.cpp.
+ +References Vamp::Plugin::Feature::hasTimestamp, m_blockSize, Vamp::Plugin::m_inputSampleRate, m_stepSize, and Vamp::Plugin::Feature::values.
+ +SpectralCentroid::FeatureSet SpectralCentroid::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Definition at line 192 of file SpectralCentroid.cpp.
+ +virtual size_t Vamp::Plugin::getPreferredBlockSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 179 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getPreferredStepSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 194 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | +) | + const [inline, virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 208 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual float Vamp::PluginBase::getParameter | +( | +std::string | +) | + const [inline, virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 216 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [inline, virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 222 of file vamp-sdk/PluginBase.h.
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +size_t SpectralCentroid::m_stepSize [protected] |
+
Definition at line 73 of file SpectralCentroid.h.
+ +Referenced by initialise(), and process().
+ +size_t SpectralCentroid::m_blockSize [protected] |
+
Definition at line 74 of file SpectralCentroid.h.
+ +Referenced by initialise(), and process().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), process(), ZeroCrossing::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginBufferingAdapter is a Vamp plugin adapter that allows plugins to be used by a host supplying an audio stream in non-overlapping buffers of arbitrary size. + More...
+ +#include <vamp-hostsdk/PluginBufferingAdapter.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PluginBufferingAdapter (Plugin *plugin) | |
Construct a PluginBufferingAdapter wrapping the given plugin. | |
virtual | ~PluginBufferingAdapter () |
size_t | getPreferredStepSize () const |
Return the preferred step size for this adapter. | |
size_t | getPreferredBlockSize () const |
Return the preferred block size for this adapter. | |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
Initialise the adapter (and therefore the plugin) for the given number of channels. | |
size_t | getPluginPreferredStepSize () const |
Return the preferred step size of the plugin wrapped by this adapter. | |
size_t | getPluginPreferredBlockSize () const |
Return the preferred block size of the plugin wrapped by this adapter. | |
void | setPluginStepSize (size_t stepSize) |
Set the step size that will be used for the underlying plugin when initialise() is called. | |
void | setPluginBlockSize (size_t blockSize) |
Set the block size that will be used for the underlying plugin when initialise() is called. | |
void | getActualStepAndBlockSizes (size_t &stepSize, size_t &blockSize) |
Return the step and block sizes that were actually used when initialising the underlying plugin. | |
void | setParameter (std::string, float) |
Set a named parameter. | |
void | selectProgram (std::string) |
Select a program. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string) const |
Get the value of a named parameter. | |
ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
std::string | getCurrentProgram () const |
Get the current program. | |
size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
template<typename WrapperType > | |
WrapperType * | getWrapper () |
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
+Protected Attributes | |
Impl * | m_impl |
Plugin * | m_plugin |
float | m_inputSampleRate |
PluginBufferingAdapter is a Vamp plugin adapter that allows plugins to be used by a host supplying an audio stream in non-overlapping buffers of arbitrary size.
+A host using PluginBufferingAdapter may ignore the preferred step and block size reported by the plugin, and still expect the plugin to run. The value of blockSize and stepSize passed to initialise should be the size of the buffer which the host will supply; the stepSize should be equal to the blockSize.
+If the internal step size used for the plugin differs from that supplied by the host, the adapter will modify the sample type and rate specifications for the plugin outputs appropriately, and set timestamps on the output features for outputs that formerly used a different sample rate specification. This is necessary in order to obtain correct time stamping.
+In other respects, the PluginBufferingAdapter behaves identically to the plugin that it wraps. The wrapped plugin will be deleted when the wrapper is deleted.
+ +Definition at line 75 of file PluginBufferingAdapter.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter | +( | +Plugin * | +plugin | ) | ++ |
Construct a PluginBufferingAdapter wrapping the given plugin.
+The adapter takes ownership of the plugin, which will be deleted when the adapter is deleted.
+ +virtual Vamp::HostExt::PluginBufferingAdapter::~PluginBufferingAdapter | +( | +) | + [virtual] |
+
size_t Vamp::HostExt::PluginBufferingAdapter::getPreferredStepSize | +( | +) | + const [virtual] |
+
Return the preferred step size for this adapter.
+Because of the way this adapter works, its preferred step size will always be the same as its preferred block size. This may or may not be the same as the preferred step size of the underlying plugin, which may be obtained by calling getPluginPreferredStepSize().
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +size_t Vamp::HostExt::PluginBufferingAdapter::getPreferredBlockSize | +( | +) | + const [virtual] |
+
Return the preferred block size for this adapter.
+This may or may not be the same as the preferred block size of the underlying plugin, which may be obtained by calling getPluginPreferredBlockSize().
+Note that this adapter may be initialised with any block size, not just its supposedly preferred one.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +bool Vamp::HostExt::PluginBufferingAdapter::initialise | +( | +size_t | +channels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
Initialise the adapter (and therefore the plugin) for the given number of channels.
+Initialise the adapter for the given step and block size, which must be equal.
+The step and block size used for the underlying plugin will depend on its preferences, or any values previously passed to setPluginStepSize and setPluginBlockSize.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +size_t Vamp::HostExt::PluginBufferingAdapter::getPluginPreferredStepSize | +( | +) | +const | +
Return the preferred step size of the plugin wrapped by this adapter.
+This is included mainly for informational purposes. This value is not likely to be a valid step size for the adapter itself, and it is not usually of any use in interpreting the results (because the adapter re-writes OneSamplePerStep outputs to FixedSampleRate so that the hop size no longer needs to be known beforehand in order to interpret them).
+ +size_t Vamp::HostExt::PluginBufferingAdapter::getPluginPreferredBlockSize | +( | +) | +const | +
Return the preferred block size of the plugin wrapped by this adapter.
+This is included mainly for informational purposes.
+ +void Vamp::HostExt::PluginBufferingAdapter::setPluginStepSize | +( | +size_t | +stepSize | ) | ++ |
Set the step size that will be used for the underlying plugin when initialise() is called.
+If this is not set, the plugin's own preferred step size will be used. You will not usually need to call this function. If you do call it, it must be before the first call to initialise().
+ +void Vamp::HostExt::PluginBufferingAdapter::setPluginBlockSize | +( | +size_t | +blockSize | ) | ++ |
Set the block size that will be used for the underlying plugin when initialise() is called.
+If this is not set, the plugin's own preferred block size will be used. You will not usually need to call this function. If you do call it, it must be before the first call to initialise().
+ +void Vamp::HostExt::PluginBufferingAdapter::getActualStepAndBlockSizes | +( | +size_t & | +stepSize, | +
+ | + | size_t & | +blockSize | +
+ | ) | ++ |
Return the step and block sizes that were actually used when initialising the underlying plugin.
+This is included mainly for informational purposes. You will not usually need to call this function. If this is called before initialise(), it will return 0 for both values. If it is called after a failed call to initialise(), it will return the values that were used in the failed call to the plugin's initialise() function.
+ +void Vamp::HostExt::PluginBufferingAdapter::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +void Vamp::HostExt::PluginBufferingAdapter::selectProgram | +( | +std::string | +) | + [virtual] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +OutputList Vamp::HostExt::PluginBufferingAdapter::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +void Vamp::HostExt::PluginBufferingAdapter::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginBufferingAdapter::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginBufferingAdapter::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +InputDomain Vamp::HostExt::PluginWrapper::getInputDomain | +( | +) | + const [virtual, inherited] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | +) | + const [virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getIdentifier | +( | +) | + const [virtual, inherited] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getName | +( | +) | + const [virtual, inherited] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getDescription | +( | +) | + const [virtual, inherited] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getMaker | +( | +) | + const [virtual, inherited] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | +) | + const [virtual, inherited] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCopyright | +( | +) | + const [virtual, inherited] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +float Vamp::HostExt::PluginWrapper::getParameter | +( | +std::string | +) | + const [virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +ProgramList Vamp::HostExt::PluginWrapper::getPrograms | +( | +) | + const [virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | +) | + const [virtual, inherited] |
+
Get the current program.
+ +Reimplemented from Vamp::PluginBase.
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +WrapperType* Vamp::HostExt::PluginWrapper::getWrapper | +( | +) | + [inline, inherited] |
+
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present.
+This is useful in situations where a plugin is wrapped by multiple different wrappers (one inside another) and the host wants to call some wrapper-specific function on one of the layers without having to care about the order in which they are wrapped. For example, the plugin returned by PluginLoader::loadPlugin may have more than one wrapper; if the host wanted to query or fine-tune some property of one of them, it would be hard to do so without knowing the order of the wrappers. This function therefore gives direct access to the wrapper of a particular type.
+ +Definition at line 116 of file PluginWrapper.h.
+ +References Vamp::HostExt::PluginWrapper::getWrapper().
+ +Referenced by Vamp::HostExt::PluginWrapper::getWrapper(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +Impl* Vamp::HostExt::PluginBufferingAdapter::m_impl [protected] |
+
Definition at line 184 of file PluginBufferingAdapter.h.
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
Definition at line 126 of file PluginWrapper.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), SpectralCentroid::process(), ZeroCrossing::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginChannelAdapter is a Vamp plugin adapter that implements a policy for management of plugins that expect a different number of input channels from the number actually available in the source audio data. + More...
+ +#include <vamp-hostsdk/PluginChannelAdapter.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PluginChannelAdapter (Plugin *plugin) | |
Construct a PluginChannelAdapter wrapping the given plugin. | |
virtual | ~PluginChannelAdapter () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | processInterleaved (const float *inputBuffer, RealTime timestamp) |
Call process(), providing interleaved audio data with the number of channels passed to initialise(). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string) const |
Get the value of a named parameter. | |
void | setParameter (std::string, float) |
Set a named parameter. | |
ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
std::string | getCurrentProgram () const |
Get the current program. | |
void | selectProgram (std::string) |
Select a program. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
template<typename WrapperType > | |
WrapperType * | getWrapper () |
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
+Protected Attributes | |
Impl * | m_impl |
Plugin * | m_plugin |
float | m_inputSampleRate |
PluginChannelAdapter is a Vamp plugin adapter that implements a policy for management of plugins that expect a different number of input channels from the number actually available in the source audio data.
+A host using PluginChannelAdapter may ignore the getMinChannelCount and getMaxChannelCount reported by the plugin, and still expect the plugin to run.
+PluginChannelAdapter implements the following policy:
+If none of the above apply:
+Hosts requiring a different channel policy from the above will need to implement it themselves, instead of using PluginChannelAdapter.
+Note that PluginChannelAdapter does not override the minimum and maximum channel counts returned by the wrapped plugin. The host will need to be aware that it is using a PluginChannelAdapter, and be prepared to ignore these counts as necessary. (This contrasts with the approach used in PluginInputDomainAdapter, which aims to make the host completely unaware of which underlying input domain is in fact in use.)
+(The rationale for this is that a host may wish to use the PluginChannelAdapter but still discriminate in some way on the basis of the number of channels actually supported. For example, a simple stereo audio host may prefer to reject plugins that require more than two channels on the grounds that doesn't actually understand what they are for, rather than allow the channel adapter to make a potentially meaningless channel conversion for them.)
+In every respect other than its management of channels, the PluginChannelAdapter behaves identically to the plugin that it wraps. The wrapped plugin will be deleted when the wrapper is deleted.
+Definition at line 112 of file PluginChannelAdapter.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +Vamp::HostExt::PluginChannelAdapter::PluginChannelAdapter | +( | +Plugin * | +plugin | ) | ++ |
Construct a PluginChannelAdapter wrapping the given plugin.
+The adapter takes ownership of the plugin, which will be deleted when the adapter is deleted.
+ +virtual Vamp::HostExt::PluginChannelAdapter::~PluginChannelAdapter | +( | +) | + [virtual] |
+
bool Vamp::HostExt::PluginChannelAdapter::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginChannelAdapter::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginChannelAdapter::processInterleaved | +( | +const float * | +inputBuffer, | +
+ | + | RealTime | +timestamp | +
+ | ) | ++ |
Call process(), providing interleaved audio data with the number of channels passed to initialise().
+The adapter will de-interleave into temporary buffers as appropriate before calling process().
+void Vamp::HostExt::PluginWrapper::reset | +( | +) | + [virtual, inherited] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +InputDomain Vamp::HostExt::PluginWrapper::getInputDomain | +( | +) | + const [virtual, inherited] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | +) | + const [virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getIdentifier | +( | +) | + const [virtual, inherited] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getName | +( | +) | + const [virtual, inherited] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getDescription | +( | +) | + const [virtual, inherited] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getMaker | +( | +) | + const [virtual, inherited] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | +) | + const [virtual, inherited] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCopyright | +( | +) | + const [virtual, inherited] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +float Vamp::HostExt::PluginWrapper::getParameter | +( | +std::string | +) | + const [virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +ProgramList Vamp::HostExt::PluginWrapper::getPrograms | +( | +) | + const [virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | +) | + const [virtual, inherited] |
+
Get the current program.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::selectProgram | +( | +std::string | +) | + [virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getPreferredStepSize | +( | +) | + const [virtual, inherited] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getPreferredBlockSize | +( | +) | + const [virtual, inherited] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +OutputList Vamp::HostExt::PluginWrapper::getOutputDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +FeatureSet Vamp::HostExt::PluginWrapper::getRemainingFeatures | +( | +) | + [virtual, inherited] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +WrapperType* Vamp::HostExt::PluginWrapper::getWrapper | +( | +) | + [inline, inherited] |
+
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present.
+This is useful in situations where a plugin is wrapped by multiple different wrappers (one inside another) and the host wants to call some wrapper-specific function on one of the layers without having to care about the order in which they are wrapped. For example, the plugin returned by PluginLoader::loadPlugin may have more than one wrapper; if the host wanted to query or fine-tune some property of one of them, it would be hard to do so without knowing the order of the wrappers. This function therefore gives direct access to the wrapper of a particular type.
+ +Definition at line 116 of file PluginWrapper.h.
+ +References Vamp::HostExt::PluginWrapper::getWrapper().
+ +Referenced by Vamp::HostExt::PluginWrapper::getWrapper(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +Impl* Vamp::HostExt::PluginChannelAdapter::m_impl [protected] |
+
Definition at line 139 of file PluginChannelAdapter.h.
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
Definition at line 126 of file PluginWrapper.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginInputDomainAdapter is a Vamp plugin adapter that converts time-domain input into frequency-domain input for plugins that need it. + More...
+ +#include <vamp-hostsdk/PluginInputDomainAdapter.h>
+Public Types | |
enum | ProcessTimestampMethod { ShiftTimestamp, +ShiftData, +NoShift + } |
ProcessTimestampMethod determines how the PluginInputDomainAdapter handles timestamps for the data passed to the process() function of the plugin it wraps, in the case where the plugin is expecting frequency-domain data. More... | |
enum | WindowType { + RectangularWindow = 0, +BartlettWindow = 1, +TriangularWindow = 1, +HammingWindow = 2, + + HanningWindow = 3, +HannWindow = 3, +BlackmanWindow = 4, +NuttallWindow = 7, + + BlackmanHarrisWindow = 8 + + } |
The set of supported window shapes. More... | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PluginInputDomainAdapter (Plugin *plugin) | |
Construct a PluginInputDomainAdapter wrapping the given plugin. | |
virtual | ~PluginInputDomainAdapter () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Process a single block of input data. | |
void | setProcessTimestampMethod (ProcessTimestampMethod) |
Set the method used for timestamp adjustment in plugins taking frequency-domain input. | |
ProcessTimestampMethod | getProcessTimestampMethod () const |
Retrieve the method used for timestamp adjustment in plugins taking frequency-domain input. | |
RealTime | getTimestampAdjustment () const |
Return the amount by which the timestamps supplied to process() are being incremented when they are passed to the plugin's own process() implementation. | |
WindowType | getWindowType () const |
Return the current window shape. | |
void | setWindowType (WindowType type) |
Set the current window shape. | |
unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string) const |
Get the value of a named parameter. | |
void | setParameter (std::string, float) |
Set a named parameter. | |
ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
std::string | getCurrentProgram () const |
Get the current program. | |
void | selectProgram (std::string) |
Select a program. | |
size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
template<typename WrapperType > | |
WrapperType * | getWrapper () |
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
+Protected Attributes | |
Impl * | m_impl |
Plugin * | m_plugin |
float | m_inputSampleRate |
PluginInputDomainAdapter is a Vamp plugin adapter that converts time-domain input into frequency-domain input for plugins that need it.
+This permits a host to use time- and frequency-domain plugins interchangeably without needing to handle the conversion itself.
+This adapter uses a basic windowed FFT (using Hann window by default) that supports power-of-two block sizes only. If a frequency domain plugin requests a non-power-of-two blocksize, the adapter will adjust it to a nearby power of two instead. Thus, getPreferredBlockSize() will always return a power of two if the wrapped plugin is a frequency domain one. If the plugin doesn't accept the adjusted power of two block size, initialise() will fail.
+The adapter provides no way for the host to discover whether the underlying plugin is actually a time or frequency domain plugin (except that if the preferred block size is not a power of two, it must be a time domain plugin).
+The FFT implementation is simple and self-contained, but unlikely to be the fastest available: a host can usually do better if it cares enough.
+The window shape for the FFT frame can be set using setWindowType and the current shape retrieved using getWindowType. (This was added in v2.3 of the SDK.)
+In every respect other than its input domain handling, the PluginInputDomainAdapter behaves identically to the plugin that it wraps. The wrapped plugin will be deleted when the wrapper is deleted.
+Definition at line 87 of file PluginInputDomainAdapter.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::HostExt::PluginInputDomainAdapter::ProcessTimestampMethod | +
ProcessTimestampMethod determines how the PluginInputDomainAdapter handles timestamps for the data passed to the process() function of the plugin it wraps, in the case where the plugin is expecting frequency-domain data.
+The Vamp specification requires that the timestamp passed to the plugin for frequency-domain input should be that of the centre of the processing block, rather than the start as is the case for time-domain input.
+Since PluginInputDomainAdapter aims to be transparent in use, it needs to handle this timestamp adjustment itself. However, some control is available over the method used for adjustment, by means of the ProcessTimestampMethod setting.
+If ProcessTimestampMethod is set to ShiftTimestamp (the default), then the data passed to the wrapped plugin will be calculated from the same input data block as passed to the wrapper, but the timestamp passed to the plugin will be advanced by half of the window size.
+If ProcessTimestampMethod is set to ShiftData, then the timestamp passed to the wrapped plugin will be the same as that passed to the process call of the wrapper, but the data block used to calculate the input will be shifted back (earlier) by half of the window size, with half a block of zero padding at the start of the first process call. This has the advantage of preserving the first half block of audio without any deterioration from window shaping.
+If ProcessTimestampMethod is set to NoShift, then no adjustment will be made and the timestamps will be incorrect.
+ + +Definition at line 142 of file PluginInputDomainAdapter.h.
+ +enum Vamp::HostExt::PluginInputDomainAdapter::WindowType | +
The set of supported window shapes.
+Definition at line 195 of file PluginInputDomainAdapter.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter | +( | +Plugin * | +plugin | ) | ++ |
Construct a PluginInputDomainAdapter wrapping the given plugin.
+The adapter takes ownership of the plugin, which will be deleted when the adapter is deleted.
+ +virtual Vamp::HostExt::PluginInputDomainAdapter::~PluginInputDomainAdapter | +( | +) | + [virtual] |
+
bool Vamp::HostExt::PluginInputDomainAdapter::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +void Vamp::HostExt::PluginInputDomainAdapter::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +InputDomain Vamp::HostExt::PluginInputDomainAdapter::getInputDomain | +( | +) | + const [virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +size_t Vamp::HostExt::PluginInputDomainAdapter::getPreferredStepSize | +( | +) | + const [virtual] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +size_t Vamp::HostExt::PluginInputDomainAdapter::getPreferredBlockSize | +( | +) | + const [virtual] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginInputDomainAdapter::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +void Vamp::HostExt::PluginInputDomainAdapter::setProcessTimestampMethod | +( | +ProcessTimestampMethod | +) | ++ |
Set the method used for timestamp adjustment in plugins taking frequency-domain input.
+See the ProcessTimestampMethod documentation for details.
+This function must be called before the first call to process().
+ +ProcessTimestampMethod Vamp::HostExt::PluginInputDomainAdapter::getProcessTimestampMethod | +( | +) | +const | +
Retrieve the method used for timestamp adjustment in plugins taking frequency-domain input.
+See the ProcessTimestampMethod documentation for details.
+ +RealTime Vamp::HostExt::PluginInputDomainAdapter::getTimestampAdjustment | +( | +) | +const | +
Return the amount by which the timestamps supplied to process() are being incremented when they are passed to the plugin's own process() implementation.
+The Vamp API mandates that the timestamp passed to the plugin for time-domain input should be the time of the first sample in the block, but the timestamp passed for frequency-domain input should be the timestamp of the centre of the block.
+The PluginInputDomainAdapter adjusts its timestamps properly so that the plugin receives correct times, but in some circumstances (such as for establishing the correct timing of implicitly-timed features, i.e. features without their own timestamps) the host may need to be aware that this adjustment is taking place.
+If the plugin requires time-domain input or the PluginInputDomainAdapter is configured with its ProcessTimestampMethod set to ShiftData instead of ShiftTimestamp, then this function will return zero.
+The result of calling this function before initialise() has been called is undefined.
+ +Referenced by runPlugin().
+ +WindowType Vamp::HostExt::PluginInputDomainAdapter::getWindowType | +( | +) | +const | +
Return the current window shape.
+The default is HanningWindow.
+ +void Vamp::HostExt::PluginInputDomainAdapter::setWindowType | +( | +WindowType | +type | ) | ++ |
Set the current window shape.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | +) | + const [virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getIdentifier | +( | +) | + const [virtual, inherited] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getName | +( | +) | + const [virtual, inherited] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getDescription | +( | +) | + const [virtual, inherited] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getMaker | +( | +) | + const [virtual, inherited] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | +) | + const [virtual, inherited] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCopyright | +( | +) | + const [virtual, inherited] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +float Vamp::HostExt::PluginWrapper::getParameter | +( | +std::string | +) | + const [virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +ProgramList Vamp::HostExt::PluginWrapper::getPrograms | +( | +) | + const [virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | +) | + const [virtual, inherited] |
+
Get the current program.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::selectProgram | +( | +std::string | +) | + [virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +OutputList Vamp::HostExt::PluginWrapper::getOutputDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +FeatureSet Vamp::HostExt::PluginWrapper::getRemainingFeatures | +( | +) | + [virtual, inherited] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +WrapperType* Vamp::HostExt::PluginWrapper::getWrapper | +( | +) | + [inline, inherited] |
+
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present.
+This is useful in situations where a plugin is wrapped by multiple different wrappers (one inside another) and the host wants to call some wrapper-specific function on one of the layers without having to care about the order in which they are wrapped. For example, the plugin returned by PluginLoader::loadPlugin may have more than one wrapper; if the host wanted to query or fine-tune some property of one of them, it would be hard to do so without knowing the order of the wrappers. This function therefore gives direct access to the wrapper of a particular type.
+ +Definition at line 116 of file PluginWrapper.h.
+ +References Vamp::HostExt::PluginWrapper::getWrapper().
+ +Referenced by Vamp::HostExt::PluginWrapper::getWrapper(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +Impl* Vamp::HostExt::PluginInputDomainAdapter::m_impl [protected] |
+
Definition at line 226 of file PluginInputDomainAdapter.h.
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
Definition at line 126 of file PluginWrapper.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), SpectralCentroid::process(), ZeroCrossing::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Vamp::HostExt::PluginLoader is a convenience class for discovering and loading Vamp plugins using the typical plugin-path, library naming, and categorisation conventions described in the Vamp SDK documentation. + More...
+ +#include <vamp-hostsdk/PluginLoader.h>
+Public Types | |
enum | AdapterFlags { + ADAPT_INPUT_DOMAIN = 0x01, +ADAPT_CHANNEL_COUNT = 0x02, +ADAPT_BUFFER_SIZE = 0x04, +ADAPT_ALL_SAFE = 0x03, + + ADAPT_ALL = 0xff + + } |
AdapterFlags contains a set of values that may be OR'd together to indicate in which circumstances PluginLoader should use a plugin adapter to make a plugin easier to use for a host that does not want to cater for complex features. More... | |
typedef std::string | PluginKey |
PluginKey is a string type that is used to identify a plugin uniquely within the scope of "the current system". | |
typedef std::vector< PluginKey > | PluginKeyList |
PluginKeyList is a sequence of plugin keys, such as returned by listPlugins(). | |
typedef std::vector< std::string > | PluginCategoryHierarchy |
PluginCategoryHierarchy is a sequence of general->specific category names, as may be associated with a single plugin. | |
+Public Member Functions | |
PluginKeyList | listPlugins () |
Search for all available Vamp plugins, and return a list of them in the order in which they were found. | |
Plugin * | loadPlugin (PluginKey key, float inputSampleRate, int adapterFlags=0) |
Load a Vamp plugin, given its identifying key. | |
PluginKey | composePluginKey (std::string libraryName, std::string identifier) |
Given a Vamp plugin library name and plugin identifier, return the corresponding plugin key in a form suitable for passing in to loadPlugin(). | |
PluginCategoryHierarchy | getPluginCategory (PluginKey plugin) |
Return the category hierarchy for a Vamp plugin, given its identifying key. | |
std::string | getLibraryPathForPlugin (PluginKey plugin) |
Return the file path of the dynamic library from which the given plugin will be loaded (if available). | |
+Static Public Member Functions | |
static PluginLoader * | getInstance () |
Obtain a pointer to the singleton instance of PluginLoader. | |
+Protected Member Functions | |
PluginLoader () | |
virtual | ~PluginLoader () |
+Protected Attributes | |
Impl * | m_impl |
+Static Protected Attributes | |
static PluginLoader * | m_instance |
Vamp::HostExt::PluginLoader is a convenience class for discovering and loading Vamp plugins using the typical plugin-path, library naming, and categorisation conventions described in the Vamp SDK documentation.
+This class is intended to greatly simplify the task of becoming a Vamp plugin host for any C++ application.
+Hosts are not required by the Vamp specification to use the same plugin search path and naming conventions as implemented by this class, and are certainly not required to use this actual class. But we do strongly recommend it.
+Definition at line 72 of file PluginLoader.h.
+typedef std::string Vamp::HostExt::PluginLoader::PluginKey | +
PluginKey is a string type that is used to identify a plugin uniquely within the scope of "the current system".
+It consists of the lower-cased base name of the plugin library, a colon separator, and the identifier string for the plugin. It is only meaningful in the context of a given plugin path (the one returned by PluginHostAdapter::getPluginPath()).
+Use composePluginKey() to construct a plugin key from a known plugin library name and identifier.
+Note: the fact that the library component of the key is lower-cased implies that library names are matched case-insensitively by the PluginLoader class, regardless of the case sensitivity of the underlying filesystem. (Plugin identifiers _are_ case sensitive, however.) Also, it is not possible to portably extract a working library name from a plugin key, as the result may fail on case-sensitive filesystems. Use getLibraryPathForPlugin() instead.
+ +Definition at line 101 of file PluginLoader.h.
+ +typedef std::vector<PluginKey> Vamp::HostExt::PluginLoader::PluginKeyList | +
PluginKeyList is a sequence of plugin keys, such as returned by listPlugins().
+ +Definition at line 107 of file PluginLoader.h.
+ +typedef std::vector<std::string> Vamp::HostExt::PluginLoader::PluginCategoryHierarchy | +
PluginCategoryHierarchy is a sequence of general->specific category names, as may be associated with a single plugin.
+This sequence describes the location of a plugin within a category forest, containing the human-readable names of the plugin's category tree root, followed by each of the nodes down to the leaf containing the plugin.
+Definition at line 119 of file PluginLoader.h.
+ +enum Vamp::HostExt::PluginLoader::AdapterFlags | +
AdapterFlags contains a set of values that may be OR'd together to indicate in which circumstances PluginLoader should use a plugin adapter to make a plugin easier to use for a host that does not want to cater for complex features.
+The available flags are:
+ADAPT_INPUT_DOMAIN - If the plugin expects frequency domain input, wrap it in a PluginInputDomainAdapter that automatically converts the plugin to one that expects time-domain input. This enables a host to accommodate time- and frequency-domain plugins without needing to do any conversion itself.
+ADAPT_CHANNEL_COUNT - Wrap the plugin in a PluginChannelAdapter to handle any mismatch between the number of channels of audio the plugin can handle and the number available in the host. This enables a host to use plugins that may require the input to be mixed down to mono, etc., without having to worry about doing that itself.
+ADAPT_BUFFER_SIZE - Wrap the plugin in a PluginBufferingAdapter permitting the host to provide audio input using any block size, with no overlap, regardless of the plugin's preferred block size (suitable for hosts that read from non-seekable streaming media, for example). This adapter introduces some run-time overhead and also changes the semantics of the plugin slightly (see the PluginBufferingAdapter header documentation for details).
+ADAPT_ALL_SAFE - Perform all available adaptations that are meaningful for the plugin and "safe". Currently this means to ADAPT_INPUT_DOMAIN if the plugin wants FrequencyDomain input; ADAPT_CHANNEL_COUNT always; and ADAPT_BUFFER_SIZE never.
+ADAPT_ALL - Perform all available adaptations that are meaningful for the plugin.
+See PluginInputDomainAdapter, PluginChannelAdapter and PluginBufferingAdapter for more details of the classes that the loader may use if these flags are set.
+ADAPT_INPUT_DOMAIN | + |
ADAPT_CHANNEL_COUNT | + |
ADAPT_BUFFER_SIZE | + |
ADAPT_ALL_SAFE | + |
ADAPT_ALL | + |
Definition at line 169 of file PluginLoader.h.
+ +Vamp::HostExt::PluginLoader::PluginLoader | +( | +) | + [protected] |
+
virtual Vamp::HostExt::PluginLoader::~PluginLoader | +( | +) | + [protected, virtual] |
+
static PluginLoader* Vamp::HostExt::PluginLoader::getInstance | +( | +) | + [static] |
+
Obtain a pointer to the singleton instance of PluginLoader.
+Use this to obtain your loader object.
+ +PluginKeyList Vamp::HostExt::PluginLoader::listPlugins | +( | +) | ++ |
Search for all available Vamp plugins, and return a list of them in the order in which they were found.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +Plugin* Vamp::HostExt::PluginLoader::loadPlugin | +( | +PluginKey | +key, | +
+ | + | float | +inputSampleRate, | +
+ | + | int | +adapterFlags = 0 |
+
+ | ) | ++ |
Load a Vamp plugin, given its identifying key.
+If the plugin could not be loaded, returns 0.
+The returned plugin should be deleted (using the standard C++ delete keyword) after use.
+adapterFlags | a bitwise OR of the values in the AdapterFlags enumeration, indicating under which circumstances an adapter should be used to wrap the original plugin. If adapterFlags is 0, no optional adapters will be used. Otherwise, the returned plugin may be of an adapter class type which will behave identically to the original plugin, apart from any particular features implemented by the adapter itself. |
Referenced by enumeratePlugins(), printPluginCategoryList(), and runPlugin().
+ +PluginKey Vamp::HostExt::PluginLoader::composePluginKey | +( | +std::string | +libraryName, | +
+ | + | std::string | +identifier | +
+ | ) | ++ |
Given a Vamp plugin library name and plugin identifier, return the corresponding plugin key in a form suitable for passing in to loadPlugin().
+ +Referenced by runPlugin().
+ +PluginCategoryHierarchy Vamp::HostExt::PluginLoader::getPluginCategory | +( | +PluginKey | +plugin | ) | ++ |
Return the category hierarchy for a Vamp plugin, given its identifying key.
+If the plugin has no category information, return an empty hierarchy.
+Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +std::string Vamp::HostExt::PluginLoader::getLibraryPathForPlugin | +( | +PluginKey | +plugin | ) | ++ |
Return the file path of the dynamic library from which the given plugin will be loaded (if available).
+ +Referenced by enumeratePlugins().
+ +Impl* Vamp::HostExt::PluginLoader::m_impl [protected] |
+
Definition at line 230 of file PluginLoader.h.
+ +PluginLoader* Vamp::HostExt::PluginLoader::m_instance [static, protected] |
+
Definition at line 233 of file PluginLoader.h.
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginSummarisingAdapter is a Vamp plugin adapter that provides summarisation methods such as mean and median averages of output features, for use in any context where an available plugin produces individual values but the result that is actually needed is some sort of aggregate. + More...
+ +#include <vamp-hostsdk/PluginSummarisingAdapter.h>
+Public Types | |
enum | SummaryType { + Minimum = 0, +Maximum = 1, +Mean = 2, +Median = 3, + + Mode = 4, +Sum = 5, +Variance = 6, +StandardDeviation = 7, + + Count = 8, +UnknownSummaryType = 999 + + } |
enum | AveragingMethod { SampleAverage = 0, +ContinuousTimeAverage = 1 + } |
AveragingMethod indicates how the adapter should handle average-based summaries of features whose results are not equally spaced in time. More... | |
typedef std::set< RealTime > | SegmentBoundaries |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PluginSummarisingAdapter (Plugin *plugin) | |
Construct a PluginSummarisingAdapter wrapping the given plugin. | |
virtual | ~PluginSummarisingAdapter () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
void | setSummarySegmentBoundaries (const SegmentBoundaries &) |
Specify a series of segment boundaries, such that one summary will be returned for each of the contiguous intra-boundary segments. | |
FeatureList | getSummaryForOutput (int output, SummaryType type, AveragingMethod method=SampleAverage) |
Return summaries of the features that were returned on the given output, using the given SummaryType and AveragingMethod. | |
FeatureSet | getSummaryForAllOutputs (SummaryType type, AveragingMethod method=SampleAverage) |
Return summaries of the features that were returned on all of the plugin's outputs, using the given SummaryType and AveragingMethod. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string) const |
Get the value of a named parameter. | |
void | setParameter (std::string, float) |
Set a named parameter. | |
ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
std::string | getCurrentProgram () const |
Get the current program. | |
void | selectProgram (std::string) |
Select a program. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
template<typename WrapperType > | |
WrapperType * | getWrapper () |
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
+Protected Attributes | |
Impl * | m_impl |
Plugin * | m_plugin |
float | m_inputSampleRate |
PluginSummarisingAdapter is a Vamp plugin adapter that provides summarisation methods such as mean and median averages of output features, for use in any context where an available plugin produces individual values but the result that is actually needed is some sort of aggregate.
+To make use of PluginSummarisingAdapter, the host should configure, initialise and run the plugin through the adapter interface just as normal. Then, after the process and getRemainingFeatures methods have been properly called and processing is complete, the host may call getSummaryForOutput or getSummaryForAllOutputs to obtain summarised features: averages, maximum values, etc, depending on the SummaryType passed to the function.
+By default PluginSummarisingAdapter calculates a single summary of each output's feature across the whole duration of processed audio. A host needing summaries of sub-segments of the whole audio may call setSummarySegmentBoundaries before retrieving the summaries, providing a list of times such that one summary will be provided for each segment between two consecutive times.
+PluginSummarisingAdapter is straightforward rather than fast. It calculates all of the summary types for all outputs always, and then returns only the ones that are requested. It is designed on the basis that, for most features, summarising and storing summarised results is far cheaper than calculating the results in the first place. If this is not true for your particular feature, PluginSummarisingAdapter may not be the best approach for you.
+Definition at line 86 of file PluginSummarisingAdapter.h.
+typedef std::set<RealTime> Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries | +
Definition at line 104 of file PluginSummarisingAdapter.h.
+ +typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::HostExt::PluginSummarisingAdapter::SummaryType | +
Minimum | + |
Maximum | + |
Mean | + |
Median | + |
Mode | + |
Sum | + |
Variance | + |
StandardDeviation | + |
Count | + |
UnknownSummaryType | + |
Definition at line 121 of file PluginSummarisingAdapter.h.
+ +enum Vamp::HostExt::PluginSummarisingAdapter::AveragingMethod | +
AveragingMethod indicates how the adapter should handle average-based summaries of features whose results are not equally spaced in time.
+If SampleAverage is specified, summary types based on averages will be calculated by treating each result individually without regard to its time: for example, the mean will be the sum of all values divided by the number of values.
+If ContinuousTimeAverage is specified, each feature will be considered to have a duration, either as specified in the feature's duration field, or until the following feature: thus, for example, the mean will be the sum of the products of values and durations, divided by the total duration.
+Although SampleAverage is useful for many types of feature, ContinuousTimeAverage is essential for some situations, for example finding the result that spans the largest proportion of the input given a feature that emits a new result only when the value changes (the modal value integrated over time).
+ + +Definition at line 157 of file PluginSummarisingAdapter.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +Vamp::HostExt::PluginSummarisingAdapter::PluginSummarisingAdapter | +( | +Plugin * | +plugin | ) | ++ |
Construct a PluginSummarisingAdapter wrapping the given plugin.
+The adapter takes ownership of the plugin, which will be deleted when the adapter is deleted.
+ +virtual Vamp::HostExt::PluginSummarisingAdapter::~PluginSummarisingAdapter | +( | +) | + [virtual] |
+
bool Vamp::HostExt::PluginSummarisingAdapter::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +void Vamp::HostExt::PluginSummarisingAdapter::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginSummarisingAdapter::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +FeatureSet Vamp::HostExt::PluginSummarisingAdapter::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Reimplemented from Vamp::HostExt::PluginWrapper.
+ +void Vamp::HostExt::PluginSummarisingAdapter::setSummarySegmentBoundaries | +( | +const SegmentBoundaries & | +) | ++ |
Specify a series of segment boundaries, such that one summary will be returned for each of the contiguous intra-boundary segments.
+This function must be called before getSummaryForOutput or getSummaryForAllOutputs.
+Note that you cannot retrieve results with multiple different segmentations by repeatedly calling this function followed by one of the getSummary functions. The summaries are all calculated at the first call to any getSummary function, and once the summaries have been calculated, they remain calculated.
+ +FeatureList Vamp::HostExt::PluginSummarisingAdapter::getSummaryForOutput | +( | +int | +output, | +
+ | + | SummaryType | +type, | +
+ | + | AveragingMethod | +method = SampleAverage |
+
+ | ) | ++ |
Return summaries of the features that were returned on the given output, using the given SummaryType and AveragingMethod.
+The plugin must have been fully run (process() and getRemainingFeatures() calls all made as appropriate) before this function is called.
+ +FeatureSet Vamp::HostExt::PluginSummarisingAdapter::getSummaryForAllOutputs | +( | +SummaryType | +type, | +
+ | + | AveragingMethod | +method = SampleAverage |
+
+ | ) | ++ |
Return summaries of the features that were returned on all of the plugin's outputs, using the given SummaryType and AveragingMethod.
+The plugin must have been fully run (process() and getRemainingFeatures() calls all made as appropriate) before this function is called.
+ +InputDomain Vamp::HostExt::PluginWrapper::getInputDomain | +( | +) | + const [virtual, inherited] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | +) | + const [virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getIdentifier | +( | +) | + const [virtual, inherited] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getName | +( | +) | + const [virtual, inherited] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getDescription | +( | +) | + const [virtual, inherited] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getMaker | +( | +) | + const [virtual, inherited] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | +) | + const [virtual, inherited] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCopyright | +( | +) | + const [virtual, inherited] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +float Vamp::HostExt::PluginWrapper::getParameter | +( | +std::string | +) | + const [virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +ProgramList Vamp::HostExt::PluginWrapper::getPrograms | +( | +) | + const [virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | +) | + const [virtual, inherited] |
+
Get the current program.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::selectProgram | +( | +std::string | +) | + [virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getPreferredStepSize | +( | +) | + const [virtual, inherited] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getPreferredBlockSize | +( | +) | + const [virtual, inherited] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | +) | + const [virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +OutputList Vamp::HostExt::PluginWrapper::getOutputDescriptors | +( | +) | + const [virtual, inherited] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +WrapperType* Vamp::HostExt::PluginWrapper::getWrapper | +( | +) | + [inline, inherited] |
+
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present.
+This is useful in situations where a plugin is wrapped by multiple different wrappers (one inside another) and the host wants to call some wrapper-specific function on one of the layers without having to care about the order in which they are wrapped. For example, the plugin returned by PluginLoader::loadPlugin may have more than one wrapper; if the host wanted to query or fine-tune some property of one of them, it would be hard to do so without knowing the order of the wrappers. This function therefore gives direct access to the wrapper of a particular type.
+ +Definition at line 116 of file PluginWrapper.h.
+ +References Vamp::HostExt::PluginWrapper::getWrapper().
+ +Referenced by Vamp::HostExt::PluginWrapper::getWrapper(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +Impl* Vamp::HostExt::PluginSummarisingAdapter::m_impl [protected] |
+
Definition at line 187 of file PluginSummarisingAdapter.h.
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
Definition at line 126 of file PluginWrapper.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginWrapper is a simple base class for adapter plugins. + More...
+ +#include <vamp-hostsdk/PluginWrapper.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
virtual | ~PluginWrapper () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string) const |
Get the value of a named parameter. | |
void | setParameter (std::string, float) |
Set a named parameter. | |
ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
std::string | getCurrentProgram () const |
Get the current program. | |
void | selectProgram (std::string) |
Select a program. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
template<typename WrapperType > | |
WrapperType * | getWrapper () |
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
+Protected Member Functions | |
PluginWrapper (Plugin *plugin) | |
+Protected Attributes | |
Plugin * | m_plugin |
float | m_inputSampleRate |
PluginWrapper is a simple base class for adapter plugins.
+It takes a pointer to a "to be wrapped" Vamp plugin on construction, and provides implementations of all the Vamp plugin methods that simply delegate through to the wrapped plugin. A subclass can therefore override only the methods that are meaningful for the particular adapter.
+Definition at line 62 of file PluginWrapper.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +virtual Vamp::HostExt::PluginWrapper::~PluginWrapper | +( | +) | + [virtual] |
+
Vamp::HostExt::PluginWrapper::PluginWrapper | +( | +Plugin * | +plugin | ) | + [protected] |
+
bool Vamp::HostExt::PluginWrapper::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +void Vamp::HostExt::PluginWrapper::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +InputDomain Vamp::HostExt::PluginWrapper::getInputDomain | +( | +) | + const [virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | +) | + const [virtual] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | +) | + const [virtual] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +float Vamp::HostExt::PluginWrapper::getParameter | +( | +std::string | +) | + const [virtual] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +ProgramList Vamp::HostExt::PluginWrapper::getPrograms | +( | +) | + const [virtual] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | +) | + const [virtual] |
+
Get the current program.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::HostExt::PluginWrapper::selectProgram | +( | +std::string | +) | + [virtual] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented from Vamp::PluginBase.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getPreferredStepSize | +( | +) | + const [virtual] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginBufferingAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getPreferredBlockSize | +( | +) | + const [virtual] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | +) | + const [virtual] |
+
Get the minimum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | +) | + const [virtual] |
+
Get the maximum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +OutputList Vamp::HostExt::PluginWrapper::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter.
+ +FeatureSet Vamp::HostExt::PluginWrapper::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginInputDomainAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +FeatureSet Vamp::HostExt::PluginWrapper::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, and Vamp::HostExt::PluginSummarisingAdapter.
+ +WrapperType* Vamp::HostExt::PluginWrapper::getWrapper | +( | +) | + [inline] |
+
Return a pointer to the plugin wrapper of type WrapperType surrounding this wrapper's plugin, if present.
+This is useful in situations where a plugin is wrapped by multiple different wrappers (one inside another) and the host wants to call some wrapper-specific function on one of the layers without having to care about the order in which they are wrapped. For example, the plugin returned by PluginLoader::loadPlugin may have more than one wrapper; if the host wanted to query or fine-tune some property of one of them, it would be hard to do so without knowing the order of the wrappers. This function therefore gives direct access to the wrapper of a particular type.
+ +Definition at line 116 of file PluginWrapper.h.
+ +References getWrapper().
+ +Referenced by getWrapper(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected] |
+
Definition at line 126 of file PluginWrapper.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), SpectralCentroid::process(), ZeroCrossing::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
FeatureList typedef | Vamp::Plugin | |
FeatureSet typedef | Vamp::Plugin | |
FrequencyDomain enum value | Vamp::Plugin | |
getCopyright() const =0 | Vamp::PluginBase | [pure virtual] |
getCurrentProgram() const | Vamp::PluginBase | [inline, virtual] |
getDescription() const =0 | Vamp::PluginBase | [pure virtual] |
getIdentifier() const =0 | Vamp::PluginBase | [pure virtual] |
getInputDomain() const =0 | Vamp::Plugin | [pure virtual] |
getMaker() const =0 | Vamp::PluginBase | [pure virtual] |
getMaxChannelCount() const | Vamp::Plugin | [inline, virtual] |
getMinChannelCount() const | Vamp::Plugin | [inline, virtual] |
getName() const =0 | Vamp::PluginBase | [pure virtual] |
getOutputDescriptors() const =0 | Vamp::Plugin | [pure virtual] |
getParameter(std::string) const | Vamp::PluginBase | [inline, virtual] |
getParameterDescriptors() const | Vamp::PluginBase | [inline, virtual] |
getPluginVersion() const =0 | Vamp::PluginBase | [pure virtual] |
getPreferredBlockSize() const | Vamp::Plugin | [inline, virtual] |
getPreferredStepSize() const | Vamp::Plugin | [inline, virtual] |
getPrograms() const | Vamp::PluginBase | [inline, virtual] |
getRemainingFeatures()=0 | Vamp::Plugin | [pure virtual] |
getType() const | Vamp::Plugin | [inline, virtual] |
getVampApiVersion() const | Vamp::PluginBase | [inline, virtual] |
initialise(size_t inputChannels, size_t stepSize, size_t blockSize)=0 | Vamp::Plugin | [pure virtual] |
InputDomain enum name | Vamp::Plugin | |
m_inputSampleRate | Vamp::Plugin | [protected] |
OutputList typedef | Vamp::Plugin | |
ParameterList typedef | Vamp::PluginBase | |
Plugin(float inputSampleRate) | Vamp::Plugin | [inline, protected] |
process(const float *const *inputBuffers, RealTime timestamp)=0 | Vamp::Plugin | [pure virtual] |
ProgramList typedef | Vamp::PluginBase | |
reset()=0 | Vamp::Plugin | [pure virtual] |
selectProgram(std::string) | Vamp::PluginBase | [inline, virtual] |
setParameter(std::string, float) | Vamp::PluginBase | [inline, virtual] |
TimeDomain enum value | Vamp::Plugin | |
~Plugin() | Vamp::Plugin | [inline, virtual] |
~PluginBase() | Vamp::PluginBase | [inline, virtual] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio or related data. + More...
+ +#include <vamp-sdk/Plugin.h>
+Classes | |
struct | Feature |
struct | OutputDescriptor |
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
virtual | ~Plugin () |
virtual bool | initialise (size_t inputChannels, size_t stepSize, size_t blockSize)=0 |
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). | |
virtual void | reset ()=0 |
Reset the plugin after use, to prepare it for another clean run. | |
virtual InputDomain | getInputDomain () const =0 |
Get the plugin's required input domain. | |
virtual size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
virtual size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual OutputList | getOutputDescriptors () const =0 |
Get the outputs of this plugin. | |
virtual FeatureSet | process (const float *const *inputBuffers, RealTime timestamp)=0 |
Process a single block of input data. | |
virtual FeatureSet | getRemainingFeatures ()=0 |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual std::string | getIdentifier () const =0 |
Get the computer-usable name of the plugin. | |
virtual std::string | getName () const =0 |
Get a human-readable name or title of the plugin. | |
virtual std::string | getDescription () const =0 |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
virtual std::string | getMaker () const =0 |
Get the name of the author or vendor of the plugin in human-readable form. | |
virtual std::string | getCopyright () const =0 |
Get the copyright statement or licensing summary for the plugin. | |
virtual int | getPluginVersion () const =0 |
Get the version number of the plugin. | |
virtual ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
virtual float | getParameter (std::string) const |
Get the value of a named parameter. | |
virtual void | setParameter (std::string, float) |
Set a named parameter. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Member Functions | |
Plugin (float inputSampleRate) | |
+Protected Attributes | |
float | m_inputSampleRate |
Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio or related data.
+In most cases, the input will be audio and the output will be a stream of derived data at a lower sampling resolution than the input.
+Note that this class inherits several abstract methods from PluginBase. These must be implemented by the subclass.
+PLUGIN LIFECYCLE
+Feature extraction plugins are managed differently from real-time plugins (such as VST effects). The main difference is that the parameters for a feature extraction plugin are configured before the plugin is used, and do not change during use.
+1. Host constructs the plugin, passing it the input sample rate. The plugin may do basic initialisation, but should not do anything computationally expensive at this point. You must make sure your plugin is cheap to construct, otherwise you'll seriously affect the startup performance of almost all hosts. If you have serious initialisation to do, the proper place is in initialise() (step 5).
+2. Host may query the plugin's available outputs.
+3. Host queries programs and parameter descriptors, and may set some or all of them. Parameters that are not explicitly set should take their default values as specified in the parameter descriptor. When a program is set, the parameter values may change and the host will re-query them to check.
+4. Host queries the preferred step size, block size and number of channels. These may all vary depending on the parameter values. (Note however that you cannot make the number of distinct outputs dependent on parameter values.)
+5. Plugin is properly initialised with a call to initialise. This fixes the step size, block size, and number of channels, as well as all of the parameter and program settings. If the values passed in to initialise do not match the plugin's advertised preferred values from step 4, the plugin may refuse to initialise and return false (although if possible it should accept the new values). Any computationally expensive setup code should take place here.
+6. Host finally checks the number of values, resolution, extents etc per output (which may vary depending on the number of channels, step size and block size as well as the parameter values).
+7. Host will repeatedly call the process method to pass in blocks of input data. This method may return features extracted from that data (if the plugin is causal).
+8. Host will call getRemainingFeatures exactly once, after all the input data has been processed. This may return any non-causal or leftover features.
+9. At any point after initialise was called, the host may optionally call the reset method and restart processing. (This does not mean it can change the parameters, which are fixed from initialise until destruction.)
+A plugin does not need to handle the case where setParameter or selectProgram is called after initialise has been called. It's the host's responsibility not to do that. Similarly, the plugin may safely assume that initialise is called no more than once.
+ +Definition at line 124 of file vamp-sdk/Plugin.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList | +
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList | +
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet | +
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain | +
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +virtual Vamp::Plugin::~Plugin | +( | +) | + [inline, virtual] |
+
Definition at line 127 of file vamp-sdk/Plugin.h.
+ +Vamp::Plugin::Plugin | +( | +float | +inputSampleRate | ) | + [inline, protected] |
+
Definition at line 433 of file vamp-sdk/Plugin.h.
+ +virtual bool Vamp::Plugin::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [pure virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implemented in Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginSummarisingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by runPlugin().
+ +virtual void Vamp::Plugin::reset | +( | +) | + [pure virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginSummarisingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +virtual InputDomain Vamp::Plugin::getInputDomain | +( | +) | + const [pure virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implemented in Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getPreferredBlockSize | +( | +) | + const [inline, virtual] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 179 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getPreferredStepSize | +( | +) | + const [inline, virtual] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 194 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), ZeroCrossing::initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual OutputList Vamp::Plugin::getOutputDescriptors | +( | +) | + const [pure virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, PercussionOnsetDetector, PowerSpectrum, AmplitudeFollower, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual FeatureSet Vamp::Plugin::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [pure virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginSummarisingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, PercussionOnsetDetector, AmplitudeFollower, PowerSpectrum, SpectralCentroid, and ZeroCrossing.
+ +Referenced by runPlugin().
+ +virtual FeatureSet Vamp::Plugin::getRemainingFeatures | +( | +) | + [pure virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginSummarisingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, PercussionOnsetDetector, AmplitudeFollower, PowerSpectrum, SpectralCentroid, and ZeroCrossing.
+ +Referenced by runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual std::string Vamp::PluginBase::getIdentifier | +( | +) | + const [pure virtual, inherited] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual std::string Vamp::PluginBase::getName | +( | +) | + const [pure virtual, inherited] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +virtual std::string Vamp::PluginBase::getDescription | +( | +) | + const [pure virtual, inherited] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +virtual std::string Vamp::PluginBase::getMaker | +( | +) | + const [pure virtual, inherited] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +virtual std::string Vamp::PluginBase::getCopyright | +( | +) | + const [pure virtual, inherited] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins().
+ +virtual int Vamp::PluginBase::getPluginVersion | +( | +) | + const [pure virtual, inherited] |
+
Get the version number of the plugin.
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | +) | + const [inline, virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 208 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual float Vamp::PluginBase::getParameter | +( | +std::string | +) | + const [inline, virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 216 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [inline, virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 222 of file vamp-sdk/PluginBase.h.
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), SpectralCentroid::process(), ZeroCrossing::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
createPlugin(float inputSampleRate) | Vamp::PluginAdapter< P > | [inline, protected, virtual] |
getDescriptor() | Vamp::PluginAdapterBase | |
m_impl | Vamp::PluginAdapterBase | [protected] |
PluginAdapter() | Vamp::PluginAdapter< P > | [inline] |
PluginAdapterBase() | Vamp::PluginAdapterBase | [protected] |
~PluginAdapter() | Vamp::PluginAdapter< P > | [inline, virtual] |
~PluginAdapterBase() | Vamp::PluginAdapterBase | [virtual] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginAdapter turns a PluginAdapterBase into a specific wrapper for a particular plugin implementation. + More...
+ +#include <vamp-sdk/PluginAdapter.h>
+Public Member Functions | |
PluginAdapter () | |
virtual | ~PluginAdapter () |
const VampPluginDescriptor * | getDescriptor () |
Return a VampPluginDescriptor describing the plugin that is wrapped by this adapter. | |
+Protected Member Functions | |
Plugin * | createPlugin (float inputSampleRate) |
+Protected Attributes | |
Impl * | m_impl |
PluginAdapter turns a PluginAdapterBase into a specific wrapper for a particular plugin implementation.
+See PluginAdapterBase.
+ +Definition at line 95 of file PluginAdapter.h.
+Vamp::PluginAdapter< P >::PluginAdapter | +( | +) | + [inline] |
+
Definition at line 98 of file PluginAdapter.h.
+ +virtual Vamp::PluginAdapter< P >::~PluginAdapter | +( | +) | + [inline, virtual] |
+
Definition at line 99 of file PluginAdapter.h.
+ +Plugin* Vamp::PluginAdapter< P >::createPlugin | +( | +float | +inputSampleRate | ) | + [inline, protected, virtual] |
+
Implements Vamp::PluginAdapterBase.
+ +Definition at line 102 of file PluginAdapter.h.
+ +const VampPluginDescriptor* Vamp::PluginAdapterBase::getDescriptor | +( | +) | + [inherited] |
+
Return a VampPluginDescriptor describing the plugin that is wrapped by this adapter.
+ +Referenced by vampGetPluginDescriptor().
+ +Impl* Vamp::PluginAdapterBase::m_impl [protected, inherited] |
+
Definition at line 81 of file PluginAdapter.h.
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
createPlugin(float inputSampleRate)=0 | Vamp::PluginAdapterBase | [protected, pure virtual] |
getDescriptor() | Vamp::PluginAdapterBase | |
m_impl | Vamp::PluginAdapterBase | [protected] |
PluginAdapterBase() | Vamp::PluginAdapterBase | [protected] |
~PluginAdapterBase() | Vamp::PluginAdapterBase | [virtual] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginAdapter and PluginAdapterBase provide a wrapper class that a plugin library can use to make its C++ Vamp::Plugin objects available through the Vamp C API. + More...
+ +#include <vamp-sdk/PluginAdapter.h>
+Public Member Functions | |
virtual | ~PluginAdapterBase () |
const VampPluginDescriptor * | getDescriptor () |
Return a VampPluginDescriptor describing the plugin that is wrapped by this adapter. | |
+Protected Member Functions | |
PluginAdapterBase () | |
virtual Plugin * | createPlugin (float inputSampleRate)=0 |
+Protected Attributes | |
Impl * | m_impl |
PluginAdapter and PluginAdapterBase provide a wrapper class that a plugin library can use to make its C++ Vamp::Plugin objects available through the Vamp C API.
+Almost all Vamp plugin libraries will want to make use of this. To do so, all they need to do is declare a PluginAdapter<T> for each plugin class T in their library. It's very simple, and you need to know absolutely nothing about how it works in order to use it. Just cut and paste from an existing plugin's discovery function.
+Definition at line 65 of file PluginAdapter.h.
+virtual Vamp::PluginAdapterBase::~PluginAdapterBase | +( | +) | + [virtual] |
+
Vamp::PluginAdapterBase::PluginAdapterBase | +( | +) | + [protected] |
+
const VampPluginDescriptor* Vamp::PluginAdapterBase::getDescriptor | +( | +) | ++ |
Return a VampPluginDescriptor describing the plugin that is wrapped by this adapter.
+ +Referenced by vampGetPluginDescriptor().
+ +virtual Plugin* Vamp::PluginAdapterBase::createPlugin | +( | +float | +inputSampleRate | ) | + [protected, pure virtual] |
+
Implemented in Vamp::PluginAdapter< P >.
+ +Impl* Vamp::PluginAdapterBase::m_impl [protected] |
+
Definition at line 81 of file PluginAdapter.h.
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
getCopyright() const =0 | Vamp::PluginBase | [pure virtual] |
getCurrentProgram() const | Vamp::PluginBase | [inline, virtual] |
getDescription() const =0 | Vamp::PluginBase | [pure virtual] |
getIdentifier() const =0 | Vamp::PluginBase | [pure virtual] |
getMaker() const =0 | Vamp::PluginBase | [pure virtual] |
getName() const =0 | Vamp::PluginBase | [pure virtual] |
getParameter(std::string) const | Vamp::PluginBase | [inline, virtual] |
getParameterDescriptors() const | Vamp::PluginBase | [inline, virtual] |
getPluginVersion() const =0 | Vamp::PluginBase | [pure virtual] |
getPrograms() const | Vamp::PluginBase | [inline, virtual] |
getType() const =0 | Vamp::PluginBase | [pure virtual] |
getVampApiVersion() const | Vamp::PluginBase | [inline, virtual] |
ParameterList typedef | Vamp::PluginBase | |
ProgramList typedef | Vamp::PluginBase | |
selectProgram(std::string) | Vamp::PluginBase | [inline, virtual] |
setParameter(std::string, float) | Vamp::PluginBase | [inline, virtual] |
~PluginBase() | Vamp::PluginBase | [inline, virtual] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
A base class for plugins with optional configurable parameters, programs, etc. + More...
+ +#include <PluginBase.h>
+Classes | |
struct | ParameterDescriptor |
+Public Types | |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
virtual | ~PluginBase () |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual std::string | getIdentifier () const =0 |
Get the computer-usable name of the plugin. | |
virtual std::string | getName () const =0 |
Get a human-readable name or title of the plugin. | |
virtual std::string | getDescription () const =0 |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
virtual std::string | getMaker () const =0 |
Get the name of the author or vendor of the plugin in human-readable form. | |
virtual std::string | getCopyright () const =0 |
Get the copyright statement or licensing summary for the plugin. | |
virtual int | getPluginVersion () const =0 |
Get the version number of the plugin. | |
virtual ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
virtual float | getParameter (std::string) const |
Get the value of a named parameter. | |
virtual void | setParameter (std::string, float) |
Set a named parameter. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
virtual std::string | getType () const =0 |
Get the type of plugin. |
A base class for plugins with optional configurable parameters, programs, etc.
+The Vamp::Plugin is derived from this, and individual Vamp plugins should derive from that.
+This class does not provide the necessary interfaces to instantiate or run a plugin. It only specifies an interface for retrieving those controls that the host may wish to show to the user for editing. It could meaningfully be subclassed by real-time plugins or other sorts of plugin as well as Vamp plugins.
+ +Definition at line 64 of file vamp-sdk/PluginBase.h.
+typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList | +
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList | +
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +virtual Vamp::PluginBase::~PluginBase | +( | +) | + [inline, virtual] |
+
Definition at line 67 of file vamp-sdk/PluginBase.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual std::string Vamp::PluginBase::getIdentifier | +( | +) | + const [pure virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual std::string Vamp::PluginBase::getName | +( | +) | + const [pure virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +virtual std::string Vamp::PluginBase::getDescription | +( | +) | + const [pure virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +virtual std::string Vamp::PluginBase::getMaker | +( | +) | + const [pure virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +virtual std::string Vamp::PluginBase::getCopyright | +( | +) | + const [pure virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins().
+ +virtual int Vamp::PluginBase::getPluginVersion | +( | +) | + const [pure virtual] |
+
Get the version number of the plugin.
+ +Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, PowerSpectrum, AmplitudeFollower, SpectralCentroid, ZeroCrossing, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Referenced by enumeratePlugins().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | +) | + const [inline, virtual] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 208 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual float Vamp::PluginBase::getParameter | +( | +std::string | +) | + const [inline, virtual] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 216 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [inline, virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 222 of file vamp-sdk/PluginBase.h.
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getType | +( | +) | + const [pure virtual] |
+
Get the type of plugin.
+This is to be implemented by the immediate subclass, not by actual plugins. Do not attempt to implement this in plugin code.
+ +Implemented in Vamp::Plugin.
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
PluginHostAdapter is a wrapper class that a Vamp host can use to make the C-language VampPluginDescriptor object appear as a C++ Vamp::Plugin object. + More...
+ +#include <vamp-hostsdk/PluginHostAdapter.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
PluginHostAdapter (const VampPluginDescriptor *descriptor, float inputSampleRate) | |
virtual | ~PluginHostAdapter () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
float | getParameter (std::string) const |
Get the value of a named parameter. | |
void | setParameter (std::string, float) |
Set a named parameter. | |
ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
std::string | getCurrentProgram () const |
Get the current program. | |
void | selectProgram (std::string) |
Select a program. | |
size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
+Static Public Member Functions | |
static std::vector< std::string > | getPluginPath () |
+Protected Member Functions | |
void | convertFeatures (VampFeatureList *, FeatureSet &) |
+Protected Attributes | |
const VampPluginDescriptor * | m_descriptor |
VampPluginHandle | m_handle |
float | m_inputSampleRate |
PluginHostAdapter is a wrapper class that a Vamp host can use to make the C-language VampPluginDescriptor object appear as a C++ Vamp::Plugin object.
+The Vamp API is defined in vamp/vamp.h as a C API. The C++ objects used for convenience by plugins and hosts actually communicate using the C low-level API, but the details of this communication are handled seamlessly by the Vamp SDK implementation provided the plugin and host use the proper C++ wrapper objects.
+See also PluginAdapter, the plugin-side wrapper that makes a C++ plugin object available using the C query API.
+ +Definition at line 68 of file PluginHostAdapter.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +Vamp::PluginHostAdapter::PluginHostAdapter | +( | +const VampPluginDescriptor * | +descriptor, | +
+ | + | float | +inputSampleRate | +
+ | ) | ++ |
virtual Vamp::PluginHostAdapter::~PluginHostAdapter | +( | +) | + [virtual] |
+
static std::vector<std::string> Vamp::PluginHostAdapter::getPluginPath | +( | +) | + [static] |
+
bool Vamp::PluginHostAdapter::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +void Vamp::PluginHostAdapter::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +InputDomain Vamp::PluginHostAdapter::getInputDomain | +( | +) | + const [virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +unsigned int Vamp::PluginHostAdapter::getVampApiVersion | +( | +) | + const [virtual] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::PluginHostAdapter::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::PluginHostAdapter::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::PluginHostAdapter::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::PluginHostAdapter::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +int Vamp::PluginHostAdapter::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +std::string Vamp::PluginHostAdapter::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +ParameterList Vamp::PluginHostAdapter::getParameterDescriptors | +( | +) | + const [virtual] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented from Vamp::PluginBase.
+ +float Vamp::PluginHostAdapter::getParameter | +( | +std::string | +) | + const [virtual] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::PluginHostAdapter::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [virtual] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented from Vamp::PluginBase.
+ +ProgramList Vamp::PluginHostAdapter::getPrograms | +( | +) | + const [virtual] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented from Vamp::PluginBase.
+ +std::string Vamp::PluginHostAdapter::getCurrentProgram | +( | +) | + const [virtual] |
+
Get the current program.
+ +Reimplemented from Vamp::PluginBase.
+ +void Vamp::PluginHostAdapter::selectProgram | +( | +std::string | +) | + [virtual] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented from Vamp::PluginBase.
+ +size_t Vamp::PluginHostAdapter::getPreferredStepSize | +( | +) | + const [virtual] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::PluginHostAdapter::getPreferredBlockSize | +( | +) | + const [virtual] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::PluginHostAdapter::getMinChannelCount | +( | +) | + const [virtual] |
+
Get the minimum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +size_t Vamp::PluginHostAdapter::getMaxChannelCount | +( | +) | + const [virtual] |
+
Get the maximum supported number of input channels.
+ +Reimplemented from Vamp::Plugin.
+ +OutputList Vamp::PluginHostAdapter::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +FeatureSet Vamp::PluginHostAdapter::process | +( | +const float *const * | +inputBuffers, | +
+ | + | RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +FeatureSet Vamp::PluginHostAdapter::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +void Vamp::PluginHostAdapter::convertFeatures | +( | +VampFeatureList * | +, | +
+ | + | FeatureSet & | ++ |
+ | ) | + [protected] |
+
virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +const VampPluginDescriptor* Vamp::PluginHostAdapter::m_descriptor [protected] |
+
Definition at line 113 of file PluginHostAdapter.h.
+ +VampPluginHandle Vamp::PluginHostAdapter::m_handle [protected] |
+
Definition at line 114 of file PluginHostAdapter.h.
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
frame2RealTime(long frame, unsigned int sampleRate) | Vamp::RealTime | [static] |
fromMilliseconds(int msec) | Vamp::RealTime | [static] |
fromSeconds(double sec) | Vamp::RealTime | [static] |
fromTimeval(const struct timeval &) | Vamp::RealTime | [static] |
msec() const | Vamp::RealTime | [inline] |
nsec | Vamp::RealTime | |
operator!=(const RealTime &r) const | Vamp::RealTime | [inline] |
operator+(const RealTime &r) const | Vamp::RealTime | [inline] |
operator-(const RealTime &r) const | Vamp::RealTime | [inline] |
operator-() const | Vamp::RealTime | [inline] |
operator/(int d) const | Vamp::RealTime | |
operator/(const RealTime &r) const | Vamp::RealTime | |
operator<(const RealTime &r) const | Vamp::RealTime | [inline] |
operator<=(const RealTime &r) const | Vamp::RealTime | [inline] |
operator=(const RealTime &r) | Vamp::RealTime | [inline] |
operator==(const RealTime &r) const | Vamp::RealTime | [inline] |
operator>(const RealTime &r) const | Vamp::RealTime | [inline] |
operator>=(const RealTime &r) const | Vamp::RealTime | [inline] |
RealTime() | Vamp::RealTime | [inline] |
RealTime(int s, int n) | Vamp::RealTime | |
RealTime(const RealTime &r) | Vamp::RealTime | [inline] |
realTime2Frame(const RealTime &r, unsigned int sampleRate) | Vamp::RealTime | [static] |
sec | Vamp::RealTime | |
toString() const | Vamp::RealTime | |
toText(bool fixedDp=false) const | Vamp::RealTime | |
usec() const | Vamp::RealTime | [inline] |
zeroTime | Vamp::RealTime | [static] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Example plugin that calculates the positions and density of zero-crossing points in an audio waveform. + More...
+ +#include <ZeroCrossing.h>
+Public Types | |
enum | InputDomain { TimeDomain, +FrequencyDomain + } |
typedef std::vector +< OutputDescriptor > | OutputList |
typedef std::vector< Feature > | FeatureList |
typedef std::map< int, +FeatureList > | FeatureSet |
typedef std::vector +< ParameterDescriptor > | ParameterList |
typedef std::vector< std::string > | ProgramList |
+Public Member Functions | |
ZeroCrossing (float inputSampleRate) | |
virtual | ~ZeroCrossing () |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
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). | |
void | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
InputDomain | getInputDomain () const |
Get the plugin's required input domain. | |
std::string | getIdentifier () const |
Get the computer-usable name of the plugin. | |
std::string | getName () const |
Get a human-readable name or title of the plugin. | |
std::string | getDescription () const |
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name". | |
std::string | getMaker () const |
Get the name of the author or vendor of the plugin in human-readable form. | |
int | getPluginVersion () const |
Get the version number of the plugin. | |
std::string | getCopyright () const |
Get the copyright statement or licensing summary for the plugin. | |
OutputList | getOutputDescriptors () const |
Get the outputs of this plugin. | |
FeatureSet | process (const float *const *inputBuffers, Vamp::RealTime timestamp) |
Process a single block of input data. | |
FeatureSet | getRemainingFeatures () |
After all blocks have been processed, calculate and return any remaining features derived from the complete input. | |
virtual size_t | getPreferredBlockSize () const |
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function). | |
virtual size_t | getPreferredStepSize () const |
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin. | |
virtual size_t | getMinChannelCount () const |
Get the minimum supported number of input channels. | |
virtual size_t | getMaxChannelCount () const |
Get the maximum supported number of input channels. | |
virtual std::string | getType () const |
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase. | |
virtual unsigned int | getVampApiVersion () const |
Get the Vamp API compatibility level of the plugin. | |
virtual ParameterList | getParameterDescriptors () const |
Get the controllable parameters of this plugin. | |
virtual float | getParameter (std::string) const |
Get the value of a named parameter. | |
virtual void | setParameter (std::string, float) |
Set a named parameter. | |
virtual ProgramList | getPrograms () const |
Get the program settings available in this plugin. | |
virtual std::string | getCurrentProgram () const |
Get the current program. | |
virtual void | selectProgram (std::string) |
Select a program. | |
+Protected Attributes | |
size_t | m_stepSize |
float | m_previousSample |
float | m_inputSampleRate |
Example plugin that calculates the positions and density of zero-crossing points in an audio waveform.
+ +Definition at line 47 of file ZeroCrossing.h.
+typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
Definition at line 327 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
Definition at line 385 of file vamp-sdk/Plugin.h.
+ +typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
Definition at line 387 of file vamp-sdk/Plugin.h.
+ +typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
Definition at line 203 of file vamp-sdk/PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
Definition at line 225 of file vamp-sdk/PluginBase.h.
+ +enum Vamp::Plugin::InputDomain [inherited] |
+
Definition at line 152 of file vamp-sdk/Plugin.h.
+ +ZeroCrossing::ZeroCrossing | +( | +float | +inputSampleRate | ) | ++ |
Definition at line 46 of file ZeroCrossing.cpp.
+ +ZeroCrossing::~ZeroCrossing | +( | +) | + [virtual] |
+
Definition at line 53 of file ZeroCrossing.cpp.
+ +bool ZeroCrossing::initialise | +( | +size_t | +inputChannels, | +
+ | + | size_t | +stepSize, | +
+ | + | size_t | +blockSize | +
+ | ) | + [virtual] |
+
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).
+The input sample rate should have been already specified at construction time.
+Return true for successful initialisation, false if the number of input channels, step size and/or block size cannot be supported.
+ +Implements Vamp::Plugin.
+ +Definition at line 94 of file ZeroCrossing.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), and m_stepSize.
+ +void ZeroCrossing::reset | +( | +) | + [virtual] |
+
Reset the plugin after use, to prepare it for another clean run.
+Not called for the first initialisation (i.e. initialise must also do a reset).
+ +Implements Vamp::Plugin.
+ +Definition at line 105 of file ZeroCrossing.cpp.
+ +References m_previousSample.
+ +InputDomain ZeroCrossing::getInputDomain | +( | +) | + const [inline, virtual] |
+
Get the plugin's required input domain.
+If this is TimeDomain, the samples provided to the process() function (below) will be in the time domain, as for a traditional audio processing plugin.
+If this is FrequencyDomain, the host will carry out a windowed FFT of size equal to the negotiated block size on the data before passing the frequency bin data in to process(). The input data for the FFT will be rotated so as to place the origin in the centre of the block. The plugin does not get to choose the window type -- the host will either let the user do so, or will use a Hanning window.
+ +Implements Vamp::Plugin.
+ +Definition at line 56 of file ZeroCrossing.h.
+ +References Vamp::Plugin::TimeDomain.
+ +string ZeroCrossing::getIdentifier | +( | +) | + const [virtual] |
+
Get the computer-usable name of the plugin.
+This should be reasonably short and contain no whitespace or punctuation characters. It may only contain the characters [a-zA-Z0-9_-]. This is the authoritative way for a program to identify a plugin within a given library.
+This text may be visible to the user, but it should not be the main text used to identify a plugin to the user (that will be the name, below).
+Example: "zero_crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 58 of file ZeroCrossing.cpp.
+ +string ZeroCrossing::getName | +( | +) | + const [virtual] |
+
Get a human-readable name or title of the plugin.
+This should be brief and self-contained, as it may be used to identify the plugin to the user in isolation (i.e. without also showing the plugin's "identifier").
+Example: "Zero Crossings"
+ +Implements Vamp::PluginBase.
+ +Definition at line 64 of file ZeroCrossing.cpp.
+ +string ZeroCrossing::getDescription | +( | +) | + const [virtual] |
+
Get a human-readable description for the plugin, typically a line of text that may optionally be displayed in addition to the plugin's "name".
+May be empty if the name has said it all already.
+Example: "Detect and count zero crossing points"
+ +Implements Vamp::PluginBase.
+ +Definition at line 70 of file ZeroCrossing.cpp.
+ +string ZeroCrossing::getMaker | +( | +) | + const [virtual] |
+
Get the name of the author or vendor of the plugin in human-readable form.
+This should be a short identifying text, as it may be used to label plugins from the same source in a menu or similar.
+ +Implements Vamp::PluginBase.
+ +Definition at line 76 of file ZeroCrossing.cpp.
+ +int ZeroCrossing::getPluginVersion | +( | +) | + const [virtual] |
+
Get the version number of the plugin.
+ +Implements Vamp::PluginBase.
+ +Definition at line 82 of file ZeroCrossing.cpp.
+ +string ZeroCrossing::getCopyright | +( | +) | + const [virtual] |
+
Get the copyright statement or licensing summary for the plugin.
+This can be an informative text, without the same presentation constraints as mentioned for getMaker above.
+ +Implements Vamp::PluginBase.
+ +Definition at line 88 of file ZeroCrossing.cpp.
+ +ZeroCrossing::OutputList ZeroCrossing::getOutputDescriptors | +( | +) | + const [virtual] |
+
Get the outputs of this plugin.
+An output's index in this list is used as its numeric index when looking it up in the FeatureSet returned from the process() call.
+ +Implements Vamp::Plugin.
+ +Definition at line 111 of file ZeroCrossing.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, Vamp::Plugin::m_inputSampleRate, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::quantizeStep, Vamp::Plugin::OutputDescriptor::sampleRate, Vamp::Plugin::OutputDescriptor::sampleType, Vamp::Plugin::OutputDescriptor::unit, and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +ZeroCrossing::FeatureSet ZeroCrossing::process | +( | +const float *const * | +inputBuffers, | +
+ | + | Vamp::RealTime | +timestamp | +
+ | ) | + [virtual] |
+
Process a single block of input data.
+If the plugin's inputDomain is TimeDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize consecutive audio samples (the host will zero-pad as necessary). The timestamp in this case will be the real time in seconds of the start of the supplied block of samples.
+If the plugin's inputDomain is FrequencyDomain, inputBuffers will point to one array of floats per input channel, and each of these arrays will contain blockSize/2+1 consecutive pairs of real and imaginary component floats corresponding to bins 0..(blockSize/2) of the FFT output. That is, bin 0 (the first pair of floats) contains the DC output, up to bin blockSize/2 which contains the Nyquist-frequency output. There will therefore be blockSize+2 floats per channel in total. The timestamp will be the real time in seconds of the centre of the FFT input window (i.e. the very first block passed to process might contain the FFT of half a block of zero samples and the first half-block of the actual data, with a timestamp of zero).
+Return any features that have become available after this process call. (These do not necessarily have to fall within the process block, except for OneSamplePerStep outputs.)
+ +Implements Vamp::Plugin.
+ +Definition at line 142 of file ZeroCrossing.cpp.
+ +References Vamp::RealTime::frame2RealTime(), Vamp::Plugin::Feature::hasTimestamp, Vamp::Plugin::m_inputSampleRate, m_previousSample, m_stepSize, Vamp::Plugin::Feature::timestamp, and Vamp::Plugin::Feature::values.
+ +ZeroCrossing::FeatureSet ZeroCrossing::getRemainingFeatures | +( | +) | + [virtual] |
+
After all blocks have been processed, calculate and return any remaining features derived from the complete input.
+ +Implements Vamp::Plugin.
+ +Definition at line 191 of file ZeroCrossing.cpp.
+ +virtual size_t Vamp::Plugin::getPreferredBlockSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred block size (window size -- the number of sample frames passed in each block to the process() function).
+This should be called before initialise().
+A plugin that can handle any block size may return 0. The final block size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 179 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getPreferredStepSize | +( | +) | + const [inline, virtual, inherited] |
+
Get the preferred step size (window increment -- the distance in sample frames between the start frames of consecutive blocks passed to the process() function) for the plugin.
+This should be called before initialise().
+A plugin may return 0 if it has no particular interest in the step size. In this case, the host should make the step size equal to the block size if the plugin is accepting input in the time domain. If the plugin is accepting input in the frequency domain, the host may use any step size. The final step size will be set in the initialise() call.
+ +Reimplemented in Vamp::HostExt::PluginInputDomainAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 194 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMinChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the minimum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 199 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual size_t Vamp::Plugin::getMaxChannelCount | +( | +) | + const [inline, virtual, inherited] |
+
Get the maximum supported number of input channels.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 204 of file vamp-sdk/Plugin.h.
+ +Referenced by enumeratePlugins(), FixedTempoEstimator::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), SpectralCentroid::initialise(), initialise(), PowerSpectrum::initialise(), and runPlugin().
+ +virtual std::string Vamp::Plugin::getType | +( | +) | + const [inline, virtual, inherited] |
+
Used to distinguish between Vamp::Plugin and other potential sibling subclasses of PluginBase.
+Do not reimplement this function in your subclass.
+ +Implements Vamp::PluginBase.
+ +Definition at line 430 of file vamp-sdk/Plugin.h.
+ +virtual unsigned int Vamp::PluginBase::getVampApiVersion | +( | +) | + const [inline, virtual, inherited] |
+
Get the Vamp API compatibility level of the plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 72 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | +) | + const [inline, virtual, inherited] |
+
Get the controllable parameters of this plugin.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 208 of file vamp-sdk/PluginBase.h.
+ +Referenced by enumeratePlugins().
+ +virtual float Vamp::PluginBase::getParameter | +( | +std::string | +) | + const [inline, virtual, inherited] |
+
Get the value of a named parameter.
+The argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 216 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::setParameter | +( | +std::string | +, | +
+ | + | float | ++ |
+ | ) | + [inline, virtual, inherited] |
+
Set a named parameter.
+The first argument is the identifier field from that parameter's descriptor.
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, FixedTempoEstimator, and PercussionOnsetDetector.
+ +Definition at line 222 of file vamp-sdk/PluginBase.h.
+ +virtual ProgramList Vamp::PluginBase::getPrograms | +( | +) | + const [inline, virtual, inherited] |
+
Get the program settings available in this plugin.
+A program is a named shorthand for a set of parameter values; changing the program may cause the plugin to alter the values of its published parameters (and/or non-public internal processing parameters). The host should re-read the plugin's parameter values after setting a new program.
+The programs must have unique names.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 237 of file vamp-sdk/PluginBase.h.
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | +) | + const [inline, virtual, inherited] |
+
Get the current program.
+ +Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 242 of file vamp-sdk/PluginBase.h.
+ +virtual void Vamp::PluginBase::selectProgram | +( | +std::string | +) | + [inline, virtual, inherited] |
+
Select a program.
+(If the given program name is not one of the available programs, do nothing.)
+ +Reimplemented in Vamp::HostExt::PluginBufferingAdapter, Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 248 of file vamp-sdk/PluginBase.h.
+ +size_t ZeroCrossing::m_stepSize [protected] |
+
Definition at line 73 of file ZeroCrossing.h.
+ +Referenced by initialise(), and process().
+ +float ZeroCrossing::m_previousSample [protected] |
+
Definition at line 74 of file ZeroCrossing.h.
+ + + +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
Definition at line 436 of file vamp-sdk/Plugin.h.
+ +Referenced by FixedTempoEstimator::D::assembleFeatures(), FixedTempoEstimator::D::calculate(), FixedTempoEstimator::D::getOutputDescriptors(), getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), AmplitudeFollower::initialise(), FixedTempoEstimator::D::initialise(), FixedTempoEstimator::D::lag2tempo(), process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and FixedTempoEstimator::D::tempo2lag().
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+Files | |
file | AmplitudeFollower.cpp [code] |
file | AmplitudeFollower.h [code] |
file | FixedTempoEstimator.cpp [code] |
file | FixedTempoEstimator.h [code] |
file | PercussionOnsetDetector.cpp [code] |
file | PercussionOnsetDetector.h [code] |
file | plugins.cpp [code] |
file | PowerSpectrum.cpp [code] |
file | PowerSpectrum.h [code] |
file | SpectralCentroid.cpp [code] |
file | SpectralCentroid.h [code] |
file | ZeroCrossing.cpp [code] |
file | ZeroCrossing.h [code] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+Files | |
file | system.h [code] |
file | vamp-simple-host.cpp [code] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+Files | |
file | hostguard.h [code] |
file | vamp-hostsdk/Plugin.h [code] |
file | vamp-hostsdk/PluginBase.h [code] |
file | PluginBufferingAdapter.h [code] |
file | PluginChannelAdapter.h [code] |
file | PluginHostAdapter.h [code] |
file | PluginInputDomainAdapter.h [code] |
file | PluginLoader.h [code] |
file | PluginSummarisingAdapter.h [code] |
file | PluginWrapper.h [code] |
file | vamp-hostsdk/RealTime.h [code] |
file | vamp-hostsdk.h [code] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+Files | |
file | plugguard.h [code] |
file | vamp-sdk/Plugin.h [code] |
file | PluginAdapter.h [code] |
file | vamp-sdk/PluginBase.h [code] |
file | vamp-sdk/RealTime.h [code] |
file | vamp-sdk.h [code] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
AmplitudeFollower.cpp [code] | |
AmplitudeFollower.h [code] | |
doc-overview [code] | |
FixedTempoEstimator.cpp [code] | |
FixedTempoEstimator.h [code] | |
hostguard.h [code] | |
PercussionOnsetDetector.cpp [code] | |
PercussionOnsetDetector.h [code] | |
plugguard.h [code] | |
vamp-sdk/Plugin.h [code] | |
vamp-hostsdk/Plugin.h [code] | |
PluginAdapter.h [code] | |
vamp-sdk/PluginBase.h [code] | |
vamp-hostsdk/PluginBase.h [code] | |
PluginBufferingAdapter.h [code] | |
PluginChannelAdapter.h [code] | |
PluginHostAdapter.h [code] | |
PluginInputDomainAdapter.h [code] | |
PluginLoader.h [code] | |
plugins.cpp [code] | |
PluginSummarisingAdapter.h [code] | |
PluginWrapper.h [code] | |
PowerSpectrum.cpp [code] | |
PowerSpectrum.h [code] | |
vamp-sdk/RealTime.h [code] | |
vamp-hostsdk/RealTime.h [code] | |
SpectralCentroid.cpp [code] | |
SpectralCentroid.h [code] | |
system.h [code] | |
vamp-hostsdk.h [code] | |
vamp-sdk.h [code] | |
vamp-simple-host.cpp [code] | |
vamp.h [code] | |
ZeroCrossing.cpp [code] | |
ZeroCrossing.h [code] |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
This page explains how to interpret the graphs that are generated by doxygen.
+Consider the following example:
+/*! Invisible class because of truncation */ +class Invisible { }; + +/*! Truncated class, inheritance relation is hidden */ +class Truncated : public Invisible { }; + +/* Class not documented with doxygen comments */ +class Undocumented { }; + +/*! Class that is inherited using public inheritance */ +class PublicBase : public Truncated { }; + +/*! A template class */ +template<class T> class Templ { }; + +/*! Class that is inherited using protected inheritance */ +class ProtectedBase { }; + +/*! Class that is inherited using private inheritance */ +class PrivateBase { }; + +/*! Class that is used by the Inherited class */ +class Used { }; + +/*! Super class that inherits a number of other classes */ +class Inherited : public PublicBase, + protected ProtectedBase, + private PrivateBase, + public Undocumented, + public Templ<int> +{ + private: + Used *m_usedClass; +}; +
This will result in the following graph:
+The boxes in the above graph have the following meaning:
+The arrows have the following meaning:
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Go to the source code of this file.
++Defines | |
#define | _VAMP_IN_HOSTSDK |
#define | _VAMP_SDK_HOSTSPACE_BEGIN(h) namespace _VampHost { |
#define | _VAMP_SDK_HOSTSPACE_END(h) |
#define | _VAMP_SDK_PLUGSPACE_BEGIN(h) namespace _VampHost { |
#define | _VAMP_SDK_PLUGSPACE_END(h) |
#define _VAMP_IN_HOSTSDK | +
Definition at line 44 of file hostguard.h.
+ +#define _VAMP_SDK_HOSTSPACE_BEGIN | +( | ++ | h | ) | +namespace _VampHost { | +
Definition at line 52 of file hostguard.h.
+ +#define _VAMP_SDK_HOSTSPACE_END | +( | ++ | h | ) | ++ |
} \
+ using namespace _VampHost;
+
Definition at line 55 of file hostguard.h.
+ +#define _VAMP_SDK_PLUGSPACE_BEGIN | +( | ++ | h | ) | +namespace _VampHost { | +
Definition at line 58 of file hostguard.h.
+ +#define _VAMP_SDK_PLUGSPACE_END | +( | ++ | h | ) | ++ |
} \
+ using namespace _VampHost;
+
Definition at line 61 of file hostguard.h.
+ +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +00002 +00003 /* +00004 Vamp +00005 +00006 An API for audio analysis and feature extraction plugins. +00007 +00008 Centre for Digital Music, Queen Mary, University of London. +00009 Copyright 2006 Chris Cannam. +00010 +00011 Permission is hereby granted, free of charge, to any person +00012 obtaining a copy of this software and associated documentation +00013 files (the "Software"), to deal in the Software without +00014 restriction, including without limitation the rights to use, copy, +00015 modify, merge, publish, distribute, sublicense, and/or sell copies +00016 of the Software, and to permit persons to whom the Software is +00017 furnished to do so, subject to the following conditions: +00018 +00019 The above copyright notice and this permission notice shall be +00020 included in all copies or substantial portions of the Software. +00021 +00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00029 +00030 Except as contained in this notice, the names of the Centre for +00031 Digital Music; Queen Mary, University of London; and Chris Cannam +00032 shall not be used in advertising or otherwise to promote the sale, +00033 use or other dealings in this Software without prior written +00034 authorization. +00035 */ +00036 +00037 #ifndef _VAMP_HOSTSDK_HOSTGUARD_H_ +00038 #define _VAMP_HOSTSDK_HOSTGUARD_H_ +00039 +00040 #ifdef _VAMP_IN_PLUGINSDK +00041 #error You have included headers from both vamp-sdk and vamp-hostsdk in the same source file. Please include only vamp-sdk headers in plugin code, and only vamp-hostsdk headers in host code. +00042 #else +00043 +00044 #define _VAMP_IN_HOSTSDK +00045 +00046 #ifdef _VAMP_NO_HOST_NAMESPACE +00047 #define _VAMP_SDK_HOSTSPACE_BEGIN(h) +00048 #define _VAMP_SDK_HOSTSPACE_END(h) +00049 #define _VAMP_SDK_PLUGSPACE_BEGIN(h) +00050 #define _VAMP_SDK_PLUGSPACE_END(h) +00051 #else +00052 #define _VAMP_SDK_HOSTSPACE_BEGIN(h) \ +00053 namespace _VampHost { +00054 +00055 #define _VAMP_SDK_HOSTSPACE_END(h) \ +00056 } \ +00057 using namespace _VampHost; +00058 #define _VAMP_SDK_PLUGSPACE_BEGIN(h) \ +00059 namespace _VampHost { +00060 +00061 #define _VAMP_SDK_PLUGSPACE_END(h) \ +00062 } \ +00063 using namespace _VampHost; +00064 #endif +00065 +00066 #endif +00067 +00068 #endif +00069 +
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
Vamp is an API for C and C++ plugins that process sampled audio data to produce descriptive output (measurements or semantic observations). Find more information at http://www.vamp-plugins.org/ .
+Although the official API for Vamp plugins is defined in C for maximum binary compatibility, we strongly recommend using the provided C++ classes in the SDK to implement your own plugins and hosts.
+Plugins should subclass Vamp::Plugin, and then use a Vamp::PluginAdapter to expose the correct C API for the plugin. Read the documentation for Vamp::PluginBase and Vamp::Plugin before starting.
+Plugins should be compiled and linked into dynamic libraries using the usual convention for your platform, and should link (preferably statically) with -lvamp-sdk. Any number of plugins can reside in a single dynamic library. See plugins.cpp in the example plugins directory for the sort of code that will need to accompany your plugin class or classes, to make it possible for a host to look up your plugins properly.
+Please read the relevant README file for your platform found in the Vamp SDK build/ directory, for details about how to ensure the resulting dynamic library exports the correct linker symbols.
+The following example plugins are provided. You may legally reuse any amount of the code from these examples in any plugins you write, whether proprietary or open-source.
+Hosts will normally use a Vamp::PluginHostAdapter to convert each plugin's exposed C API back into a useful Vamp::Plugin C++ object.
+The Vamp::HostExt namespace contains several additional C++ classes to do this work for them, and make the host's life easier:
+The PluginLoader class can also use the input domain, channel, and buffering adapters automatically to make these conversions transparent to the host if required.
+Host authors should also refer to the example host code in the host directory of the SDK.
+Hosts should link with -lvamp-hostsdk.
+(The following notes in this section are mostly relevant for developers that are not using the HostExt classes, or that wish to know more about the policy they implement.)
+The Vamp API does not officially specify how to load plugin libraries or where to find them. However, the SDK does include a function (Vamp::PluginHostAdapter::getPluginPath()) that returns a recommended directory search path that hosts may use for plugin libraries, and a class (Vamp::HostExt::PluginLoader) that implements a sensible cross-platform lookup policy using this path. We recommend using this class in your host unless you have a good reason not to want to. This implementation also permits the user to set the environment variable VAMP_PATH to override the default path if desired.
+The policy used by Vamp::HostExt::PluginLoader -- and our recommendation for any host -- is to search each directory in this path for .DLL (on Windows), .so (on Linux, Solaris, BSD etc) or .dylib (on OS/X) files, then to load each one and perform a dynamic name lookup on the vampGetPluginDescriptor function to enumerate the plugins in the library. The example host has some code that may help, but this operation will necessarily be system-dependent.
+Vamp also has an informal convention for sorting plugins into functional categories. In addition to the library file itself, a plugin library may install a category file with the same name as the library but .cat extension. The existence and format of this file are not specified by the Vamp API, but by convention the file may contain lines of the format
+vamp:pluginlibrary:pluginname::General Category > Specific Category +
which a host may read and use to assign plugins a location within a category tree for display to the user. The expectation is that advanced users may also choose to set up their own preferred category trees, which is why this information is not queried as part of the Vamp plugin's API itself. The Vamp::HostExt::PluginLoader class also provides support for plugin category lookup using this scheme.
+This plugin SDK is freely redistributable under a "new-style BSD" licence. See the file COPYING for more details. In short, you may modify and redistribute the SDK and example plugins within any commercial or non-commercial, proprietary or open-source plugin or application under almost any conditions, with no obligation to provide source code, provided you retain the original copyright note.
+
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
+ VampPluginSDK
+ 2.1
+
+
+ |
+
+
+
+
+Namespaces | |
namespace | HostExt |
+Classes | |
class | Plugin |
Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio or related data. More... | |
class | PluginAdapterBase |
PluginAdapter and PluginAdapterBase provide a wrapper class that a plugin library can use to make its C++ Vamp::Plugin objects available through the Vamp C API. More... | |
class | PluginAdapter |
PluginAdapter turns a PluginAdapterBase into a specific wrapper for a particular plugin implementation. More... | |
class | PluginBase |
A base class for plugins with optional configurable parameters, programs, etc. More... | |
class | RealTime |
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions. More... | |
class | PluginHostAdapter |
PluginHostAdapter is a wrapper class that a Vamp host can use to make the C-language VampPluginDescriptor object appear as a C++ Vamp::Plugin object. More... | |
+Functions | |
std::ostream & | operator<< (std::ostream &out, const RealTime &rt) |
std::ostream& Vamp::operator<< | +( | +std::ostream & | +out, | +
+ | + | const RealTime & | +rt | +
+ | ) | ++ |