# HG changeset patch # User cannam # Date 1222088506 0 # Node ID 351c4ebce5f9f05dc6fe2eaeaefc95ef5270f00e * Move website from vamp-website/trunk to plain website diff -r 000000000000 -r 351c4ebce5f9 code-doc/AmplitudeFollower_8cpp-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/code-doc/AmplitudeFollower_8cpp-source.html Mon Sep 22 13:01:46 2008 +0000 @@ -0,0 +1,269 @@ + +
+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 = ""; +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 = ""; +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 = ""; +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 +
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 +
+ +
+Go to the source code of this file.
Classes | |
class | AmplitudeFollower |
Example plugin implementing the SuperCollider amplitude follower function. More... |
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 << ", mag=" << mag << ", prior=" << m_priorMagnitudes[i] << ", diff=" << diff << ", threshold=" << 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 Feature onset; +00268 onset.hasTimestamp = true; +00269 onset.timestamp = ts - Vamp::RealTime::frame2RealTime +00270 (m_stepSize, lrintf(m_inputSampleRate)); +00271 returnFeatures[0].push_back(onset); +00272 } +00273 +00274 m_dfMinus2 = m_dfMinus1; +00275 m_dfMinus1 = count; +00276 +00277 return returnFeatures; +00278 } +00279 +00280 PercussionOnsetDetector::FeatureSet +00281 PercussionOnsetDetector::getRemainingFeatures() +00282 { +00283 return FeatureSet(); +00284 } +00285 +
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 +
+ +
+Go to the source code of this file.
Classes | |
class | PercussionOnsetDetector |
Example plugin that detects percussive events. More... |
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 "PluginAdapter.h" +00038 +00039 #include <cstring> +00040 #include <cstdlib> +00041 +00042 //#define DEBUG_PLUGIN_ADAPTER 1 +00043 +00044 namespace Vamp { +00045 +00046 class PluginAdapterBase::Impl +00047 { +00048 public: +00049 Impl(PluginAdapterBase *); +00050 ~Impl(); +00051 +00052 const VampPluginDescriptor *getDescriptor(); +00053 +00054 protected: +00055 PluginAdapterBase *m_base; +00056 +00057 static VampPluginHandle vampInstantiate(const VampPluginDescriptor *desc, +00058 float inputSampleRate); +00059 +00060 static void vampCleanup(VampPluginHandle handle); +00061 +00062 static int vampInitialise(VampPluginHandle handle, unsigned int channels, +00063 unsigned int stepSize, unsigned int blockSize); +00064 +00065 static void vampReset(VampPluginHandle handle); +00066 +00067 static float vampGetParameter(VampPluginHandle handle, int param); +00068 static void vampSetParameter(VampPluginHandle handle, int param, float value); +00069 +00070 static unsigned int vampGetCurrentProgram(VampPluginHandle handle); +00071 static void vampSelectProgram(VampPluginHandle handle, unsigned int program); +00072 +00073 static unsigned int vampGetPreferredStepSize(VampPluginHandle handle); +00074 static unsigned int vampGetPreferredBlockSize(VampPluginHandle handle); +00075 static unsigned int vampGetMinChannelCount(VampPluginHandle handle); +00076 static unsigned int vampGetMaxChannelCount(VampPluginHandle handle); +00077 +00078 static unsigned int vampGetOutputCount(VampPluginHandle handle); +00079 +00080 static VampOutputDescriptor *vampGetOutputDescriptor(VampPluginHandle handle, +00081 unsigned int i); +00082 +00083 static void vampReleaseOutputDescriptor(VampOutputDescriptor *desc); +00084 +00085 static VampFeatureList *vampProcess(VampPluginHandle handle, +00086 const float *const *inputBuffers, +00087 int sec, +00088 int nsec); +00089 +00090 static VampFeatureList *vampGetRemainingFeatures(VampPluginHandle handle); +00091 +00092 static void vampReleaseFeatureSet(VampFeatureList *fs); +00093 +00094 void cleanup(Plugin *plugin); +00095 void checkOutputMap(Plugin *plugin); +00096 unsigned int getOutputCount(Plugin *plugin); +00097 VampOutputDescriptor *getOutputDescriptor(Plugin *plugin, +00098 unsigned int i); +00099 VampFeatureList *process(Plugin *plugin, +00100 const float *const *inputBuffers, +00101 int sec, int nsec); +00102 VampFeatureList *getRemainingFeatures(Plugin *plugin); +00103 VampFeatureList *convertFeatures(Plugin *plugin, +00104 const Plugin::FeatureSet &features); +00105 +00106 // maps both plugins and descriptors to adapters +00107 typedef std::map<const void *, Impl *> AdapterMap; +00108 static AdapterMap *m_adapterMap; +00109 static Impl *lookupAdapter(VampPluginHandle); +00110 +00111 bool m_populated; +00112 VampPluginDescriptor m_descriptor; +00113 Plugin::ParameterList m_parameters; +00114 Plugin::ProgramList m_programs; +00115 +00116 typedef std::map<Plugin *, Plugin::OutputList *> OutputMap; +00117 OutputMap m_pluginOutputs; +00118 +00119 std::map<Plugin *, VampFeatureList *> m_fs; +00120 std::map<Plugin *, std::vector<size_t> > m_fsizes; +00121 std::map<Plugin *, std::vector<std::vector<size_t> > > m_fvsizes; +00122 void resizeFS(Plugin *plugin, int n); +00123 void resizeFL(Plugin *plugin, int n, size_t sz); +00124 void resizeFV(Plugin *plugin, int n, int j, size_t sz); +00125 }; +00126 +00127 PluginAdapterBase::PluginAdapterBase() +00128 { +00129 m_impl = new Impl(this); +00130 } +00131 +00132 PluginAdapterBase::~PluginAdapterBase() +00133 { +00134 delete m_impl; +00135 } +00136 +00137 const VampPluginDescriptor * +00138 PluginAdapterBase::getDescriptor() +00139 { +00140 return m_impl->getDescriptor(); +00141 } +00142 +00143 PluginAdapterBase::Impl::Impl(PluginAdapterBase *base) : +00144 m_base(base), +00145 m_populated(false) +00146 { +00147 #ifdef DEBUG_PLUGIN_ADAPTER +00148 std::cerr << "PluginAdapterBase::Impl[" << this << "]::Impl" << std::endl; +00149 #endif +00150 } +00151 +00152 const VampPluginDescriptor * +00153 PluginAdapterBase::Impl::getDescriptor() +00154 { +00155 #ifdef DEBUG_PLUGIN_ADAPTER +00156 std::cerr << "PluginAdapterBase::Impl[" << this << "]::getDescriptor" << std::endl; +00157 #endif +00158 +00159 if (m_populated) return &m_descriptor; +00160 +00161 Plugin *plugin = m_base->createPlugin(48000); +00162 +00163 if (plugin->getVampApiVersion() != VAMP_API_VERSION) { +00164 std::cerr << "Vamp::PluginAdapterBase::Impl::getDescriptor: ERROR: " +00165 << "Plugin object API version " +00166 << plugin->getVampApiVersion() +00167 << " does not match actual API version " +00168 << VAMP_API_VERSION << std::endl; +00169 delete plugin; +00170 return 0; +00171 } +00172 +00173 m_parameters = plugin->getParameterDescriptors(); +00174 m_programs = plugin->getPrograms(); +00175 +00176 m_descriptor.vampApiVersion = plugin->getVampApiVersion(); +00177 m_descriptor.identifier = strdup(plugin->getIdentifier().c_str()); +00178 m_descriptor.name = strdup(plugin->getName().c_str()); +00179 m_descriptor.description = strdup(plugin->getDescription().c_str()); +00180 m_descriptor.maker = strdup(plugin->getMaker().c_str()); +00181 m_descriptor.pluginVersion = plugin->getPluginVersion(); +00182 m_descriptor.copyright = strdup(plugin->getCopyright().c_str()); +00183 +00184 m_descriptor.parameterCount = m_parameters.size(); +00185 m_descriptor.parameters = (const VampParameterDescriptor **) +00186 malloc(m_parameters.size() * sizeof(VampParameterDescriptor)); +00187 +00188 unsigned int i; +00189 +00190 for (i = 0; i < m_parameters.size(); ++i) { +00191 VampParameterDescriptor *desc = (VampParameterDescriptor *) +00192 malloc(sizeof(VampParameterDescriptor)); +00193 desc->identifier = strdup(m_parameters[i].identifier.c_str()); +00194 desc->name = strdup(m_parameters[i].name.c_str()); +00195 desc->description = strdup(m_parameters[i].description.c_str()); +00196 desc->unit = strdup(m_parameters[i].unit.c_str()); +00197 desc->minValue = m_parameters[i].minValue; +00198 desc->maxValue = m_parameters[i].maxValue; +00199 desc->defaultValue = m_parameters[i].defaultValue; +00200 desc->isQuantized = m_parameters[i].isQuantized; +00201 desc->quantizeStep = m_parameters[i].quantizeStep; +00202 desc->valueNames = 0; +00203 if (desc->isQuantized && !m_parameters[i].valueNames.empty()) { +00204 desc->valueNames = (const char **) +00205 malloc((m_parameters[i].valueNames.size()+1) * sizeof(char *)); +00206 for (unsigned int j = 0; j < m_parameters[i].valueNames.size(); ++j) { +00207 desc->valueNames[j] = strdup(m_parameters[i].valueNames[j].c_str()); +00208 } +00209 desc->valueNames[m_parameters[i].valueNames.size()] = 0; +00210 } +00211 m_descriptor.parameters[i] = desc; +00212 } +00213 +00214 m_descriptor.programCount = m_programs.size(); +00215 m_descriptor.programs = (const char **) +00216 malloc(m_programs.size() * sizeof(const char *)); +00217 +00218 for (i = 0; i < m_programs.size(); ++i) { +00219 m_descriptor.programs[i] = strdup(m_programs[i].c_str()); +00220 } +00221 +00222 if (plugin->getInputDomain() == Plugin::FrequencyDomain) { +00223 m_descriptor.inputDomain = vampFrequencyDomain; +00224 } else { +00225 m_descriptor.inputDomain = vampTimeDomain; +00226 } +00227 +00228 m_descriptor.instantiate = vampInstantiate; +00229 m_descriptor.cleanup = vampCleanup; +00230 m_descriptor.initialise = vampInitialise; +00231 m_descriptor.reset = vampReset; +00232 m_descriptor.getParameter = vampGetParameter; +00233 m_descriptor.setParameter = vampSetParameter; +00234 m_descriptor.getCurrentProgram = vampGetCurrentProgram; +00235 m_descriptor.selectProgram = vampSelectProgram; +00236 m_descriptor.getPreferredStepSize = vampGetPreferredStepSize; +00237 m_descriptor.getPreferredBlockSize = vampGetPreferredBlockSize; +00238 m_descriptor.getMinChannelCount = vampGetMinChannelCount; +00239 m_descriptor.getMaxChannelCount = vampGetMaxChannelCount; +00240 m_descriptor.getOutputCount = vampGetOutputCount; +00241 m_descriptor.getOutputDescriptor = vampGetOutputDescriptor; +00242 m_descriptor.releaseOutputDescriptor = vampReleaseOutputDescriptor; +00243 m_descriptor.process = vampProcess; +00244 m_descriptor.getRemainingFeatures = vampGetRemainingFeatures; +00245 m_descriptor.releaseFeatureSet = vampReleaseFeatureSet; +00246 +00247 if (!m_adapterMap) { +00248 m_adapterMap = new AdapterMap; +00249 } +00250 (*m_adapterMap)[&m_descriptor] = this; +00251 +00252 delete plugin; +00253 +00254 m_populated = true; +00255 return &m_descriptor; +00256 } +00257 +00258 PluginAdapterBase::Impl::~Impl() +00259 { +00260 #ifdef DEBUG_PLUGIN_ADAPTER +00261 std::cerr << "PluginAdapterBase::Impl[" << this << "]::~Impl" << std::endl; +00262 #endif +00263 +00264 if (!m_populated) return; +00265 +00266 free((void *)m_descriptor.identifier); +00267 free((void *)m_descriptor.name); +00268 free((void *)m_descriptor.description); +00269 free((void *)m_descriptor.maker); +00270 free((void *)m_descriptor.copyright); +00271 +00272 for (unsigned int i = 0; i < m_descriptor.parameterCount; ++i) { +00273 const VampParameterDescriptor *desc = m_descriptor.parameters[i]; +00274 free((void *)desc->identifier); +00275 free((void *)desc->name); +00276 free((void *)desc->description); +00277 free((void *)desc->unit); +00278 if (desc->valueNames) { +00279 for (unsigned int j = 0; desc->valueNames[j]; ++j) { +00280 free((void *)desc->valueNames[j]); +00281 } +00282 free((void *)desc->valueNames); +00283 } +00284 } +00285 free((void *)m_descriptor.parameters); +00286 +00287 for (unsigned int i = 0; i < m_descriptor.programCount; ++i) { +00288 free((void *)m_descriptor.programs[i]); +00289 } +00290 free((void *)m_descriptor.programs); +00291 +00292 if (m_adapterMap) { +00293 +00294 m_adapterMap->erase(&m_descriptor); +00295 +00296 if (m_adapterMap->empty()) { +00297 delete m_adapterMap; +00298 m_adapterMap = 0; +00299 } +00300 } +00301 } +00302 +00303 PluginAdapterBase::Impl * +00304 PluginAdapterBase::Impl::lookupAdapter(VampPluginHandle handle) +00305 { +00306 #ifdef DEBUG_PLUGIN_ADAPTER +00307 std::cerr << "PluginAdapterBase::Impl::lookupAdapter(" << handle << ")" << std::endl; +00308 #endif +00309 +00310 if (!m_adapterMap) return 0; +00311 AdapterMap::const_iterator i = m_adapterMap->find(handle); +00312 if (i == m_adapterMap->end()) return 0; +00313 return i->second; +00314 } +00315 +00316 VampPluginHandle +00317 PluginAdapterBase::Impl::vampInstantiate(const VampPluginDescriptor *desc, +00318 float inputSampleRate) +00319 { +00320 #ifdef DEBUG_PLUGIN_ADAPTER +00321 std::cerr << "PluginAdapterBase::Impl::vampInstantiate(" << desc << ")" << std::endl; +00322 #endif +00323 +00324 if (!m_adapterMap) { +00325 m_adapterMap = new AdapterMap(); +00326 } +00327 +00328 if (m_adapterMap->find(desc) == m_adapterMap->end()) { +00329 std::cerr << "WARNING: PluginAdapterBase::Impl::vampInstantiate: Descriptor " << desc << " not in adapter map" << std::endl; +00330 return 0; +00331 } +00332 +00333 Impl *adapter = (*m_adapterMap)[desc]; +00334 if (desc != &adapter->m_descriptor) return 0; +00335 +00336 Plugin *plugin = adapter->m_base->createPlugin(inputSampleRate); +00337 if (plugin) { +00338 (*m_adapterMap)[plugin] = adapter; +00339 } +00340 +00341 #ifdef DEBUG_PLUGIN_ADAPTER +00342 std::cerr << "PluginAdapterBase::Impl::vampInstantiate(" << desc << "): returning handle " << plugin << std::endl; +00343 #endif +00344 +00345 return plugin; +00346 } +00347 +00348 void +00349 PluginAdapterBase::Impl::vampCleanup(VampPluginHandle handle) +00350 { +00351 #ifdef DEBUG_PLUGIN_ADAPTER +00352 std::cerr << "PluginAdapterBase::Impl::vampCleanup(" << handle << ")" << std::endl; +00353 #endif +00354 +00355 Impl *adapter = lookupAdapter(handle); +00356 if (!adapter) { +00357 delete ((Plugin *)handle); +00358 return; +00359 } +00360 adapter->cleanup(((Plugin *)handle)); +00361 } +00362 +00363 int +00364 PluginAdapterBase::Impl::vampInitialise(VampPluginHandle handle, +00365 unsigned int channels, +00366 unsigned int stepSize, +00367 unsigned int blockSize) +00368 { +00369 #ifdef DEBUG_PLUGIN_ADAPTER +00370 std::cerr << "PluginAdapterBase::Impl::vampInitialise(" << handle << ", " << channels << ", " << stepSize << ", " << blockSize << ")" << std::endl; +00371 #endif +00372 +00373 bool result = ((Plugin *)handle)->initialise +00374 (channels, stepSize, blockSize); +00375 return result ? 1 : 0; +00376 } +00377 +00378 void +00379 PluginAdapterBase::Impl::vampReset(VampPluginHandle handle) +00380 { +00381 #ifdef DEBUG_PLUGIN_ADAPTER +00382 std::cerr << "PluginAdapterBase::Impl::vampReset(" << handle << ")" << std::endl; +00383 #endif +00384 +00385 ((Plugin *)handle)->reset(); +00386 } +00387 +00388 float +00389 PluginAdapterBase::Impl::vampGetParameter(VampPluginHandle handle, +00390 int param) +00391 { +00392 #ifdef DEBUG_PLUGIN_ADAPTER +00393 std::cerr << "PluginAdapterBase::Impl::vampGetParameter(" << handle << ", " << param << ")" << std::endl; +00394 #endif +00395 +00396 Impl *adapter = lookupAdapter(handle); +00397 if (!adapter) return 0.0; +00398 Plugin::ParameterList &list = adapter->m_parameters; +00399 return ((Plugin *)handle)->getParameter(list[param].identifier); +00400 } +00401 +00402 void +00403 PluginAdapterBase::Impl::vampSetParameter(VampPluginHandle handle, +00404 int param, float value) +00405 { +00406 #ifdef DEBUG_PLUGIN_ADAPTER +00407 std::cerr << "PluginAdapterBase::Impl::vampSetParameter(" << handle << ", " << param << ", " << value << ")" << std::endl; +00408 #endif +00409 +00410 Impl *adapter = lookupAdapter(handle); +00411 if (!adapter) return; +00412 Plugin::ParameterList &list = adapter->m_parameters; +00413 ((Plugin *)handle)->setParameter(list[param].identifier, value); +00414 } +00415 +00416 unsigned int +00417 PluginAdapterBase::Impl::vampGetCurrentProgram(VampPluginHandle handle) +00418 { +00419 #ifdef DEBUG_PLUGIN_ADAPTER +00420 std::cerr << "PluginAdapterBase::Impl::vampGetCurrentProgram(" << handle << ")" << std::endl; +00421 #endif +00422 +00423 Impl *adapter = lookupAdapter(handle); +00424 if (!adapter) return 0; +00425 Plugin::ProgramList &list = adapter->m_programs; +00426 std::string program = ((Plugin *)handle)->getCurrentProgram(); +00427 for (unsigned int i = 0; i < list.size(); ++i) { +00428 if (list[i] == program) return i; +00429 } +00430 return 0; +00431 } +00432 +00433 void +00434 PluginAdapterBase::Impl::vampSelectProgram(VampPluginHandle handle, +00435 unsigned int program) +00436 { +00437 #ifdef DEBUG_PLUGIN_ADAPTER +00438 std::cerr << "PluginAdapterBase::Impl::vampSelectProgram(" << handle << ", " << program << ")" << std::endl; +00439 #endif +00440 +00441 Impl *adapter = lookupAdapter(handle); +00442 if (!adapter) return; +00443 Plugin::ProgramList &list = adapter->m_programs; +00444 ((Plugin *)handle)->selectProgram(list[program]); +00445 } +00446 +00447 unsigned int +00448 PluginAdapterBase::Impl::vampGetPreferredStepSize(VampPluginHandle handle) +00449 { +00450 #ifdef DEBUG_PLUGIN_ADAPTER +00451 std::cerr << "PluginAdapterBase::Impl::vampGetPreferredStepSize(" << handle << ")" << std::endl; +00452 #endif +00453 +00454 return ((Plugin *)handle)->getPreferredStepSize(); +00455 } +00456 +00457 unsigned int +00458 PluginAdapterBase::Impl::vampGetPreferredBlockSize(VampPluginHandle handle) +00459 { +00460 #ifdef DEBUG_PLUGIN_ADAPTER +00461 std::cerr << "PluginAdapterBase::Impl::vampGetPreferredBlockSize(" << handle << ")" << std::endl; +00462 #endif +00463 +00464 return ((Plugin *)handle)->getPreferredBlockSize(); +00465 } +00466 +00467 unsigned int +00468 PluginAdapterBase::Impl::vampGetMinChannelCount(VampPluginHandle handle) +00469 { +00470 #ifdef DEBUG_PLUGIN_ADAPTER +00471 std::cerr << "PluginAdapterBase::Impl::vampGetMinChannelCount(" << handle << ")" << std::endl; +00472 #endif +00473 +00474 return ((Plugin *)handle)->getMinChannelCount(); +00475 } +00476 +00477 unsigned int +00478 PluginAdapterBase::Impl::vampGetMaxChannelCount(VampPluginHandle handle) +00479 { +00480 #ifdef DEBUG_PLUGIN_ADAPTER +00481 std::cerr << "PluginAdapterBase::Impl::vampGetMaxChannelCount(" << handle << ")" << std::endl; +00482 #endif +00483 +00484 return ((Plugin *)handle)->getMaxChannelCount(); +00485 } +00486 +00487 unsigned int +00488 PluginAdapterBase::Impl::vampGetOutputCount(VampPluginHandle handle) +00489 { +00490 #ifdef DEBUG_PLUGIN_ADAPTER +00491 std::cerr << "PluginAdapterBase::Impl::vampGetOutputCount(" << handle << ")" << std::endl; +00492 #endif +00493 +00494 Impl *adapter = lookupAdapter(handle); +00495 +00496 // std::cerr << "vampGetOutputCount: handle " << handle << " -> adapter "<< adapter << std::endl; +00497 +00498 if (!adapter) return 0; +00499 return adapter->getOutputCount((Plugin *)handle); +00500 } +00501 +00502 VampOutputDescriptor * +00503 PluginAdapterBase::Impl::vampGetOutputDescriptor(VampPluginHandle handle, +00504 unsigned int i) +00505 { +00506 #ifdef DEBUG_PLUGIN_ADAPTER +00507 std::cerr << "PluginAdapterBase::Impl::vampGetOutputDescriptor(" << handle << ", " << i << ")" << std::endl; +00508 #endif +00509 +00510 Impl *adapter = lookupAdapter(handle); +00511 +00512 // std::cerr << "vampGetOutputDescriptor: handle " << handle << " -> adapter "<< adapter << std::endl; +00513 +00514 if (!adapter) return 0; +00515 return adapter->getOutputDescriptor((Plugin *)handle, i); +00516 } +00517 +00518 void +00519 PluginAdapterBase::Impl::vampReleaseOutputDescriptor(VampOutputDescriptor *desc) +00520 { +00521 #ifdef DEBUG_PLUGIN_ADAPTER +00522 std::cerr << "PluginAdapterBase::Impl::vampReleaseOutputDescriptor(" << desc << ")" << std::endl; +00523 #endif +00524 +00525 if (desc->identifier) free((void *)desc->identifier); +00526 if (desc->name) free((void *)desc->name); +00527 if (desc->description) free((void *)desc->description); +00528 if (desc->unit) free((void *)desc->unit); +00529 if (desc->hasFixedBinCount && desc->binNames) { +00530 for (unsigned int i = 0; i < desc->binCount; ++i) { +00531 if (desc->binNames[i]) { +00532 free((void *)desc->binNames[i]); +00533 } +00534 } +00535 } +00536 if (desc->binNames) free((void *)desc->binNames); +00537 free((void *)desc); +00538 } +00539 +00540 VampFeatureList * +00541 PluginAdapterBase::Impl::vampProcess(VampPluginHandle handle, +00542 const float *const *inputBuffers, +00543 int sec, +00544 int nsec) +00545 { +00546 #ifdef DEBUG_PLUGIN_ADAPTER +00547 std::cerr << "PluginAdapterBase::Impl::vampProcess(" << handle << ", " << sec << ", " << nsec << ")" << std::endl; +00548 #endif +00549 +00550 Impl *adapter = lookupAdapter(handle); +00551 if (!adapter) return 0; +00552 return adapter->process((Plugin *)handle, +00553 inputBuffers, sec, nsec); +00554 } +00555 +00556 VampFeatureList * +00557 PluginAdapterBase::Impl::vampGetRemainingFeatures(VampPluginHandle handle) +00558 { +00559 #ifdef DEBUG_PLUGIN_ADAPTER +00560 std::cerr << "PluginAdapterBase::Impl::vampGetRemainingFeatures(" << handle << ")" << std::endl; +00561 #endif +00562 +00563 Impl *adapter = lookupAdapter(handle); +00564 if (!adapter) return 0; +00565 return adapter->getRemainingFeatures((Plugin *)handle); +00566 } +00567 +00568 void +00569 PluginAdapterBase::Impl::vampReleaseFeatureSet(VampFeatureList *fs) +00570 { +00571 #ifdef DEBUG_PLUGIN_ADAPTER +00572 std::cerr << "PluginAdapterBase::Impl::vampReleaseFeatureSet" << std::endl; +00573 #endif +00574 } +00575 +00576 void +00577 PluginAdapterBase::Impl::cleanup(Plugin *plugin) +00578 { +00579 if (m_fs.find(plugin) != m_fs.end()) { +00580 size_t outputCount = 0; +00581 if (m_pluginOutputs[plugin]) { +00582 outputCount = m_pluginOutputs[plugin]->size(); +00583 } +00584 VampFeatureList *list = m_fs[plugin]; +00585 for (unsigned int i = 0; i < outputCount; ++i) { +00586 for (unsigned int j = 0; j < m_fsizes[plugin][i]; ++j) { +00587 if (list[i].features[j].label) { +00588 free(list[i].features[j].label); +00589 } +00590 if (list[i].features[j].values) { +00591 free(list[i].features[j].values); +00592 } +00593 } +00594 if (list[i].features) free(list[i].features); +00595 } +00596 m_fs.erase(plugin); +00597 m_fsizes.erase(plugin); +00598 m_fvsizes.erase(plugin); +00599 } +00600 +00601 if (m_pluginOutputs.find(plugin) != m_pluginOutputs.end()) { +00602 delete m_pluginOutputs[plugin]; +00603 m_pluginOutputs.erase(plugin); +00604 } +00605 +00606 if (m_adapterMap) { +00607 m_adapterMap->erase(plugin); +00608 +00609 if (m_adapterMap->empty()) { +00610 delete m_adapterMap; +00611 m_adapterMap = 0; +00612 } +00613 } +00614 +00615 delete ((Plugin *)plugin); +00616 } +00617 +00618 void +00619 PluginAdapterBase::Impl::checkOutputMap(Plugin *plugin) +00620 { +00621 if (m_pluginOutputs.find(plugin) == m_pluginOutputs.end() || +00622 !m_pluginOutputs[plugin]) { +00623 m_pluginOutputs[plugin] = new Plugin::OutputList +00624 (plugin->getOutputDescriptors()); +00625 // std::cerr << "PluginAdapterBase::Impl::checkOutputMap: Have " << m_pluginOutputs[plugin]->size() << " outputs for plugin " << plugin->getIdentifier() << std::endl; +00626 } +00627 } +00628 +00629 unsigned int +00630 PluginAdapterBase::Impl::getOutputCount(Plugin *plugin) +00631 { +00632 checkOutputMap(plugin); +00633 return m_pluginOutputs[plugin]->size(); +00634 } +00635 +00636 VampOutputDescriptor * +00637 PluginAdapterBase::Impl::getOutputDescriptor(Plugin *plugin, +00638 unsigned int i) +00639 { +00640 checkOutputMap(plugin); +00641 Plugin::OutputDescriptor &od = +00642 (*m_pluginOutputs[plugin])[i]; +00643 +00644 VampOutputDescriptor *desc = (VampOutputDescriptor *) +00645 malloc(sizeof(VampOutputDescriptor)); +00646 +00647 desc->identifier = strdup(od.identifier.c_str()); +00648 desc->name = strdup(od.name.c_str()); +00649 desc->description = strdup(od.description.c_str()); +00650 desc->unit = strdup(od.unit.c_str()); +00651 desc->hasFixedBinCount = od.hasFixedBinCount; +00652 desc->binCount = od.binCount; +00653 +00654 if (od.hasFixedBinCount && od.binCount > 0) { +00655 desc->binNames = (const char **) +00656 malloc(od.binCount * sizeof(const char *)); +00657 +00658 for (unsigned int i = 0; i < od.binCount; ++i) { +00659 if (i < od.binNames.size()) { +00660 desc->binNames[i] = strdup(od.binNames[i].c_str()); +00661 } else { +00662 desc->binNames[i] = 0; +00663 } +00664 } +00665 } else { +00666 desc->binNames = 0; +00667 } +00668 +00669 desc->hasKnownExtents = od.hasKnownExtents; +00670 desc->minValue = od.minValue; +00671 desc->maxValue = od.maxValue; +00672 desc->isQuantized = od.isQuantized; +00673 desc->quantizeStep = od.quantizeStep; +00674 +00675 switch (od.sampleType) { +00676 case Plugin::OutputDescriptor::OneSamplePerStep: +00677 desc->sampleType = vampOneSamplePerStep; break; +00678 case Plugin::OutputDescriptor::FixedSampleRate: +00679 desc->sampleType = vampFixedSampleRate; break; +00680 case Plugin::OutputDescriptor::VariableSampleRate: +00681 desc->sampleType = vampVariableSampleRate; break; +00682 } +00683 +00684 desc->sampleRate = od.sampleRate; +00685 +00686 return desc; +00687 } +00688 +00689 VampFeatureList * +00690 PluginAdapterBase::Impl::process(Plugin *plugin, +00691 const float *const *inputBuffers, +00692 int sec, int nsec) +00693 { +00694 // std::cerr << "PluginAdapterBase::Impl::process" << std::endl; +00695 RealTime rt(sec, nsec); +00696 checkOutputMap(plugin); +00697 return convertFeatures(plugin, plugin->process(inputBuffers, rt)); +00698 } +00699 +00700 VampFeatureList * +00701 PluginAdapterBase::Impl::getRemainingFeatures(Plugin *plugin) +00702 { +00703 // std::cerr << "PluginAdapterBase::Impl::getRemainingFeatures" << std::endl; +00704 checkOutputMap(plugin); +00705 return convertFeatures(plugin, plugin->getRemainingFeatures()); +00706 } +00707 +00708 VampFeatureList * +00709 PluginAdapterBase::Impl::convertFeatures(Plugin *plugin, +00710 const Plugin::FeatureSet &features) +00711 { +00712 int lastN = -1; +00713 +00714 int outputCount = 0; +00715 if (m_pluginOutputs[plugin]) outputCount = m_pluginOutputs[plugin]->size(); +00716 +00717 resizeFS(plugin, outputCount); +00718 VampFeatureList *fs = m_fs[plugin]; +00719 +00720 for (Plugin::FeatureSet::const_iterator fi = features.begin(); +00721 fi != features.end(); ++fi) { +00722 +00723 int n = fi->first; +00724 +00725 // std::cerr << "PluginAdapterBase::Impl::convertFeatures: n = " << n << std::endl; +00726 +00727 if (n >= int(outputCount)) { +00728 std::cerr << "WARNING: PluginAdapterBase::Impl::convertFeatures: Too many outputs from plugin (" << n+1 << ", only should be " << outputCount << ")" << std::endl; +00729 continue; +00730 } +00731 +00732 if (n > lastN + 1) { +00733 for (int i = lastN + 1; i < n; ++i) { +00734 fs[i].featureCount = 0; +00735 } +00736 } +00737 +00738 const Plugin::FeatureList &fl = fi->second; +00739 +00740 size_t sz = fl.size(); +00741 if (sz > m_fsizes[plugin][n]) resizeFL(plugin, n, sz); +00742 fs[n].featureCount = sz; +00743 +00744 for (size_t j = 0; j < sz; ++j) { +00745 +00746 // std::cerr << "PluginAdapterBase::Impl::convertFeatures: j = " << j << std::endl; +00747 +00748 VampFeature *feature = &fs[n].features[j]; +00749 +00750 feature->hasTimestamp = fl[j].hasTimestamp; +00751 feature->sec = fl[j].timestamp.sec; +00752 feature->nsec = fl[j].timestamp.nsec; +00753 feature->valueCount = fl[j].values.size(); +00754 +00755 if (feature->label) free(feature->label); +00756 +00757 if (fl[j].label.empty()) { +00758 feature->label = 0; +00759 } else { +00760 feature->label = strdup(fl[j].label.c_str()); +00761 } +00762 +00763 if (feature->valueCount > m_fvsizes[plugin][n][j]) { +00764 resizeFV(plugin, n, j, feature->valueCount); +00765 } +00766 +00767 for (unsigned int k = 0; k < feature->valueCount; ++k) { +00768 // std::cerr << "PluginAdapterBase::Impl::convertFeatures: k = " << k << std::endl; +00769 feature->values[k] = fl[j].values[k]; +00770 } +00771 } +00772 +00773 lastN = n; +00774 } +00775 +00776 if (lastN == -1) return 0; +00777 +00778 if (int(outputCount) > lastN + 1) { +00779 for (int i = lastN + 1; i < int(outputCount); ++i) { +00780 fs[i].featureCount = 0; +00781 } +00782 } +00783 +00784 return fs; +00785 } +00786 +00787 void +00788 PluginAdapterBase::Impl::resizeFS(Plugin *plugin, int n) +00789 { +00790 // std::cerr << "PluginAdapterBase::Impl::resizeFS(" << plugin << ", " << n << ")" << std::endl; +00791 +00792 int i = m_fsizes[plugin].size(); +00793 if (i >= n) return; +00794 +00795 // std::cerr << "resizing from " << i << std::endl; +00796 +00797 m_fs[plugin] = (VampFeatureList *)realloc +00798 (m_fs[plugin], n * sizeof(VampFeatureList)); +00799 +00800 while (i < n) { +00801 m_fs[plugin][i].featureCount = 0; +00802 m_fs[plugin][i].features = 0; +00803 m_fsizes[plugin].push_back(0); +00804 m_fvsizes[plugin].push_back(std::vector<size_t>()); +00805 i++; +00806 } +00807 } +00808 +00809 void +00810 PluginAdapterBase::Impl::resizeFL(Plugin *plugin, int n, size_t sz) +00811 { +00812 // std::cerr << "PluginAdapterBase::Impl::resizeFL(" << plugin << ", " << n << ", " +00813 // << sz << ")" << std::endl; +00814 +00815 size_t i = m_fsizes[plugin][n]; +00816 if (i >= sz) return; +00817 +00818 // std::cerr << "resizing from " << i << std::endl; +00819 +00820 m_fs[plugin][n].features = (VampFeature *)realloc +00821 (m_fs[plugin][n].features, sz * sizeof(VampFeature)); +00822 +00823 while (m_fsizes[plugin][n] < sz) { +00824 m_fs[plugin][n].features[m_fsizes[plugin][n]].valueCount = 0; +00825 m_fs[plugin][n].features[m_fsizes[plugin][n]].values = 0; +00826 m_fs[plugin][n].features[m_fsizes[plugin][n]].label = 0; +00827 m_fvsizes[plugin][n].push_back(0); +00828 m_fsizes[plugin][n]++; +00829 } +00830 } +00831 +00832 void +00833 PluginAdapterBase::Impl::resizeFV(Plugin *plugin, int n, int j, size_t sz) +00834 { +00835 // std::cerr << "PluginAdapterBase::Impl::resizeFV(" << plugin << ", " << n << ", " +00836 // << j << ", " << sz << ")" << std::endl; +00837 +00838 size_t i = m_fvsizes[plugin][n][j]; +00839 if (i >= sz) return; +00840 +00841 // std::cerr << "resizing from " << i << std::endl; +00842 +00843 m_fs[plugin][n].features[j].values = (float *)realloc +00844 (m_fs[plugin][n].features[j].values, sz * sizeof(float)); +00845 +00846 m_fvsizes[plugin][n][j] = sz; +00847 } +00848 +00849 PluginAdapterBase::Impl::AdapterMap * +00850 PluginAdapterBase::Impl::m_adapterMap = 0; +00851 +00852 } +00853 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
Classes | |
class | Vamp::PluginAdapterBase::Impl |
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 <vamp/vamp.h> +00041 +00042 #include "Plugin.h" +00043 +00044 #include <map> +00045 +00046 namespace Vamp { +00047 +00063 class PluginAdapterBase +00064 { +00065 public: +00066 virtual ~PluginAdapterBase(); +00067 +00072 const VampPluginDescriptor *getDescriptor(); +00073 +00074 protected: +00075 PluginAdapterBase(); +00076 +00077 virtual Plugin *createPlugin(float inputSampleRate) = 0; +00078 +00079 class Impl; +00080 Impl *m_impl; +00081 }; +00082 +00092 template <typename P> +00093 class PluginAdapter : public PluginAdapterBase +00094 { +00095 public: +00096 PluginAdapter() : PluginAdapterBase() { } +00097 virtual ~PluginAdapter() { } +00098 +00099 protected: +00100 Plugin *createPlugin(float inputSampleRate) { +00101 P *p = new P(inputSampleRate); +00102 Plugin *plugin = dynamic_cast<Plugin *>(p); +00103 if (!plugin) { +00104 std::cerr << "ERROR: PluginAdapter::createPlugin: " +00105 << "Template type is not a plugin!" +00106 << std::endl; +00107 delete p; +00108 return 0; +00109 } +00110 return plugin; +00111 } +00112 }; +00113 +00114 } +00115 +00116 #endif +00117 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
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... |
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_BASE_H_ +00038 #define _VAMP_PLUGIN_BASE_H_ +00039 +00040 #include <string> +00041 #include <vector> +00042 +00043 #define VAMP_SDK_VERSION "1.2" +00044 +00045 namespace Vamp { +00046 +00059 class PluginBase +00060 { +00061 public: +00062 virtual ~PluginBase() { } +00063 +00067 virtual unsigned int getVampApiVersion() const { return 1; } +00068 +00082 virtual std::string getIdentifier() const = 0; +00083 +00092 virtual std::string getName() const = 0; +00093 +00102 virtual std::string getDescription() const = 0; +00103 +00110 virtual std::string getMaker() const = 0; +00111 +00117 virtual std::string getCopyright() const = 0; +00118 +00122 virtual int getPluginVersion() const = 0; +00123 +00124 +00125 struct ParameterDescriptor +00126 { +00132 std::string identifier; +00133 +00137 std::string name; +00138 +00143 std::string description; +00144 +00148 std::string unit; +00149 +00153 float minValue; +00154 +00158 float maxValue; +00159 +00166 float defaultValue; +00167 +00172 bool isQuantized; +00173 +00179 float quantizeStep; +00180 +00192 std::vector<std::string> valueNames; +00193 }; +00194 +00195 typedef std::vector<ParameterDescriptor> ParameterList; +00196 +00200 virtual ParameterList getParameterDescriptors() const { +00201 return ParameterList(); +00202 } +00203 +00208 virtual float getParameter(std::string) const { return 0.0; } +00209 +00214 virtual void setParameter(std::string, float) { } +00215 +00216 +00217 typedef std::vector<std::string> ProgramList; +00218 +00229 virtual ProgramList getPrograms() const { return ProgramList(); } +00230 +00234 virtual std::string getCurrentProgram() const { return ""; } +00235 +00240 virtual void selectProgram(std::string) { } +00241 +00247 virtual std::string getType() const = 0; +00248 }; +00249 +00250 } +00251 +00252 #endif +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
Classes | |
class | Vamp::PluginBase |
A base class for plugins with optional configurable parameters, programs, etc. More... | |
struct | Vamp::PluginBase::ParameterDescriptor |
Defines | |
#define | VAMP_SDK_VERSION "1.2" |
#define VAMP_SDK_VERSION "1.2" | +
+
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-2007 Chris Cannam and QMUL. +00010 This file by Mark Levy and Chris Cannam. +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 #include <vector> +00039 #include <map> +00040 +00041 #include "PluginBufferingAdapter.h" +00042 +00043 using std::vector; +00044 using std::map; +00045 +00046 namespace Vamp { +00047 +00048 namespace HostExt { +00049 +00050 class PluginBufferingAdapter::Impl +00051 { +00052 public: +00053 Impl(Plugin *plugin, float inputSampleRate); +00054 ~Impl(); +00055 +00056 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00057 +00058 OutputList getOutputDescriptors() const; +00059 +00060 void reset(); +00061 +00062 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00063 +00064 FeatureSet getRemainingFeatures(); +00065 +00066 protected: +00067 class RingBuffer +00068 { +00069 public: +00070 RingBuffer(int n) : +00071 m_buffer(new float[n+1]), m_writer(0), m_reader(0), m_size(n+1) { } +00072 virtual ~RingBuffer() { delete[] m_buffer; } +00073 +00074 int getSize() const { return m_size-1; } +00075 void reset() { m_writer = 0; m_reader = 0; } +00076 +00077 int getReadSpace() const { +00078 int writer = m_writer, reader = m_reader, space; +00079 if (writer > reader) space = writer - reader; +00080 else if (writer < reader) space = (writer + m_size) - reader; +00081 else space = 0; +00082 return space; +00083 } +00084 +00085 int getWriteSpace() const { +00086 int writer = m_writer; +00087 int reader = m_reader; +00088 int space = (reader + m_size - writer - 1); +00089 if (space >= m_size) space -= m_size; +00090 return space; +00091 } +00092 +00093 int peek(float *destination, int n) const { +00094 +00095 int available = getReadSpace(); +00096 +00097 if (n > available) { +00098 for (int i = available; i < n; ++i) { +00099 destination[i] = 0.f; +00100 } +00101 n = available; +00102 } +00103 if (n == 0) return n; +00104 +00105 int reader = m_reader; +00106 int here = m_size - reader; +00107 const float *const bufbase = m_buffer + reader; +00108 +00109 if (here >= n) { +00110 for (int i = 0; i < n; ++i) { +00111 destination[i] = bufbase[i]; +00112 } +00113 } else { +00114 for (int i = 0; i < here; ++i) { +00115 destination[i] = bufbase[i]; +00116 } +00117 float *const destbase = destination + here; +00118 const int nh = n - here; +00119 for (int i = 0; i < nh; ++i) { +00120 destbase[i] = m_buffer[i]; +00121 } +00122 } +00123 +00124 return n; +00125 } +00126 +00127 int skip(int n) { +00128 +00129 int available = getReadSpace(); +00130 if (n > available) { +00131 n = available; +00132 } +00133 if (n == 0) return n; +00134 +00135 int reader = m_reader; +00136 reader += n; +00137 while (reader >= m_size) reader -= m_size; +00138 m_reader = reader; +00139 return n; +00140 } +00141 +00142 int write(const float *source, int n) { +00143 +00144 int available = getWriteSpace(); +00145 if (n > available) { +00146 n = available; +00147 } +00148 if (n == 0) return n; +00149 +00150 int writer = m_writer; +00151 int here = m_size - writer; +00152 float *const bufbase = m_buffer + writer; +00153 +00154 if (here >= n) { +00155 for (int i = 0; i < n; ++i) { +00156 bufbase[i] = source[i]; +00157 } +00158 } else { +00159 for (int i = 0; i < here; ++i) { +00160 bufbase[i] = source[i]; +00161 } +00162 const int nh = n - here; +00163 const float *const srcbase = source + here; +00164 float *const buf = m_buffer; +00165 for (int i = 0; i < nh; ++i) { +00166 buf[i] = srcbase[i]; +00167 } +00168 } +00169 +00170 writer += n; +00171 while (writer >= m_size) writer -= m_size; +00172 m_writer = writer; +00173 +00174 return n; +00175 } +00176 +00177 int zero(int n) { +00178 +00179 int available = getWriteSpace(); +00180 if (n > available) { +00181 n = available; +00182 } +00183 if (n == 0) return n; +00184 +00185 int writer = m_writer; +00186 int here = m_size - writer; +00187 float *const bufbase = m_buffer + writer; +00188 +00189 if (here >= n) { +00190 for (int i = 0; i < n; ++i) { +00191 bufbase[i] = 0.f; +00192 } +00193 } else { +00194 for (int i = 0; i < here; ++i) { +00195 bufbase[i] = 0.f; +00196 } +00197 const int nh = n - here; +00198 for (int i = 0; i < nh; ++i) { +00199 m_buffer[i] = 0.f; +00200 } +00201 } +00202 +00203 writer += n; +00204 while (writer >= m_size) writer -= m_size; +00205 m_writer = writer; +00206 +00207 return n; +00208 } +00209 +00210 protected: +00211 float *m_buffer; +00212 int m_writer; +00213 int m_reader; +00214 int m_size; +00215 +00216 private: +00217 RingBuffer(const RingBuffer &); // not provided +00218 RingBuffer &operator=(const RingBuffer &); // not provided +00219 }; +00220 +00221 Plugin *m_plugin; +00222 size_t m_inputStepSize; +00223 size_t m_inputBlockSize; +00224 size_t m_stepSize; +00225 size_t m_blockSize; +00226 size_t m_channels; +00227 vector<RingBuffer *> m_queue; +00228 float **m_buffers; +00229 float m_inputSampleRate; +00230 long m_frame; +00231 bool m_unrun; +00232 mutable OutputList m_outputs; +00233 mutable std::map<int, bool> m_rewriteOutputTimes; +00234 +00235 void processBlock(FeatureSet& allFeatureSets); +00236 }; +00237 +00238 PluginBufferingAdapter::PluginBufferingAdapter(Plugin *plugin) : +00239 PluginWrapper(plugin) +00240 { +00241 m_impl = new Impl(plugin, m_inputSampleRate); +00242 } +00243 +00244 PluginBufferingAdapter::~PluginBufferingAdapter() +00245 { +00246 delete m_impl; +00247 } +00248 +00249 bool +00250 PluginBufferingAdapter::initialise(size_t channels, size_t stepSize, size_t blockSize) +00251 { +00252 return m_impl->initialise(channels, stepSize, blockSize); +00253 } +00254 +00255 PluginBufferingAdapter::OutputList +00256 PluginBufferingAdapter::getOutputDescriptors() const +00257 { +00258 return m_impl->getOutputDescriptors(); +00259 } +00260 +00261 void +00262 PluginBufferingAdapter::reset() +00263 { +00264 m_impl->reset(); +00265 } +00266 +00267 PluginBufferingAdapter::FeatureSet +00268 PluginBufferingAdapter::process(const float *const *inputBuffers, +00269 RealTime timestamp) +00270 { +00271 return m_impl->process(inputBuffers, timestamp); +00272 } +00273 +00274 PluginBufferingAdapter::FeatureSet +00275 PluginBufferingAdapter::getRemainingFeatures() +00276 { +00277 return m_impl->getRemainingFeatures(); +00278 } +00279 +00280 PluginBufferingAdapter::Impl::Impl(Plugin *plugin, float inputSampleRate) : +00281 m_plugin(plugin), +00282 m_inputStepSize(0), +00283 m_inputBlockSize(0), +00284 m_stepSize(0), +00285 m_blockSize(0), +00286 m_channels(0), +00287 m_queue(0), +00288 m_buffers(0), +00289 m_inputSampleRate(inputSampleRate), +00290 m_frame(0), +00291 m_unrun(true) +00292 { +00293 (void)getOutputDescriptors(); // set up m_outputs and m_rewriteOutputTimes +00294 } +00295 +00296 PluginBufferingAdapter::Impl::~Impl() +00297 { +00298 // the adapter will delete the plugin +00299 +00300 for (size_t i = 0; i < m_channels; ++i) { +00301 delete m_queue[i]; +00302 delete[] m_buffers[i]; +00303 } +00304 delete[] m_buffers; +00305 } +00306 +00307 size_t +00308 PluginBufferingAdapter::getPreferredStepSize() const +00309 { +00310 return getPreferredBlockSize(); +00311 } +00312 +00313 bool +00314 PluginBufferingAdapter::Impl::initialise(size_t channels, size_t stepSize, size_t blockSize) +00315 { +00316 if (stepSize != blockSize) { +00317 std::cerr << "PluginBufferingAdapter::initialise: input stepSize must be equal to blockSize for this adapter (stepSize = " << stepSize << ", blockSize = " << blockSize << ")" << std::endl; +00318 return false; +00319 } +00320 +00321 m_channels = channels; +00322 m_inputStepSize = stepSize; +00323 m_inputBlockSize = blockSize; +00324 +00325 // use the step and block sizes which the plugin prefers +00326 m_stepSize = m_plugin->getPreferredStepSize(); +00327 m_blockSize = m_plugin->getPreferredBlockSize(); +00328 +00329 // or sensible defaults if it has no preference +00330 if (m_blockSize == 0) { +00331 m_blockSize = 1024; +00332 } +00333 if (m_stepSize == 0) { +00334 if (m_plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain) { +00335 m_stepSize = m_blockSize/2; +00336 } else { +00337 m_stepSize = m_blockSize; +00338 } +00339 } else if (m_stepSize > m_blockSize) { +00340 if (m_plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain) { +00341 m_blockSize = m_stepSize * 2; +00342 } else { +00343 m_blockSize = m_stepSize; +00344 } +00345 } +00346 +00347 std::cerr << "PluginBufferingAdapter::initialise: stepSize " << m_inputStepSize << " -> " << m_stepSize +00348 << ", blockSize " << m_inputBlockSize << " -> " << m_blockSize << std::endl; +00349 +00350 // current implementation breaks if step is greater than block +00351 if (m_stepSize > m_blockSize) { +00352 std::cerr << "PluginBufferingAdapter::initialise: plugin's preferred stepSize greater than blockSize, giving up!" << std::endl; +00353 return false; +00354 } +00355 +00356 m_buffers = new float *[m_channels]; +00357 +00358 for (size_t i = 0; i < m_channels; ++i) { +00359 m_queue.push_back(new RingBuffer(m_blockSize + m_inputBlockSize)); +00360 m_buffers[i] = new float[m_blockSize]; +00361 } +00362 +00363 return m_plugin->initialise(m_channels, m_stepSize, m_blockSize); +00364 } +00365 +00366 PluginBufferingAdapter::OutputList +00367 PluginBufferingAdapter::Impl::getOutputDescriptors() const +00368 { +00369 if (m_outputs.empty()) { +00370 m_outputs = m_plugin->getOutputDescriptors(); +00371 } +00372 +00373 PluginBufferingAdapter::OutputList outs = m_outputs; +00374 +00375 for (size_t i = 0; i < outs.size(); ++i) { +00376 +00377 switch (outs[i].sampleType) { +00378 +00379 case OutputDescriptor::OneSamplePerStep: +00380 outs[i].sampleType = OutputDescriptor::FixedSampleRate; +00381 outs[i].sampleRate = (1.f / m_inputSampleRate) * m_stepSize; +00382 m_rewriteOutputTimes[i] = true; +00383 break; +00384 +00385 case OutputDescriptor::FixedSampleRate: +00386 if (outs[i].sampleRate == 0.f) { +00387 outs[i].sampleRate = (1.f / m_inputSampleRate) * m_stepSize; +00388 } +00389 // We actually only need to rewrite output times for +00390 // features that don't have timestamps already, but we +00391 // can't tell from here whether our features will have +00392 // timestamps or not +00393 m_rewriteOutputTimes[i] = true; +00394 break; +00395 +00396 case OutputDescriptor::VariableSampleRate: +00397 m_rewriteOutputTimes[i] = false; +00398 break; +00399 } +00400 } +00401 +00402 return outs; +00403 } +00404 +00405 void +00406 PluginBufferingAdapter::Impl::reset() +00407 { +00408 m_frame = 0; +00409 m_unrun = true; +00410 +00411 for (size_t i = 0; i < m_queue.size(); ++i) { +00412 m_queue[i]->reset(); +00413 } +00414 } +00415 +00416 PluginBufferingAdapter::FeatureSet +00417 PluginBufferingAdapter::Impl::process(const float *const *inputBuffers, +00418 RealTime timestamp) +00419 { +00420 FeatureSet allFeatureSets; +00421 +00422 if (m_unrun) { +00423 m_frame = RealTime::realTime2Frame(timestamp, +00424 int(m_inputSampleRate + 0.5)); +00425 m_unrun = false; +00426 } +00427 +00428 // queue the new input +00429 +00430 for (size_t i = 0; i < m_channels; ++i) { +00431 int written = m_queue[i]->write(inputBuffers[i], m_inputBlockSize); +00432 if (written < int(m_inputBlockSize) && i == 0) { +00433 std::cerr << "WARNING: PluginBufferingAdapter::Impl::process: " +00434 << "Buffer overflow: wrote " << written +00435 << " of " << m_inputBlockSize +00436 << " input samples (for plugin step size " +00437 << m_stepSize << ", block size " << m_blockSize << ")" +00438 << std::endl; +00439 } +00440 } +00441 +00442 // process as much as we can +00443 +00444 while (m_queue[0]->getReadSpace() >= int(m_blockSize)) { +00445 processBlock(allFeatureSets); +00446 } +00447 +00448 return allFeatureSets; +00449 } +00450 +00451 PluginBufferingAdapter::FeatureSet +00452 PluginBufferingAdapter::Impl::getRemainingFeatures() +00453 { +00454 FeatureSet allFeatureSets; +00455 +00456 // process remaining samples in queue +00457 while (m_queue[0]->getReadSpace() >= int(m_blockSize)) { +00458 processBlock(allFeatureSets); +00459 } +00460 +00461 // pad any last samples remaining and process +00462 if (m_queue[0]->getReadSpace() > 0) { +00463 for (size_t i = 0; i < m_channels; ++i) { +00464 m_queue[i]->zero(m_blockSize - m_queue[i]->getReadSpace()); +00465 } +00466 processBlock(allFeatureSets); +00467 } +00468 +00469 // get remaining features +00470 +00471 FeatureSet featureSet = m_plugin->getRemainingFeatures(); +00472 +00473 for (map<int, FeatureList>::iterator iter = featureSet.begin(); +00474 iter != featureSet.end(); ++iter) { +00475 FeatureList featureList = iter->second; +00476 for (size_t i = 0; i < featureList.size(); ++i) { +00477 allFeatureSets[iter->first].push_back(featureList[i]); +00478 } +00479 } +00480 +00481 return allFeatureSets; +00482 } +00483 +00484 void +00485 PluginBufferingAdapter::Impl::processBlock(FeatureSet& allFeatureSets) +00486 { +00487 for (size_t i = 0; i < m_channels; ++i) { +00488 m_queue[i]->peek(m_buffers[i], m_blockSize); +00489 } +00490 +00491 long frame = m_frame; +00492 RealTime timestamp = RealTime::frame2RealTime +00493 (frame, int(m_inputSampleRate + 0.5)); +00494 +00495 FeatureSet featureSet = m_plugin->process(m_buffers, timestamp); +00496 +00497 for (FeatureSet::iterator iter = featureSet.begin(); +00498 iter != featureSet.end(); ++iter) { +00499 +00500 int outputNo = iter->first; +00501 +00502 if (m_rewriteOutputTimes[outputNo]) { +00503 +00504 FeatureList featureList = iter->second; +00505 +00506 for (size_t i = 0; i < featureList.size(); ++i) { +00507 +00508 switch (m_outputs[outputNo].sampleType) { +00509 +00510 case OutputDescriptor::OneSamplePerStep: +00511 // use our internal timestamp, always +00512 featureList[i].timestamp = timestamp; +00513 featureList[i].hasTimestamp = true; +00514 break; +00515 +00516 case OutputDescriptor::FixedSampleRate: +00517 // use our internal timestamp if feature lacks one +00518 if (!featureList[i].hasTimestamp) { +00519 featureList[i].timestamp = timestamp; +00520 featureList[i].hasTimestamp = true; +00521 } +00522 break; +00523 +00524 case OutputDescriptor::VariableSampleRate: +00525 break; // plugin must set timestamp +00526 +00527 default: +00528 break; +00529 } +00530 +00531 allFeatureSets[outputNo].push_back(featureList[i]); +00532 } +00533 } else { +00534 for (size_t i = 0; i < iter->second.size(); ++i) { +00535 allFeatureSets[outputNo].push_back(iter->second[i]); +00536 } +00537 } +00538 } +00539 +00540 // step forward +00541 +00542 for (size_t i = 0; i < m_channels; ++i) { +00543 m_queue[i]->skip(m_stepSize); +00544 } +00545 +00546 // increment internal frame counter each time we step forward +00547 m_frame += m_stepSize; +00548 } +00549 +00550 } +00551 +00552 } +00553 +00554 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
Classes | |
class | Vamp::HostExt::PluginBufferingAdapter::Impl |
class | Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer |
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-2007 Chris Cannam and QMUL. +00010 This file by Mark Levy, Copyright 2007 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 "PluginWrapper.h" +00042 +00043 namespace Vamp { +00044 +00045 namespace HostExt { +00046 +00072 class PluginBufferingAdapter : public PluginWrapper +00073 { +00074 public: +00075 PluginBufferingAdapter(Plugin *plugin); // I take ownership of plugin +00076 virtual ~PluginBufferingAdapter(); +00077 +00078 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00079 +00080 size_t getPreferredStepSize() const; +00081 +00082 OutputList getOutputDescriptors() const; +00083 +00084 void reset(); +00085 +00086 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00087 +00088 FeatureSet getRemainingFeatures(); +00089 +00090 protected: +00091 class Impl; +00092 Impl *m_impl; +00093 }; +00094 +00095 } +00096 +00097 } +00098 +00099 #endif +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
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... |
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-2007 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 "PluginChannelAdapter.h" +00038 +00039 namespace Vamp { +00040 +00041 namespace HostExt { +00042 +00043 class PluginChannelAdapter::Impl +00044 { +00045 public: +00046 Impl(Plugin *plugin); +00047 ~Impl(); +00048 +00049 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00050 +00051 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00052 +00053 protected: +00054 Plugin *m_plugin; +00055 size_t m_blockSize; +00056 size_t m_inputChannels; +00057 size_t m_pluginChannels; +00058 float **m_buffer; +00059 const float **m_forwardPtrs; +00060 }; +00061 +00062 PluginChannelAdapter::PluginChannelAdapter(Plugin *plugin) : +00063 PluginWrapper(plugin) +00064 { +00065 m_impl = new Impl(plugin); +00066 } +00067 +00068 PluginChannelAdapter::~PluginChannelAdapter() +00069 { +00070 delete m_impl; +00071 } +00072 +00073 bool +00074 PluginChannelAdapter::initialise(size_t channels, size_t stepSize, size_t blockSize) +00075 { +00076 return m_impl->initialise(channels, stepSize, blockSize); +00077 } +00078 +00079 PluginChannelAdapter::FeatureSet +00080 PluginChannelAdapter::process(const float *const *inputBuffers, +00081 RealTime timestamp) +00082 { +00083 return m_impl->process(inputBuffers, timestamp); +00084 } +00085 +00086 PluginChannelAdapter::Impl::Impl(Plugin *plugin) : +00087 m_plugin(plugin), +00088 m_blockSize(0), +00089 m_inputChannels(0), +00090 m_pluginChannels(0), +00091 m_buffer(0), +00092 m_forwardPtrs(0) +00093 { +00094 } +00095 +00096 PluginChannelAdapter::Impl::~Impl() +00097 { +00098 // the adapter will delete the plugin +00099 +00100 if (m_buffer) { +00101 if (m_inputChannels > m_pluginChannels) { +00102 delete[] m_buffer[0]; +00103 } else { +00104 for (size_t i = 0; i < m_pluginChannels - m_inputChannels; ++i) { +00105 delete[] m_buffer[i]; +00106 } +00107 } +00108 delete[] m_buffer; +00109 m_buffer = 0; +00110 } +00111 +00112 if (m_forwardPtrs) { +00113 delete[] m_forwardPtrs; +00114 m_forwardPtrs = 0; +00115 } +00116 } +00117 +00118 bool +00119 PluginChannelAdapter::Impl::initialise(size_t channels, size_t stepSize, size_t blockSize) +00120 { +00121 m_blockSize = blockSize; +00122 +00123 size_t minch = m_plugin->getMinChannelCount(); +00124 size_t maxch = m_plugin->getMaxChannelCount(); +00125 +00126 m_inputChannels = channels; +00127 +00128 if (m_inputChannels < minch) { +00129 +00130 m_forwardPtrs = new const float *[minch]; +00131 +00132 if (m_inputChannels > 1) { +00133 // We need a set of zero-valued buffers to add to the +00134 // forwarded pointers +00135 m_buffer = new float*[minch - channels]; +00136 for (size_t i = 0; i < minch; ++i) { +00137 m_buffer[i] = new float[blockSize]; +00138 for (size_t j = 0; j < blockSize; ++j) { +00139 m_buffer[i][j] = 0.f; +00140 } +00141 } +00142 } +00143 +00144 m_pluginChannels = minch; +00145 +00146 std::cerr << "PluginChannelAdapter::initialise: expanding " << m_inputChannels << " to " << m_pluginChannels << " for plugin" << std::endl; +00147 +00148 } else if (m_inputChannels > maxch) { +00149 +00150 // We only need m_buffer if we are mixing down to a single +00151 // channel -- otherwise we can just forward the same float* as +00152 // passed in to process(), expecting the excess to be ignored +00153 +00154 if (maxch == 1) { +00155 m_buffer = new float *[1]; +00156 m_buffer[0] = new float[blockSize]; +00157 +00158 std::cerr << "PluginChannelAdapter::initialise: mixing " << m_inputChannels << " to mono for plugin" << std::endl; +00159 +00160 } else { +00161 +00162 std::cerr << "PluginChannelAdapter::initialise: reducing " << m_inputChannels << " to " << m_pluginChannels << " for plugin" << std::endl; +00163 } +00164 +00165 m_pluginChannels = maxch; +00166 +00167 } else { +00168 +00169 std::cerr << "PluginChannelAdapter::initialise: accepting given number of channels (" << m_inputChannels << ")" << std::endl; +00170 m_pluginChannels = m_inputChannels; +00171 } +00172 +00173 return m_plugin->initialise(m_pluginChannels, stepSize, blockSize); +00174 } +00175 +00176 PluginChannelAdapter::FeatureSet +00177 PluginChannelAdapter::Impl::process(const float *const *inputBuffers, +00178 RealTime timestamp) +00179 { +00180 // std::cerr << "PluginChannelAdapter::process: " << m_inputChannels << " -> " << m_pluginChannels << " channels" << std::endl; +00181 +00182 if (m_inputChannels < m_pluginChannels) { +00183 +00184 if (m_inputChannels == 1) { +00185 for (size_t i = 0; i < m_pluginChannels; ++i) { +00186 m_forwardPtrs[i] = inputBuffers[0]; +00187 } +00188 } else { +00189 for (size_t i = 0; i < m_inputChannels; ++i) { +00190 m_forwardPtrs[i] = inputBuffers[i]; +00191 } +00192 for (size_t i = m_inputChannels; i < m_pluginChannels; ++i) { +00193 m_forwardPtrs[i] = m_buffer[i - m_inputChannels]; +00194 } +00195 } +00196 +00197 return m_plugin->process(m_forwardPtrs, timestamp); +00198 +00199 } else if (m_inputChannels > m_pluginChannels) { +00200 +00201 if (m_pluginChannels == 1) { +00202 for (size_t j = 0; j < m_blockSize; ++j) { +00203 m_buffer[0][j] = inputBuffers[0][j]; +00204 } +00205 for (size_t i = 1; i < m_inputChannels; ++i) { +00206 for (size_t j = 0; j < m_blockSize; ++j) { +00207 m_buffer[0][j] += inputBuffers[i][j]; +00208 } +00209 } +00210 for (size_t j = 0; j < m_blockSize; ++j) { +00211 m_buffer[0][j] /= m_inputChannels; +00212 } +00213 return m_plugin->process(m_buffer, timestamp); +00214 } else { +00215 return m_plugin->process(inputBuffers, timestamp); +00216 } +00217 +00218 } else { +00219 +00220 return m_plugin->process(inputBuffers, timestamp); +00221 } +00222 } +00223 +00224 } +00225 +00226 } +00227 +00228 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
Classes | |
class | Vamp::HostExt::PluginChannelAdapter::Impl |
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-2007 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 "PluginWrapper.h" +00041 +00042 namespace Vamp { +00043 +00044 namespace HostExt { +00045 +00109 class PluginChannelAdapter : public PluginWrapper +00110 { +00111 public: +00112 PluginChannelAdapter(Plugin *plugin); // I take ownership of plugin +00113 virtual ~PluginChannelAdapter(); +00114 +00115 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00116 +00117 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00118 +00119 protected: +00120 class Impl; +00121 Impl *m_impl; +00122 }; +00123 +00124 } +00125 +00126 } +00127 +00128 #endif +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
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... |
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 "PluginHostAdapter.h" +00038 #include <cstdlib> +00039 +00040 namespace Vamp +00041 { +00042 +00043 PluginHostAdapter::PluginHostAdapter(const VampPluginDescriptor *descriptor, +00044 float inputSampleRate) : +00045 Plugin(inputSampleRate), +00046 m_descriptor(descriptor) +00047 { +00048 // std::cerr << "PluginHostAdapter::PluginHostAdapter (plugin = " << descriptor->name << ")" << std::endl; +00049 m_handle = m_descriptor->instantiate(m_descriptor, inputSampleRate); +00050 if (!m_handle) { +00051 // std::cerr << "WARNING: PluginHostAdapter: Plugin instantiation failed for plugin " << m_descriptor->name << std::endl; +00052 } +00053 } +00054 +00055 PluginHostAdapter::~PluginHostAdapter() +00056 { +00057 // std::cerr << "PluginHostAdapter::~PluginHostAdapter (plugin = " << m_descriptor->name << ")" << std::endl; +00058 if (m_handle) m_descriptor->cleanup(m_handle); +00059 } +00060 +00061 std::vector<std::string> +00062 PluginHostAdapter::getPluginPath() +00063 { +00064 std::vector<std::string> path; +00065 std::string envPath; +00066 +00067 char *cpath = getenv("VAMP_PATH"); +00068 if (cpath) envPath = cpath; +00069 +00070 #ifdef _WIN32 +00071 #define PATH_SEPARATOR ';' +00072 #define DEFAULT_VAMP_PATH "%ProgramFiles%\\Vamp Plugins" +00073 #else +00074 #define PATH_SEPARATOR ':' +00075 #ifdef __APPLE__ +00076 #define DEFAULT_VAMP_PATH "$HOME/Library/Audio/Plug-Ins/Vamp:/Library/Audio/Plug-Ins/Vamp" +00077 #else +00078 #define DEFAULT_VAMP_PATH "$HOME/vamp:$HOME/.vamp:/usr/local/lib/vamp:/usr/lib/vamp" +00079 #endif +00080 #endif +00081 +00082 if (envPath == "") { +00083 envPath = DEFAULT_VAMP_PATH; +00084 char *chome = getenv("HOME"); +00085 if (chome) { +00086 std::string home(chome); +00087 std::string::size_type f; +00088 while ((f = envPath.find("$HOME")) != std::string::npos && +00089 f < envPath.length()) { +00090 envPath.replace(f, 5, home); +00091 } +00092 } +00093 #ifdef _WIN32 +00094 char *cpfiles = getenv("ProgramFiles"); +00095 if (!cpfiles) cpfiles = "C:\\Program Files"; +00096 std::string pfiles(cpfiles); +00097 std::string::size_type f; +00098 while ((f = envPath.find("%ProgramFiles%")) != std::string::npos && +00099 f < envPath.length()) { +00100 envPath.replace(f, 14, pfiles); +00101 } +00102 #endif +00103 } +00104 +00105 std::string::size_type index = 0, newindex = 0; +00106 +00107 while ((newindex = envPath.find(PATH_SEPARATOR, index)) < envPath.size()) { +00108 path.push_back(envPath.substr(index, newindex - index)); +00109 index = newindex + 1; +00110 } +00111 +00112 path.push_back(envPath.substr(index)); +00113 +00114 return path; +00115 } +00116 +00117 bool +00118 PluginHostAdapter::initialise(size_t channels, +00119 size_t stepSize, +00120 size_t blockSize) +00121 { +00122 if (!m_handle) return false; +00123 return m_descriptor->initialise(m_handle, channels, stepSize, blockSize) ? +00124 true : false; +00125 } +00126 +00127 void +00128 PluginHostAdapter::reset() +00129 { +00130 if (!m_handle) return; +00131 m_descriptor->reset(m_handle); +00132 } +00133 +00134 PluginHostAdapter::InputDomain +00135 PluginHostAdapter::getInputDomain() const +00136 { +00137 if (m_descriptor->inputDomain == vampFrequencyDomain) { +00138 return FrequencyDomain; +00139 } else { +00140 return TimeDomain; +00141 } +00142 } +00143 +00144 unsigned int +00145 PluginHostAdapter::getVampApiVersion() const +00146 { +00147 return m_descriptor->vampApiVersion; +00148 } +00149 +00150 std::string +00151 PluginHostAdapter::getIdentifier() const +00152 { +00153 return m_descriptor->identifier; +00154 } +00155 +00156 std::string +00157 PluginHostAdapter::getName() const +00158 { +00159 return m_descriptor->name; +00160 } +00161 +00162 std::string +00163 PluginHostAdapter::getDescription() const +00164 { +00165 return m_descriptor->description; +00166 } +00167 +00168 std::string +00169 PluginHostAdapter::getMaker() const +00170 { +00171 return m_descriptor->maker; +00172 } +00173 +00174 int +00175 PluginHostAdapter::getPluginVersion() const +00176 { +00177 return m_descriptor->pluginVersion; +00178 } +00179 +00180 std::string +00181 PluginHostAdapter::getCopyright() const +00182 { +00183 return m_descriptor->copyright; +00184 } +00185 +00186 PluginHostAdapter::ParameterList +00187 PluginHostAdapter::getParameterDescriptors() const +00188 { +00189 ParameterList list; +00190 for (unsigned int i = 0; i < m_descriptor->parameterCount; ++i) { +00191 const VampParameterDescriptor *spd = m_descriptor->parameters[i]; +00192 ParameterDescriptor pd; +00193 pd.identifier = spd->identifier; +00194 pd.name = spd->name; +00195 pd.description = spd->description; +00196 pd.unit = spd->unit; +00197 pd.minValue = spd->minValue; +00198 pd.maxValue = spd->maxValue; +00199 pd.defaultValue = spd->defaultValue; +00200 pd.isQuantized = spd->isQuantized; +00201 pd.quantizeStep = spd->quantizeStep; +00202 if (pd.isQuantized && spd->valueNames) { +00203 for (unsigned int j = 0; spd->valueNames[j]; ++j) { +00204 pd.valueNames.push_back(spd->valueNames[j]); +00205 } +00206 } +00207 list.push_back(pd); +00208 } +00209 return list; +00210 } +00211 +00212 float +00213 PluginHostAdapter::getParameter(std::string param) const +00214 { +00215 if (!m_handle) return 0.0; +00216 +00217 for (unsigned int i = 0; i < m_descriptor->parameterCount; ++i) { +00218 if (param == m_descriptor->parameters[i]->identifier) { +00219 return m_descriptor->getParameter(m_handle, i); +00220 } +00221 } +00222 +00223 return 0.0; +00224 } +00225 +00226 void +00227 PluginHostAdapter::setParameter(std::string param, +00228 float value) +00229 { +00230 if (!m_handle) return; +00231 +00232 for (unsigned int i = 0; i < m_descriptor->parameterCount; ++i) { +00233 if (param == m_descriptor->parameters[i]->identifier) { +00234 m_descriptor->setParameter(m_handle, i, value); +00235 return; +00236 } +00237 } +00238 } +00239 +00240 PluginHostAdapter::ProgramList +00241 PluginHostAdapter::getPrograms() const +00242 { +00243 ProgramList list; +00244 +00245 for (unsigned int i = 0; i < m_descriptor->programCount; ++i) { +00246 list.push_back(m_descriptor->programs[i]); +00247 } +00248 +00249 return list; +00250 } +00251 +00252 std::string +00253 PluginHostAdapter::getCurrentProgram() const +00254 { +00255 if (!m_handle) return ""; +00256 +00257 int pn = m_descriptor->getCurrentProgram(m_handle); +00258 return m_descriptor->programs[pn]; +00259 } +00260 +00261 void +00262 PluginHostAdapter::selectProgram(std::string program) +00263 { +00264 if (!m_handle) return; +00265 +00266 for (unsigned int i = 0; i < m_descriptor->programCount; ++i) { +00267 if (program == m_descriptor->programs[i]) { +00268 m_descriptor->selectProgram(m_handle, i); +00269 return; +00270 } +00271 } +00272 } +00273 +00274 size_t +00275 PluginHostAdapter::getPreferredStepSize() const +00276 { +00277 if (!m_handle) return 0; +00278 return m_descriptor->getPreferredStepSize(m_handle); +00279 } +00280 +00281 size_t +00282 PluginHostAdapter::getPreferredBlockSize() const +00283 { +00284 if (!m_handle) return 0; +00285 return m_descriptor->getPreferredBlockSize(m_handle); +00286 } +00287 +00288 size_t +00289 PluginHostAdapter::getMinChannelCount() const +00290 { +00291 if (!m_handle) return 0; +00292 return m_descriptor->getMinChannelCount(m_handle); +00293 } +00294 +00295 size_t +00296 PluginHostAdapter::getMaxChannelCount() const +00297 { +00298 if (!m_handle) return 0; +00299 return m_descriptor->getMaxChannelCount(m_handle); +00300 } +00301 +00302 PluginHostAdapter::OutputList +00303 PluginHostAdapter::getOutputDescriptors() const +00304 { +00305 OutputList list; +00306 if (!m_handle) { +00307 // std::cerr << "PluginHostAdapter::getOutputDescriptors: no handle " << std::endl; +00308 return list; +00309 } +00310 +00311 unsigned int count = m_descriptor->getOutputCount(m_handle); +00312 +00313 for (unsigned int i = 0; i < count; ++i) { +00314 VampOutputDescriptor *sd = m_descriptor->getOutputDescriptor(m_handle, i); +00315 OutputDescriptor d; +00316 d.identifier = sd->identifier; +00317 d.name = sd->name; +00318 d.description = sd->description; +00319 d.unit = sd->unit; +00320 d.hasFixedBinCount = sd->hasFixedBinCount; +00321 d.binCount = sd->binCount; +00322 if (d.hasFixedBinCount) { +00323 for (unsigned int j = 0; j < sd->binCount; ++j) { +00324 d.binNames.push_back(sd->binNames[j] ? sd->binNames[j] : ""); +00325 } +00326 } +00327 d.hasKnownExtents = sd->hasKnownExtents; +00328 d.minValue = sd->minValue; +00329 d.maxValue = sd->maxValue; +00330 d.isQuantized = sd->isQuantized; +00331 d.quantizeStep = sd->quantizeStep; +00332 +00333 switch (sd->sampleType) { +00334 case vampOneSamplePerStep: +00335 d.sampleType = OutputDescriptor::OneSamplePerStep; break; +00336 case vampFixedSampleRate: +00337 d.sampleType = OutputDescriptor::FixedSampleRate; break; +00338 case vampVariableSampleRate: +00339 d.sampleType = OutputDescriptor::VariableSampleRate; break; +00340 } +00341 +00342 d.sampleRate = sd->sampleRate; +00343 +00344 list.push_back(d); +00345 +00346 m_descriptor->releaseOutputDescriptor(sd); +00347 } +00348 +00349 return list; +00350 } +00351 +00352 PluginHostAdapter::FeatureSet +00353 PluginHostAdapter::process(const float *const *inputBuffers, +00354 RealTime timestamp) +00355 { +00356 FeatureSet fs; +00357 if (!m_handle) return fs; +00358 +00359 int sec = timestamp.sec; +00360 int nsec = timestamp.nsec; +00361 +00362 VampFeatureList *features = m_descriptor->process(m_handle, +00363 inputBuffers, +00364 sec, nsec); +00365 +00366 convertFeatures(features, fs); +00367 m_descriptor->releaseFeatureSet(features); +00368 return fs; +00369 } +00370 +00371 PluginHostAdapter::FeatureSet +00372 PluginHostAdapter::getRemainingFeatures() +00373 { +00374 FeatureSet fs; +00375 if (!m_handle) return fs; +00376 +00377 VampFeatureList *features = m_descriptor->getRemainingFeatures(m_handle); +00378 +00379 convertFeatures(features, fs); +00380 m_descriptor->releaseFeatureSet(features); +00381 return fs; +00382 } +00383 +00384 void +00385 PluginHostAdapter::convertFeatures(VampFeatureList *features, +00386 FeatureSet &fs) +00387 { +00388 if (!features) return; +00389 +00390 unsigned int outputs = m_descriptor->getOutputCount(m_handle); +00391 +00392 for (unsigned int i = 0; i < outputs; ++i) { +00393 +00394 VampFeatureList &list = features[i]; +00395 +00396 if (list.featureCount > 0) { +00397 +00398 Feature feature; +00399 feature.values.reserve(list.features[0].valueCount); +00400 +00401 for (unsigned int j = 0; j < list.featureCount; ++j) { +00402 +00403 feature.hasTimestamp = list.features[j].hasTimestamp; +00404 feature.timestamp = RealTime(list.features[j].sec, +00405 list.features[j].nsec); +00406 +00407 for (unsigned int k = 0; k < list.features[j].valueCount; ++k) { +00408 feature.values.push_back(list.features[j].values[k]); +00409 } +00410 +00411 if (list.features[j].label) { +00412 feature.label = list.features[j].label; +00413 } +00414 +00415 fs[i].push_back(feature); +00416 +00417 if (list.features[j].valueCount > 0) { +00418 feature.values.clear(); +00419 } +00420 +00421 if (list.features[j].label) { +00422 feature.label = ""; +00423 } +00424 } +00425 } +00426 } +00427 } +00428 +00429 } +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
Defines | |
#define | PATH_SEPARATOR ':' |
#define | DEFAULT_VAMP_PATH "$HOME/vamp:$HOME/.vamp:/usr/local/lib/vamp:/usr/lib/vamp" |
#define PATH_SEPARATOR ':' | +
+ +
Referenced by Vamp::PluginHostAdapter::getPluginPath().
+ +#define DEFAULT_VAMP_PATH "$HOME/vamp:$HOME/.vamp:/usr/local/lib/vamp:/usr/lib/vamp" | +
+ +
Referenced by Vamp::PluginHostAdapter::getPluginPath().
+ ++
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 <vamp/vamp.h> +00041 #include <vamp-sdk/Plugin.h> +00042 +00043 #include <vector> +00044 +00045 namespace Vamp { +00046 +00064 class PluginHostAdapter : public Plugin +00065 { +00066 public: +00067 PluginHostAdapter(const VampPluginDescriptor *descriptor, +00068 float inputSampleRate); +00069 virtual ~PluginHostAdapter(); +00070 +00071 static std::vector<std::string> getPluginPath(); +00072 +00073 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00074 void reset(); +00075 +00076 InputDomain getInputDomain() const; +00077 +00078 unsigned int getVampApiVersion() const; +00079 std::string getIdentifier() const; +00080 std::string getName() const; +00081 std::string getDescription() const; +00082 std::string getMaker() const; +00083 int getPluginVersion() const; +00084 std::string getCopyright() const; +00085 +00086 ParameterList getParameterDescriptors() const; +00087 float getParameter(std::string) const; +00088 void setParameter(std::string, float); +00089 +00090 ProgramList getPrograms() const; +00091 std::string getCurrentProgram() const; +00092 void selectProgram(std::string); +00093 +00094 size_t getPreferredStepSize() const; +00095 size_t getPreferredBlockSize() const; +00096 +00097 size_t getMinChannelCount() const; +00098 size_t getMaxChannelCount() const; +00099 +00100 OutputList getOutputDescriptors() const; +00101 +00102 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00103 +00104 FeatureSet getRemainingFeatures(); +00105 +00106 protected: +00107 void convertFeatures(VampFeatureList *, FeatureSet &); +00108 +00109 const VampPluginDescriptor *m_descriptor; +00110 VampPluginHandle m_handle; +00111 }; +00112 +00113 } +00114 +00115 #endif +00116 +00117 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
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... |
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-2007 Chris Cannam and QMUL. +00010 +00011 This file is based in part on Don Cross's public domain FFT +00012 implementation. +00013 +00014 Permission is hereby granted, free of charge, to any person +00015 obtaining a copy of this software and associated documentation +00016 files (the "Software"), to deal in the Software without +00017 restriction, including without limitation the rights to use, copy, +00018 modify, merge, publish, distribute, sublicense, and/or sell copies +00019 of the Software, and to permit persons to whom the Software is +00020 furnished to do so, subject to the following conditions: +00021 +00022 The above copyright notice and this permission notice shall be +00023 included in all copies or substantial portions of the Software. +00024 +00025 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +00026 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +00027 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +00028 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR +00029 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +00030 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +00031 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +00032 +00033 Except as contained in this notice, the names of the Centre for +00034 Digital Music; Queen Mary, University of London; and Chris Cannam +00035 shall not be used in advertising or otherwise to promote the sale, +00036 use or other dealings in this Software without prior written +00037 authorization. +00038 */ +00039 +00040 #include "PluginInputDomainAdapter.h" +00041 +00042 #include <cmath> +00043 +00044 +00068 #ifdef HAVE_FFTW3 +00069 #include <fftw3.h> +00070 #endif +00071 +00072 +00073 namespace Vamp { +00074 +00075 namespace HostExt { +00076 +00077 class PluginInputDomainAdapter::Impl +00078 { +00079 public: +00080 Impl(Plugin *plugin, float inputSampleRate); +00081 ~Impl(); +00082 +00083 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00084 +00085 size_t getPreferredStepSize() const; +00086 size_t getPreferredBlockSize() const; +00087 +00088 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00089 +00090 protected: +00091 Plugin *m_plugin; +00092 float m_inputSampleRate; +00093 int m_channels; +00094 int m_blockSize; +00095 float **m_freqbuf; +00096 +00097 double *m_ri; +00098 double *m_window; +00099 +00100 #ifdef HAVE_FFTW3 +00101 fftw_plan m_plan; +00102 fftw_complex *m_cbuf; +00103 #else +00104 double *m_ro; +00105 double *m_io; +00106 void fft(unsigned int n, bool inverse, +00107 double *ri, double *ii, double *ro, double *io); +00108 #endif +00109 +00110 size_t makeBlockSizeAcceptable(size_t) const; +00111 }; +00112 +00113 PluginInputDomainAdapter::PluginInputDomainAdapter(Plugin *plugin) : +00114 PluginWrapper(plugin) +00115 { +00116 m_impl = new Impl(plugin, m_inputSampleRate); +00117 } +00118 +00119 PluginInputDomainAdapter::~PluginInputDomainAdapter() +00120 { +00121 delete m_impl; +00122 } +00123 +00124 bool +00125 PluginInputDomainAdapter::initialise(size_t channels, size_t stepSize, size_t blockSize) +00126 { +00127 return m_impl->initialise(channels, stepSize, blockSize); +00128 } +00129 +00130 Plugin::InputDomain +00131 PluginInputDomainAdapter::getInputDomain() const +00132 { +00133 return TimeDomain; +00134 } +00135 +00136 size_t +00137 PluginInputDomainAdapter::getPreferredStepSize() const +00138 { +00139 return m_impl->getPreferredStepSize(); +00140 } +00141 +00142 size_t +00143 PluginInputDomainAdapter::getPreferredBlockSize() const +00144 { +00145 return m_impl->getPreferredBlockSize(); +00146 } +00147 +00148 Plugin::FeatureSet +00149 PluginInputDomainAdapter::process(const float *const *inputBuffers, RealTime timestamp) +00150 { +00151 return m_impl->process(inputBuffers, timestamp); +00152 } +00153 +00154 PluginInputDomainAdapter::Impl::Impl(Plugin *plugin, float inputSampleRate) : +00155 m_plugin(plugin), +00156 m_inputSampleRate(inputSampleRate), +00157 m_channels(0), +00158 m_blockSize(0), +00159 m_freqbuf(0), +00160 m_ri(0), +00161 m_window(0), +00162 #ifdef HAVE_FFTW3 +00163 m_plan(0), +00164 m_cbuf(0) +00165 #else +00166 m_ro(0), +00167 m_io(0) +00168 #endif +00169 { +00170 } +00171 +00172 PluginInputDomainAdapter::Impl::~Impl() +00173 { +00174 // the adapter will delete the plugin +00175 +00176 if (m_channels > 0) { +00177 for (int c = 0; c < m_channels; ++c) { +00178 delete[] m_freqbuf[c]; +00179 } +00180 delete[] m_freqbuf; +00181 #ifdef HAVE_FFTW3 +00182 if (m_plan) { +00183 fftw_destroy_plan(m_plan); +00184 fftw_free(m_ri); +00185 fftw_free(m_cbuf); +00186 m_plan = 0; +00187 } +00188 #else +00189 delete[] m_ri; +00190 delete[] m_ro; +00191 delete[] m_io; +00192 #endif +00193 delete[] m_window; +00194 } +00195 } +00196 +00197 // for some visual studii apparently +00198 #ifndef M_PI +00199 #define M_PI 3.14159265358979232846 +00200 #endif +00201 +00202 bool +00203 PluginInputDomainAdapter::Impl::initialise(size_t channels, size_t stepSize, size_t blockSize) +00204 { +00205 if (m_plugin->getInputDomain() == TimeDomain) { +00206 +00207 m_blockSize = int(blockSize); +00208 m_channels = int(channels); +00209 +00210 return m_plugin->initialise(channels, stepSize, blockSize); +00211 } +00212 +00213 if (blockSize < 2) { +00214 std::cerr << "ERROR: Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise: blocksize < 2 not supported" << std::endl; +00215 return false; +00216 } +00217 +00218 if (blockSize & (blockSize-1)) { +00219 std::cerr << "ERROR: Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise: non-power-of-two\nblocksize " << blockSize << " not supported" << std::endl; +00220 return false; +00221 } +00222 +00223 if (m_channels > 0) { +00224 for (int c = 0; c < m_channels; ++c) { +00225 delete[] m_freqbuf[c]; +00226 } +00227 delete[] m_freqbuf; +00228 #ifdef HAVE_FFTW3 +00229 if (m_plan) { +00230 fftw_destroy_plan(m_plan); +00231 fftw_free(m_ri); +00232 fftw_free(m_cbuf); +00233 m_plan = 0; +00234 } +00235 #else +00236 delete[] m_ri; +00237 delete[] m_ro; +00238 delete[] m_io; +00239 #endif +00240 delete[] m_window; +00241 } +00242 +00243 m_blockSize = int(blockSize); +00244 m_channels = int(channels); +00245 +00246 m_freqbuf = new float *[m_channels]; +00247 for (int c = 0; c < m_channels; ++c) { +00248 m_freqbuf[c] = new float[m_blockSize + 2]; +00249 } +00250 m_window = new double[m_blockSize]; +00251 +00252 for (int i = 0; i < m_blockSize; ++i) { +00253 // Hanning window +00254 m_window[i] = (0.50 - 0.50 * cos((2.0 * M_PI * i) / m_blockSize)); +00255 } +00256 +00257 #ifdef HAVE_FFTW3 +00258 m_ri = (double *)fftw_malloc(blockSize * sizeof(double)); +00259 m_cbuf = (fftw_complex *)fftw_malloc((blockSize/2 + 1) * sizeof(fftw_complex)); +00260 m_plan = fftw_plan_dft_r2c_1d(blockSize, m_ri, m_cbuf, FFTW_MEASURE); +00261 #else +00262 m_ri = new double[m_blockSize]; +00263 m_ro = new double[m_blockSize]; +00264 m_io = new double[m_blockSize]; +00265 #endif +00266 +00267 return m_plugin->initialise(channels, stepSize, blockSize); +00268 } +00269 +00270 size_t +00271 PluginInputDomainAdapter::Impl::getPreferredStepSize() const +00272 { +00273 size_t step = m_plugin->getPreferredStepSize(); +00274 +00275 if (step == 0 && (m_plugin->getInputDomain() == FrequencyDomain)) { +00276 step = getPreferredBlockSize() / 2; +00277 } +00278 +00279 return step; +00280 } +00281 +00282 size_t +00283 PluginInputDomainAdapter::Impl::getPreferredBlockSize() const +00284 { +00285 size_t block = m_plugin->getPreferredBlockSize(); +00286 +00287 if (m_plugin->getInputDomain() == FrequencyDomain) { +00288 if (block == 0) { +00289 block = 1024; +00290 } else { +00291 block = makeBlockSizeAcceptable(block); +00292 } +00293 } +00294 +00295 return block; +00296 } +00297 +00298 size_t +00299 PluginInputDomainAdapter::Impl::makeBlockSizeAcceptable(size_t blockSize) const +00300 { +00301 if (blockSize < 2) { +00302 +00303 std::cerr << "WARNING: Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise: blocksize < 2 not" << std::endl +00304 << "supported, increasing from " << blockSize << " to 2" << std::endl; +00305 blockSize = 2; +00306 +00307 } else if (blockSize & (blockSize-1)) { +00308 +00309 #ifdef HAVE_FFTW3 +00310 // not an issue with FFTW +00311 #else +00312 +00313 // not a power of two, can't handle that with our built-in FFT +00314 // implementation +00315 +00316 size_t nearest = blockSize; +00317 size_t power = 0; +00318 while (nearest > 1) { +00319 nearest >>= 1; +00320 ++power; +00321 } +00322 nearest = 1; +00323 while (power) { +00324 nearest <<= 1; +00325 --power; +00326 } +00327 +00328 if (blockSize - nearest > (nearest*2) - blockSize) { +00329 nearest = nearest*2; +00330 } +00331 +00332 std::cerr << "WARNING: Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise: non-power-of-two\nblocksize " << blockSize << " not supported, using blocksize " << nearest << " instead" << std::endl; +00333 blockSize = nearest; +00334 +00335 #endif +00336 } +00337 +00338 return blockSize; +00339 } +00340 +00341 Plugin::FeatureSet +00342 PluginInputDomainAdapter::Impl::process(const float *const *inputBuffers, +00343 RealTime timestamp) +00344 { +00345 if (m_plugin->getInputDomain() == TimeDomain) { +00346 return m_plugin->process(inputBuffers, timestamp); +00347 } +00348 +00349 // The timestamp supplied should be (according to the Vamp::Plugin +00350 // spec) the time of the start of the time-domain input block. +00351 // However, we want to pass to the plugin an FFT output calculated +00352 // from the block of samples _centred_ on that timestamp. +00353 // +00354 // We have two options: +00355 // +00356 // 1. Buffer the input, calculating the fft of the values at the +00357 // passed-in block minus blockSize/2 rather than starting at the +00358 // passed-in block. So each time we call process on the plugin, +00359 // we are passing in the same timestamp as was passed to our own +00360 // process plugin, but not (the frequency domain representation +00361 // of) the same set of samples. Advantages: avoids confusion in +00362 // the host by ensuring the returned values have timestamps +00363 // comparable with that passed in to this function (in fact this +00364 // is pretty much essential for one-value-per-block outputs); +00365 // consistent with hosts such as SV that deal with the +00366 // frequency-domain transform themselves. Disadvantages: means +00367 // making the not necessarily correct assumption that the samples +00368 // preceding the first official block are all zero (or some other +00369 // known value). +00370 // +00371 // 2. Increase the passed-in timestamps by half the blocksize. So +00372 // when we call process, we are passing in the frequency domain +00373 // representation of the same set of samples as passed to us, but +00374 // with a different timestamp. Advantages: simplicity; avoids +00375 // iffy assumption mentioned above. Disadvantages: inconsistency +00376 // with SV in cases where stepSize != blockSize/2; potential +00377 // confusion arising from returned timestamps being calculated +00378 // from the adjusted input timestamps rather than the original +00379 // ones (and inaccuracy where the returned timestamp is implied, +00380 // as in one-value-per-block). +00381 // +00382 // Neither way is ideal, but I don't think either is strictly +00383 // incorrect either. I think this is just a case where the same +00384 // plugin can legitimately produce differing results from the same +00385 // input data, depending on how that data is packaged. +00386 // +00387 // We'll go for option 2, adjusting the timestamps. Note in +00388 // particular that this means some results can differ from those +00389 // produced by SV. +00390 +00391 // std::cerr << "PluginInputDomainAdapter: sampleRate " << m_inputSampleRate << ", blocksize " << m_blockSize << ", adjusting time from " << timestamp; +00392 +00393 timestamp = timestamp + RealTime::frame2RealTime +00394 (m_blockSize/2, int(m_inputSampleRate + 0.5)); +00395 +00396 // std::cerr << " to " << timestamp << std::endl; +00397 +00398 for (int c = 0; c < m_channels; ++c) { +00399 +00400 for (int i = 0; i < m_blockSize; ++i) { +00401 m_ri[i] = double(inputBuffers[c][i]) * m_window[i]; +00402 } +00403 +00404 for (int i = 0; i < m_blockSize/2; ++i) { +00405 // FFT shift +00406 double value = m_ri[i]; +00407 m_ri[i] = m_ri[i + m_blockSize/2]; +00408 m_ri[i + m_blockSize/2] = value; +00409 } +00410 +00411 #ifdef HAVE_FFTW3 +00412 +00413 fftw_execute(m_plan); +00414 +00415 for (int i = 0; i <= m_blockSize/2; ++i) { +00416 m_freqbuf[c][i * 2] = float(m_cbuf[i][0]); +00417 m_freqbuf[c][i * 2 + 1] = float(m_cbuf[i][1]); +00418 } +00419 +00420 #else +00421 +00422 fft(m_blockSize, false, m_ri, 0, m_ro, m_io); +00423 +00424 for (int i = 0; i <= m_blockSize/2; ++i) { +00425 m_freqbuf[c][i * 2] = float(m_ro[i]); +00426 m_freqbuf[c][i * 2 + 1] = float(m_io[i]); +00427 } +00428 +00429 #endif +00430 } +00431 +00432 return m_plugin->process(m_freqbuf, timestamp); +00433 } +00434 +00435 #ifndef HAVE_FFTW3 +00436 +00437 void +00438 PluginInputDomainAdapter::Impl::fft(unsigned int n, bool inverse, +00439 double *ri, double *ii, double *ro, double *io) +00440 { +00441 if (!ri || !ro || !io) return; +00442 +00443 unsigned int bits; +00444 unsigned int i, j, k, m; +00445 unsigned int blockSize, blockEnd; +00446 +00447 double tr, ti; +00448 +00449 if (n < 2) return; +00450 if (n & (n-1)) return; +00451 +00452 double angle = 2.0 * M_PI; +00453 if (inverse) angle = -angle; +00454 +00455 for (i = 0; ; ++i) { +00456 if (n & (1 << i)) { +00457 bits = i; +00458 break; +00459 } +00460 } +00461 +00462 static unsigned int tableSize = 0; +00463 static int *table = 0; +00464 +00465 if (tableSize != n) { +00466 +00467 delete[] table; +00468 +00469 table = new int[n]; +00470 +00471 for (i = 0; i < n; ++i) { +00472 +00473 m = i; +00474 +00475 for (j = k = 0; j < bits; ++j) { +00476 k = (k << 1) | (m & 1); +00477 m >>= 1; +00478 } +00479 +00480 table[i] = k; +00481 } +00482 +00483 tableSize = n; +00484 } +00485 +00486 if (ii) { +00487 for (i = 0; i < n; ++i) { +00488 ro[table[i]] = ri[i]; +00489 io[table[i]] = ii[i]; +00490 } +00491 } else { +00492 for (i = 0; i < n; ++i) { +00493 ro[table[i]] = ri[i]; +00494 io[table[i]] = 0.0; +00495 } +00496 } +00497 +00498 blockEnd = 1; +00499 +00500 for (blockSize = 2; blockSize <= n; blockSize <<= 1) { +00501 +00502 double delta = angle / (double)blockSize; +00503 double sm2 = -sin(-2 * delta); +00504 double sm1 = -sin(-delta); +00505 double cm2 = cos(-2 * delta); +00506 double cm1 = cos(-delta); +00507 double w = 2 * cm1; +00508 double ar[3], ai[3]; +00509 +00510 for (i = 0; i < n; i += blockSize) { +00511 +00512 ar[2] = cm2; +00513 ar[1] = cm1; +00514 +00515 ai[2] = sm2; +00516 ai[1] = sm1; +00517 +00518 for (j = i, m = 0; m < blockEnd; j++, m++) { +00519 +00520 ar[0] = w * ar[1] - ar[2]; +00521 ar[2] = ar[1]; +00522 ar[1] = ar[0]; +00523 +00524 ai[0] = w * ai[1] - ai[2]; +00525 ai[2] = ai[1]; +00526 ai[1] = ai[0]; +00527 +00528 k = j + blockEnd; +00529 tr = ar[0] * ro[k] - ai[0] * io[k]; +00530 ti = ar[0] * io[k] + ai[0] * ro[k]; +00531 +00532 ro[k] = ro[j] - tr; +00533 io[k] = io[j] - ti; +00534 +00535 ro[j] += tr; +00536 io[j] += ti; +00537 } +00538 } +00539 +00540 blockEnd = blockSize; +00541 } +00542 +00543 if (inverse) { +00544 +00545 double denom = (double)n; +00546 +00547 for (i = 0; i < n; i++) { +00548 ro[i] /= denom; +00549 io[i] /= denom; +00550 } +00551 } +00552 } +00553 +00554 #endif +00555 +00556 } +00557 +00558 } +00559 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
Classes | |
class | Vamp::HostExt::PluginInputDomainAdapter::Impl |
Defines | |
#define | M_PI 3.14159265358979232846 |
#define M_PI 3.14159265358979232846 | +
+ +
Definition at line 199 of file PluginInputDomainAdapter.cpp.
+ +Referenced by Vamp::HostExt::PluginInputDomainAdapter::Impl::fft(), and Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise().
+ ++
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-2007 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 "PluginWrapper.h" +00041 +00042 namespace Vamp { +00043 +00044 namespace HostExt { +00045 +00079 class PluginInputDomainAdapter : public PluginWrapper +00080 { +00081 public: +00082 PluginInputDomainAdapter(Plugin *plugin); // I take ownership of plugin +00083 virtual ~PluginInputDomainAdapter(); +00084 +00085 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00086 +00087 InputDomain getInputDomain() const; +00088 +00089 size_t getPreferredStepSize() const; +00090 size_t getPreferredBlockSize() const; +00091 +00092 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00093 +00094 protected: +00095 class Impl; +00096 Impl *m_impl; +00097 }; +00098 +00099 } +00100 +00101 } +00102 +00103 #endif +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
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... |
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-2007 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 "vamp-sdk/PluginHostAdapter.h" +00038 #include "PluginLoader.h" +00039 #include "PluginInputDomainAdapter.h" +00040 #include "PluginChannelAdapter.h" +00041 #include "PluginBufferingAdapter.h" +00042 +00043 #include <fstream> +00044 #include <cctype> // tolower +00045 +00046 #include <cstring> +00047 +00048 #ifdef _WIN32 +00049 +00050 #include <windows.h> +00051 #include <tchar.h> +00052 #define PLUGIN_SUFFIX "dll" +00053 +00054 #else /* ! _WIN32 */ +00055 +00056 #include <dirent.h> +00057 #include <dlfcn.h> +00058 +00059 #ifdef __APPLE__ +00060 #define PLUGIN_SUFFIX "dylib" +00061 #else /* ! __APPLE__ */ +00062 #define PLUGIN_SUFFIX "so" +00063 #endif /* ! __APPLE__ */ +00064 +00065 #endif /* ! _WIN32 */ +00066 +00067 using namespace std; +00068 +00069 namespace Vamp { +00070 +00071 namespace HostExt { +00072 +00073 class PluginLoader::Impl +00074 { +00075 public: +00076 Impl(); +00077 virtual ~Impl(); +00078 +00079 PluginKeyList listPlugins(); +00080 +00081 Plugin *loadPlugin(PluginKey key, +00082 float inputSampleRate, +00083 int adapterFlags); +00084 +00085 PluginKey composePluginKey(string libraryName, string identifier); +00086 +00087 PluginCategoryHierarchy getPluginCategory(PluginKey key); +00088 +00089 string getLibraryPathForPlugin(PluginKey key); +00090 +00091 static void setInstanceToClean(PluginLoader *instance); +00092 +00093 protected: +00094 class PluginDeletionNotifyAdapter : public PluginWrapper { +00095 public: +00096 PluginDeletionNotifyAdapter(Plugin *plugin, Impl *loader); +00097 virtual ~PluginDeletionNotifyAdapter(); +00098 protected: +00099 Impl *m_loader; +00100 }; +00101 +00102 class InstanceCleaner { +00103 public: +00104 InstanceCleaner() : m_instance(0) { } +00105 ~InstanceCleaner() { delete m_instance; } +00106 void setInstance(PluginLoader *instance) { m_instance = instance; } +00107 protected: +00108 PluginLoader *m_instance; +00109 }; +00110 +00111 virtual void pluginDeleted(PluginDeletionNotifyAdapter *adapter); +00112 +00113 map<PluginKey, string> m_pluginLibraryNameMap; +00114 bool m_allPluginsEnumerated; +00115 void enumeratePlugins(PluginKey forPlugin = ""); +00116 +00117 map<PluginKey, PluginCategoryHierarchy> m_taxonomy; +00118 void generateTaxonomy(); +00119 +00120 map<Plugin *, void *> m_pluginLibraryHandleMap; +00121 +00122 bool decomposePluginKey(PluginKey key, +00123 string &libraryName, string &identifier); +00124 +00125 void *loadLibrary(string path); +00126 void unloadLibrary(void *handle); +00127 void *lookupInLibrary(void *handle, const char *symbol); +00128 +00129 string splicePath(string a, string b); +00130 vector<string> listFiles(string dir, string ext); +00131 +00132 static InstanceCleaner m_cleaner; +00133 }; +00134 +00135 PluginLoader * +00136 PluginLoader::m_instance = 0; +00137 +00138 PluginLoader::Impl::InstanceCleaner +00139 PluginLoader::Impl::m_cleaner; +00140 +00141 PluginLoader::PluginLoader() +00142 { +00143 m_impl = new Impl(); +00144 } +00145 +00146 PluginLoader::~PluginLoader() +00147 { +00148 delete m_impl; +00149 } +00150 +00151 PluginLoader * +00152 PluginLoader::getInstance() +00153 { +00154 if (!m_instance) { +00155 // The cleaner doesn't own the instance, because we leave the +00156 // instance pointer in the base class for binary backwards +00157 // compatibility reasons and to avoid waste +00158 m_instance = new PluginLoader(); +00159 Impl::setInstanceToClean(m_instance); +00160 } +00161 return m_instance; +00162 } +00163 +00164 vector<PluginLoader::PluginKey> +00165 PluginLoader::listPlugins() +00166 { +00167 return m_impl->listPlugins(); +00168 } +00169 +00170 Plugin * +00171 PluginLoader::loadPlugin(PluginKey key, +00172 float inputSampleRate, +00173 int adapterFlags) +00174 { +00175 return m_impl->loadPlugin(key, inputSampleRate, adapterFlags); +00176 } +00177 +00178 PluginLoader::PluginKey +00179 PluginLoader::composePluginKey(string libraryName, string identifier) +00180 { +00181 return m_impl->composePluginKey(libraryName, identifier); +00182 } +00183 +00184 PluginLoader::PluginCategoryHierarchy +00185 PluginLoader::getPluginCategory(PluginKey key) +00186 { +00187 return m_impl->getPluginCategory(key); +00188 } +00189 +00190 string +00191 PluginLoader::getLibraryPathForPlugin(PluginKey key) +00192 { +00193 return m_impl->getLibraryPathForPlugin(key); +00194 } +00195 +00196 PluginLoader::Impl::Impl() : +00197 m_allPluginsEnumerated(false) +00198 { +00199 } +00200 +00201 PluginLoader::Impl::~Impl() +00202 { +00203 } +00204 +00205 void +00206 PluginLoader::Impl::setInstanceToClean(PluginLoader *instance) +00207 { +00208 m_cleaner.setInstance(instance); +00209 } +00210 +00211 vector<PluginLoader::PluginKey> +00212 PluginLoader::Impl::listPlugins() +00213 { +00214 if (!m_allPluginsEnumerated) enumeratePlugins(); +00215 +00216 vector<PluginKey> plugins; +00217 for (map<PluginKey, string>::iterator mi = m_pluginLibraryNameMap.begin(); +00218 mi != m_pluginLibraryNameMap.end(); ++mi) { +00219 plugins.push_back(mi->first); +00220 } +00221 +00222 return plugins; +00223 } +00224 +00225 void +00226 PluginLoader::Impl::enumeratePlugins(PluginKey forPlugin) +00227 { +00228 vector<string> path = PluginHostAdapter::getPluginPath(); +00229 +00230 string libraryName, identifier; +00231 if (forPlugin != "") { +00232 if (!decomposePluginKey(forPlugin, libraryName, identifier)) { +00233 std::cerr << "WARNING: Vamp::HostExt::PluginLoader: Invalid plugin key \"" +00234 << forPlugin << "\" in enumerate" << std::endl; +00235 return; +00236 } +00237 } +00238 +00239 for (size_t i = 0; i < path.size(); ++i) { +00240 +00241 vector<string> files = listFiles(path[i], PLUGIN_SUFFIX); +00242 +00243 for (vector<string>::iterator fi = files.begin(); +00244 fi != files.end(); ++fi) { +00245 +00246 if (libraryName != "") { +00247 // libraryName is lowercased and lacking an extension, +00248 // as it came from the plugin key +00249 string temp = *fi; +00250 for (size_t i = 0; i < temp.length(); ++i) { +00251 temp[i] = tolower(temp[i]); +00252 } +00253 string::size_type pi = temp.find('.'); +00254 if (pi == string::npos) { +00255 if (libraryName != temp) continue; +00256 } else { +00257 if (libraryName != temp.substr(0, pi)) continue; +00258 } +00259 } +00260 +00261 string fullPath = path[i]; +00262 fullPath = splicePath(fullPath, *fi); +00263 void *handle = loadLibrary(fullPath); +00264 if (!handle) continue; +00265 +00266 VampGetPluginDescriptorFunction fn = +00267 (VampGetPluginDescriptorFunction)lookupInLibrary +00268 (handle, "vampGetPluginDescriptor"); +00269 +00270 if (!fn) { +00271 unloadLibrary(handle); +00272 continue; +00273 } +00274 +00275 int index = 0; +00276 const VampPluginDescriptor *descriptor = 0; +00277 +00278 while ((descriptor = fn(VAMP_API_VERSION, index))) { +00279 ++index; +00280 if (identifier != "") { +00281 if (descriptor->identifier != identifier) continue; +00282 } +00283 PluginKey key = composePluginKey(*fi, descriptor->identifier); +00284 // std::cerr << "enumerate: " << key << " (path: " << fullPath << ")" << std::endl; +00285 if (m_pluginLibraryNameMap.find(key) == +00286 m_pluginLibraryNameMap.end()) { +00287 m_pluginLibraryNameMap[key] = fullPath; +00288 } +00289 } +00290 +00291 unloadLibrary(handle); +00292 } +00293 } +00294 +00295 if (forPlugin == "") m_allPluginsEnumerated = true; +00296 } +00297 +00298 PluginLoader::PluginKey +00299 PluginLoader::Impl::composePluginKey(string libraryName, string identifier) +00300 { +00301 string basename = libraryName; +00302 +00303 string::size_type li = basename.rfind('/'); +00304 if (li != string::npos) basename = basename.substr(li + 1); +00305 +00306 li = basename.find('.'); +00307 if (li != string::npos) basename = basename.substr(0, li); +00308 +00309 for (size_t i = 0; i < basename.length(); ++i) { +00310 basename[i] = tolower(basename[i]); +00311 } +00312 +00313 return basename + ":" + identifier; +00314 } +00315 +00316 bool +00317 PluginLoader::Impl::decomposePluginKey(PluginKey key, +00318 string &libraryName, +00319 string &identifier) +00320 { +00321 string::size_type ki = key.find(':'); +00322 if (ki == string::npos) { +00323 return false; +00324 } +00325 +00326 libraryName = key.substr(0, ki); +00327 identifier = key.substr(ki + 1); +00328 return true; +00329 } +00330 +00331 PluginLoader::PluginCategoryHierarchy +00332 PluginLoader::Impl::getPluginCategory(PluginKey plugin) +00333 { +00334 if (m_taxonomy.empty()) generateTaxonomy(); +00335 if (m_taxonomy.find(plugin) == m_taxonomy.end()) { +00336 return PluginCategoryHierarchy(); +00337 } +00338 return m_taxonomy[plugin]; +00339 } +00340 +00341 string +00342 PluginLoader::Impl::getLibraryPathForPlugin(PluginKey plugin) +00343 { +00344 if (m_pluginLibraryNameMap.find(plugin) == m_pluginLibraryNameMap.end()) { +00345 if (m_allPluginsEnumerated) return ""; +00346 enumeratePlugins(plugin); +00347 } +00348 if (m_pluginLibraryNameMap.find(plugin) == m_pluginLibraryNameMap.end()) { +00349 return ""; +00350 } +00351 return m_pluginLibraryNameMap[plugin]; +00352 } +00353 +00354 Plugin * +00355 PluginLoader::Impl::loadPlugin(PluginKey key, +00356 float inputSampleRate, int adapterFlags) +00357 { +00358 string libname, identifier; +00359 if (!decomposePluginKey(key, libname, identifier)) { +00360 std::cerr << "Vamp::HostExt::PluginLoader: Invalid plugin key \"" +00361 << key << "\" in loadPlugin" << std::endl; +00362 return 0; +00363 } +00364 +00365 string fullPath = getLibraryPathForPlugin(key); +00366 if (fullPath == "") return 0; +00367 +00368 void *handle = loadLibrary(fullPath); +00369 if (!handle) return 0; +00370 +00371 VampGetPluginDescriptorFunction fn = +00372 (VampGetPluginDescriptorFunction)lookupInLibrary +00373 (handle, "vampGetPluginDescriptor"); +00374 +00375 if (!fn) { +00376 unloadLibrary(handle); +00377 return 0; +00378 } +00379 +00380 int index = 0; +00381 const VampPluginDescriptor *descriptor = 0; +00382 +00383 while ((descriptor = fn(VAMP_API_VERSION, index))) { +00384 +00385 if (string(descriptor->identifier) == identifier) { +00386 +00387 Vamp::PluginHostAdapter *plugin = +00388 new Vamp::PluginHostAdapter(descriptor, inputSampleRate); +00389 +00390 Plugin *adapter = new PluginDeletionNotifyAdapter(plugin, this); +00391 +00392 m_pluginLibraryHandleMap[adapter] = handle; +00393 +00394 if (adapterFlags & ADAPT_INPUT_DOMAIN) { +00395 if (adapter->getInputDomain() == Plugin::FrequencyDomain) { +00396 adapter = new PluginInputDomainAdapter(adapter); +00397 } +00398 } +00399 +00400 if (adapterFlags & ADAPT_BUFFER_SIZE) { +00401 adapter = new PluginBufferingAdapter(adapter); +00402 } +00403 +00404 if (adapterFlags & ADAPT_CHANNEL_COUNT) { +00405 adapter = new PluginChannelAdapter(adapter); +00406 } +00407 +00408 return adapter; +00409 } +00410 +00411 ++index; +00412 } +00413 +00414 cerr << "Vamp::HostExt::PluginLoader: Plugin \"" +00415 << identifier << "\" not found in library \"" +00416 << fullPath << "\"" << endl; +00417 +00418 return 0; +00419 } +00420 +00421 void +00422 PluginLoader::Impl::generateTaxonomy() +00423 { +00424 // cerr << "PluginLoader::Impl::generateTaxonomy" << endl; +00425 +00426 vector<string> path = PluginHostAdapter::getPluginPath(); +00427 string libfragment = "/lib/"; +00428 vector<string> catpath; +00429 +00430 string suffix = "cat"; +00431 +00432 for (vector<string>::iterator i = path.begin(); +00433 i != path.end(); ++i) { +00434 +00435 // It doesn't matter that we're using literal forward-slash in +00436 // this bit, as it's only relevant if the path contains +00437 // "/lib/", which is only meaningful and only plausible on +00438 // systems with forward-slash delimiters +00439 +00440 string dir = *i; +00441 string::size_type li = dir.find(libfragment); +00442 +00443 if (li != string::npos) { +00444 catpath.push_back +00445 (dir.substr(0, li) +00446 + "/share/" +00447 + dir.substr(li + libfragment.length())); +00448 } +00449 +00450 catpath.push_back(dir); +00451 } +00452 +00453 char buffer[1024]; +00454 +00455 for (vector<string>::iterator i = catpath.begin(); +00456 i != catpath.end(); ++i) { +00457 +00458 vector<string> files = listFiles(*i, suffix); +00459 +00460 for (vector<string>::iterator fi = files.begin(); +00461 fi != files.end(); ++fi) { +00462 +00463 string filepath = splicePath(*i, *fi); +00464 ifstream is(filepath.c_str(), ifstream::in | ifstream::binary); +00465 +00466 if (is.fail()) { +00467 // cerr << "failed to open: " << filepath << endl; +00468 continue; +00469 } +00470 +00471 // cerr << "opened: " << filepath << endl; +00472 +00473 while (!!is.getline(buffer, 1024)) { +00474 +00475 string line(buffer); +00476 +00477 // cerr << "line = " << line << endl; +00478 +00479 string::size_type di = line.find("::"); +00480 if (di == string::npos) continue; +00481 +00482 string id = line.substr(0, di); +00483 string encodedCat = line.substr(di + 2); +00484 +00485 if (id.substr(0, 5) != "vamp:") continue; +00486 id = id.substr(5); +00487 +00488 while (encodedCat.length() >= 1 && +00489 encodedCat[encodedCat.length()-1] == '\r') { +00490 encodedCat = encodedCat.substr(0, encodedCat.length()-1); +00491 } +00492 +00493 // cerr << "id = " << id << ", cat = " << encodedCat << endl; +00494 +00495 PluginCategoryHierarchy category; +00496 string::size_type ai; +00497 while ((ai = encodedCat.find(" > ")) != string::npos) { +00498 category.push_back(encodedCat.substr(0, ai)); +00499 encodedCat = encodedCat.substr(ai + 3); +00500 } +00501 if (encodedCat != "") category.push_back(encodedCat); +00502 +00503 m_taxonomy[id] = category; +00504 } +00505 } +00506 } +00507 } +00508 +00509 void * +00510 PluginLoader::Impl::loadLibrary(string path) +00511 { +00512 void *handle = 0; +00513 #ifdef _WIN32 +00514 handle = LoadLibrary(path.c_str()); +00515 if (!handle) { +00516 cerr << "Vamp::HostExt::PluginLoader: Unable to load library \"" +00517 << path << "\"" << endl; +00518 } +00519 #else +00520 handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_LOCAL); +00521 if (!handle) { +00522 cerr << "Vamp::HostExt::PluginLoader: Unable to load library \"" +00523 << path << "\": " << dlerror() << endl; +00524 } +00525 #endif +00526 return handle; +00527 } +00528 +00529 void +00530 PluginLoader::Impl::unloadLibrary(void *handle) +00531 { +00532 #ifdef _WIN32 +00533 FreeLibrary((HINSTANCE)handle); +00534 #else +00535 dlclose(handle); +00536 #endif +00537 } +00538 +00539 void * +00540 PluginLoader::Impl::lookupInLibrary(void *handle, const char *symbol) +00541 { +00542 #ifdef _WIN32 +00543 return (void *)GetProcAddress((HINSTANCE)handle, symbol); +00544 #else +00545 return (void *)dlsym(handle, symbol); +00546 #endif +00547 } +00548 +00549 string +00550 PluginLoader::Impl::splicePath(string a, string b) +00551 { +00552 #ifdef _WIN32 +00553 return a + "\\" + b; +00554 #else +00555 return a + "/" + b; +00556 #endif +00557 } +00558 +00559 vector<string> +00560 PluginLoader::Impl::listFiles(string dir, string extension) +00561 { +00562 vector<string> files; +00563 +00564 #ifdef _WIN32 +00565 +00566 string expression = dir + "\\*." + extension; +00567 WIN32_FIND_DATA data; +00568 HANDLE fh = FindFirstFile(expression.c_str(), &data); +00569 if (fh == INVALID_HANDLE_VALUE) return files; +00570 +00571 bool ok = true; +00572 while (ok) { +00573 files.push_back(data.cFileName); +00574 ok = FindNextFile(fh, &data); +00575 } +00576 +00577 FindClose(fh); +00578 +00579 #else +00580 +00581 size_t extlen = extension.length(); +00582 DIR *d = opendir(dir.c_str()); +00583 if (!d) return files; +00584 +00585 struct dirent *e = 0; +00586 while ((e = readdir(d))) { +00587 +00588 if (!e->d_name) continue; +00589 +00590 size_t len = strlen(e->d_name); +00591 if (len < extlen + 2 || +00592 e->d_name + len - extlen - 1 != "." + extension) { +00593 continue; +00594 } +00595 +00596 files.push_back(e->d_name); +00597 } +00598 +00599 closedir(d); +00600 #endif +00601 +00602 return files; +00603 } +00604 +00605 void +00606 PluginLoader::Impl::pluginDeleted(PluginDeletionNotifyAdapter *adapter) +00607 { +00608 void *handle = m_pluginLibraryHandleMap[adapter]; +00609 if (handle) unloadLibrary(handle); +00610 m_pluginLibraryHandleMap.erase(adapter); +00611 } +00612 +00613 PluginLoader::Impl::PluginDeletionNotifyAdapter::PluginDeletionNotifyAdapter(Plugin *plugin, +00614 Impl *loader) : +00615 PluginWrapper(plugin), +00616 m_loader(loader) +00617 { +00618 } +00619 +00620 PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter() +00621 { +00622 // We need to delete the plugin before calling pluginDeleted, as +00623 // the delete call may require calling through to the descriptor +00624 // (for e.g. cleanup) but pluginDeleted may unload the required +00625 // library for the call. To prevent a double deletion when our +00626 // parent's destructor runs (after this one), be sure to set +00627 // m_plugin to 0 after deletion. +00628 delete m_plugin; +00629 m_plugin = 0; +00630 +00631 if (m_loader) m_loader->pluginDeleted(this); +00632 } +00633 +00634 } +00635 +00636 } +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
Classes | |
class | Vamp::HostExt::PluginLoader::Impl |
class | Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter |
class | Vamp::HostExt::PluginLoader::Impl::InstanceCleaner |
Defines | |
#define | PLUGIN_SUFFIX "so" |
#define PLUGIN_SUFFIX "so" | +
+ +
Definition at line 62 of file PluginLoader.cpp.
+ +Referenced by Vamp::HostExt::PluginLoader::Impl::enumeratePlugins(), and usage().
+ ++
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-2007 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 "PluginWrapper.h" +00045 +00046 namespace Vamp { +00047 +00048 class Plugin; +00049 +00050 namespace HostExt { +00051 +00069 class PluginLoader +00070 { +00071 public: +00076 static PluginLoader *getInstance(); +00077 +00098 typedef std::string PluginKey; +00099 +00104 typedef std::vector<PluginKey> PluginKeyList; +00105 +00116 typedef std::vector<std::string> PluginCategoryHierarchy; +00117 +00122 PluginKeyList listPlugins(); +00123 +00166 enum AdapterFlags { +00167 +00168 ADAPT_INPUT_DOMAIN = 0x01, +00169 ADAPT_CHANNEL_COUNT = 0x02, +00170 ADAPT_BUFFER_SIZE = 0x04, +00171 +00172 ADAPT_ALL_SAFE = 0x03, +00173 +00174 ADAPT_ALL = 0xff +00175 }; +00176 +00194 Plugin *loadPlugin(PluginKey key, +00195 float inputSampleRate, +00196 int adapterFlags = 0); +00197 +00203 PluginKey composePluginKey(std::string libraryName, +00204 std::string identifier); +00205 +00215 PluginCategoryHierarchy getPluginCategory(PluginKey plugin); +00216 +00221 std::string getLibraryPathForPlugin(PluginKey plugin); +00222 +00223 protected: +00224 PluginLoader(); +00225 virtual ~PluginLoader(); +00226 +00227 class Impl; +00228 Impl *m_impl; +00229 +00230 static PluginLoader *m_instance; +00231 }; +00232 +00233 } +00234 +00235 } +00236 +00237 #endif +00238 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
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... |
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-2007 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 "PluginWrapper.h" +00038 +00039 namespace Vamp { +00040 +00041 namespace HostExt { +00042 +00043 class PluginRateExtractor : public Plugin +00044 { +00045 public: +00046 PluginRateExtractor() : Plugin(0) { } +00047 float getRate() const { return m_inputSampleRate; } +00048 }; +00049 +00050 PluginWrapper::PluginWrapper(Plugin *plugin) : +00051 Plugin(((PluginRateExtractor *)plugin)->getRate()), +00052 m_plugin(plugin) +00053 { +00054 } +00055 +00056 PluginWrapper::~PluginWrapper() +00057 { +00058 delete m_plugin; +00059 } +00060 +00061 bool +00062 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize) +00063 { +00064 return m_plugin->initialise(channels, stepSize, blockSize); +00065 } +00066 +00067 void +00068 PluginWrapper::reset() +00069 { +00070 m_plugin->reset(); +00071 } +00072 +00073 Plugin::InputDomain +00074 PluginWrapper::getInputDomain() const +00075 { +00076 return m_plugin->getInputDomain(); +00077 } +00078 +00079 unsigned int +00080 PluginWrapper::getVampApiVersion() const +00081 { +00082 return m_plugin->getVampApiVersion(); +00083 } +00084 +00085 std::string +00086 PluginWrapper::getIdentifier() const +00087 { +00088 return m_plugin->getIdentifier(); +00089 } +00090 +00091 std::string +00092 PluginWrapper::getName() const +00093 { +00094 return m_plugin->getName(); +00095 } +00096 +00097 std::string +00098 PluginWrapper::getDescription() const +00099 { +00100 return m_plugin->getDescription(); +00101 } +00102 +00103 std::string +00104 PluginWrapper::getMaker() const +00105 { +00106 return m_plugin->getMaker(); +00107 } +00108 +00109 int +00110 PluginWrapper::getPluginVersion() const +00111 { +00112 return m_plugin->getPluginVersion(); +00113 } +00114 +00115 std::string +00116 PluginWrapper::getCopyright() const +00117 { +00118 return m_plugin->getCopyright(); +00119 } +00120 +00121 PluginBase::ParameterList +00122 PluginWrapper::getParameterDescriptors() const +00123 { +00124 return m_plugin->getParameterDescriptors(); +00125 } +00126 +00127 float +00128 PluginWrapper::getParameter(std::string parameter) const +00129 { +00130 return m_plugin->getParameter(parameter); +00131 } +00132 +00133 void +00134 PluginWrapper::setParameter(std::string parameter, float value) +00135 { +00136 m_plugin->setParameter(parameter, value); +00137 } +00138 +00139 PluginBase::ProgramList +00140 PluginWrapper::getPrograms() const +00141 { +00142 return m_plugin->getPrograms(); +00143 } +00144 +00145 std::string +00146 PluginWrapper::getCurrentProgram() const +00147 { +00148 return m_plugin->getCurrentProgram(); +00149 } +00150 +00151 void +00152 PluginWrapper::selectProgram(std::string program) +00153 { +00154 m_plugin->selectProgram(program); +00155 } +00156 +00157 size_t +00158 PluginWrapper::getPreferredStepSize() const +00159 { +00160 return m_plugin->getPreferredStepSize(); +00161 } +00162 +00163 size_t +00164 PluginWrapper::getPreferredBlockSize() const +00165 { +00166 return m_plugin->getPreferredBlockSize(); +00167 } +00168 +00169 size_t +00170 PluginWrapper::getMinChannelCount() const +00171 { +00172 return m_plugin->getMinChannelCount(); +00173 } +00174 +00175 size_t PluginWrapper::getMaxChannelCount() const +00176 { +00177 return m_plugin->getMaxChannelCount(); +00178 } +00179 +00180 Plugin::OutputList +00181 PluginWrapper::getOutputDescriptors() const +00182 { +00183 return m_plugin->getOutputDescriptors(); +00184 } +00185 +00186 Plugin::FeatureSet +00187 PluginWrapper::process(const float *const *inputBuffers, RealTime timestamp) +00188 { +00189 return m_plugin->process(inputBuffers, timestamp); +00190 } +00191 +00192 Plugin::FeatureSet +00193 PluginWrapper::getRemainingFeatures() +00194 { +00195 return m_plugin->getRemainingFeatures(); +00196 } +00197 +00198 } +00199 +00200 } +00201 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
Classes | |
class | Vamp::HostExt::PluginRateExtractor |
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-2007 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 "vamp-sdk/Plugin.h" +00041 +00042 namespace Vamp { +00043 +00044 namespace HostExt { +00045 +00059 class PluginWrapper : public Plugin +00060 { +00061 public: +00062 virtual ~PluginWrapper(); +00063 +00064 bool initialise(size_t channels, size_t stepSize, size_t blockSize); +00065 void reset(); +00066 +00067 InputDomain getInputDomain() const; +00068 +00069 unsigned int getVampApiVersion() const; +00070 std::string getIdentifier() const; +00071 std::string getName() const; +00072 std::string getDescription() const; +00073 std::string getMaker() const; +00074 int getPluginVersion() const; +00075 std::string getCopyright() const; +00076 +00077 ParameterList getParameterDescriptors() const; +00078 float getParameter(std::string) const; +00079 void setParameter(std::string, float); +00080 +00081 ProgramList getPrograms() const; +00082 std::string getCurrentProgram() const; +00083 void selectProgram(std::string); +00084 +00085 size_t getPreferredStepSize() const; +00086 size_t getPreferredBlockSize() const; +00087 +00088 size_t getMinChannelCount() const; +00089 size_t getMaxChannelCount() const; +00090 +00091 OutputList getOutputDescriptors() const; +00092 +00093 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); +00094 +00095 FeatureSet getRemainingFeatures(); +00096 +00097 protected: +00098 PluginWrapper(Plugin *plugin); // I take ownership of plugin +00099 Plugin *m_plugin; +00100 }; +00101 +00102 } +00103 +00104 } +00105 +00106 #endif +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
namespace | Vamp::HostExt |
Classes | |
class | Vamp::HostExt::PluginWrapper |
PluginWrapper is a simple base class for adapter plugins. More... |
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_H_ +00038 #define _VAMP_PLUGIN_H_ +00039 +00040 #include "PluginBase.h" +00041 #include "RealTime.h" +00042 +00043 #include <string> +00044 #include <vector> +00045 #include <map> +00046 +00047 namespace Vamp { +00048 +00121 class Plugin : public PluginBase +00122 { +00123 public: +00124 virtual ~Plugin() { } +00125 +00138 virtual bool initialise(size_t inputChannels, +00139 size_t stepSize, +00140 size_t blockSize) = 0; +00141 +00147 virtual void reset() = 0; +00148 +00149 enum InputDomain { TimeDomain, FrequencyDomain }; +00150 +00161 virtual InputDomain getInputDomain() const = 0; +00162 +00171 virtual size_t getPreferredBlockSize() const { return 0; } +00172 +00186 virtual size_t getPreferredStepSize() const { return 0; } +00187 +00191 virtual size_t getMinChannelCount() const { return 1; } +00192 +00196 virtual size_t getMaxChannelCount() const { return 1; } +00197 +00198 struct OutputDescriptor +00199 { +00206 std::string identifier; +00207 +00212 std::string name; +00213 +00219 std::string description; +00220 +00224 std::string unit; +00225 +00231 bool hasFixedBinCount; +00232 +00239 size_t binCount; +00240 +00245 std::vector<std::string> binNames; +00246 +00252 bool hasKnownExtents; +00253 +00258 float minValue; +00259 +00264 float maxValue; +00265 +00270 bool isQuantized; +00271 +00277 float quantizeStep; +00278 +00279 enum SampleType { +00280 +00282 OneSamplePerStep, +00283 +00285 FixedSampleRate, +00286 +00288 VariableSampleRate +00289 }; +00290 +00294 SampleType sampleType; +00295 +00306 float sampleRate; +00307 }; +00308 +00309 typedef std::vector<OutputDescriptor> OutputList; +00310 +00316 virtual OutputList getOutputDescriptors() const = 0; +00317 +00318 struct Feature +00319 { +00325 bool hasTimestamp; +00326 +00332 RealTime timestamp; +00333 +00339 std::vector<float> values; +00340 +00344 std::string label; +00345 }; +00346 +00347 typedef std::vector<Feature> FeatureList; +00348 typedef std::map<int, FeatureList> FeatureSet; // key is output no +00349 +00377 virtual FeatureSet process(const float *const *inputBuffers, +00378 RealTime timestamp) = 0; +00379 +00384 virtual FeatureSet getRemainingFeatures() = 0; +00385 +00391 virtual std::string getType() const { return "Feature Extraction Plugin"; } +00392 +00393 protected: +00394 Plugin(float inputSampleRate) : +00395 m_inputSampleRate(inputSampleRate) { } +00396 +00397 float m_inputSampleRate; +00398 }; +00399 +00400 } +00401 +00402 #endif +00403 +00404 +00405 +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
Classes | |
class | Vamp::Plugin |
Vamp::Plugin is a base class for plugin instance classes that provide feature extraction from audio or related data. More... | |
struct | Vamp::Plugin::OutputDescriptor |
struct | Vamp::Plugin::Feature |
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 /* +00038 This is a modified version of a source file from the +00039 Rosegarden MIDI and audio sequencer and notation editor. +00040 This file copyright 2000-2006 Chris Cannam. +00041 Relicensed by the author as detailed above. +00042 */ +00043 +00044 #include <iostream> +00045 +00046 #if (__GNUC__ < 3) +00047 #include <strstream> +00048 #define stringstream strstream +00049 #else +00050 #include <sstream> +00051 #endif +00052 +00053 using std::cerr; +00054 using std::endl; +00055 +00056 #include "RealTime.h" +00057 +00058 #ifndef _WIN32 +00059 #include <sys/time.h> +00060 #endif +00061 +00062 namespace Vamp { +00063 +00064 // A RealTime consists of two ints that must be at least 32 bits each. +00065 // A signed 32-bit int can store values exceeding +/- 2 billion. This +00066 // means we can safely use our lower int for nanoseconds, as there are +00067 // 1 billion nanoseconds in a second and we need to handle double that +00068 // because of the implementations of addition etc that we use. +00069 // +00070 // The maximum valid RealTime on a 32-bit system is somewhere around +00071 // 68 years: 999999999 nanoseconds longer than the classic Unix epoch. +00072 +00073 #define ONE_BILLION 1000000000 +00074 +00075 RealTime::RealTime(int s, int n) : +00076 sec(s), nsec(n) +00077 { +00078 if (sec == 0) { +00079 while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } +00080 while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } +00081 } else if (sec < 0) { +00082 while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } +00083 while (nsec > 0) { nsec -= ONE_BILLION; ++sec; } +00084 } else { +00085 while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } +00086 while (nsec < 0) { nsec += ONE_BILLION; --sec; } +00087 } +00088 } +00089 +00090 RealTime +00091 RealTime::fromSeconds(double sec) +00092 { +00093 return RealTime(int(sec), int((sec - int(sec)) * ONE_BILLION + 0.5)); +00094 } +00095 +00096 RealTime +00097 RealTime::fromMilliseconds(int msec) +00098 { +00099 return RealTime(msec / 1000, (msec % 1000) * 1000000); +00100 } +00101 +00102 #ifndef _WIN32 +00103 RealTime +00104 RealTime::fromTimeval(const struct timeval &tv) +00105 { +00106 return RealTime(tv.tv_sec, tv.tv_usec * 1000); +00107 } +00108 #endif +00109 +00110 std::ostream &operator<<(std::ostream &out, const RealTime &rt) +00111 { +00112 if (rt < RealTime::zeroTime) { +00113 out << "-"; +00114 } else { +00115 out << " "; +00116 } +00117 +00118 int s = (rt.sec < 0 ? -rt.sec : rt.sec); +00119 int n = (rt.nsec < 0 ? -rt.nsec : rt.nsec); +00120 +00121 out << s << "."; +00122 +00123 int nn(n); +00124 if (nn == 0) out << "00000000"; +00125 else while (nn < (ONE_BILLION / 10)) { +00126 out << "0"; +00127 nn *= 10; +00128 } +00129 +00130 out << n << "R"; +00131 return out; +00132 } +00133 +00134 std::string +00135 RealTime::toString() const +00136 { +00137 std::stringstream out; +00138 out << *this; +00139 +00140 #if (__GNUC__ < 3) +00141 out << std::ends; +00142 #endif +00143 +00144 std::string s = out.str(); +00145 +00146 // remove trailing R +00147 return s.substr(0, s.length() - 1); +00148 } +00149 +00150 std::string +00151 RealTime::toText(bool fixedDp) const +00152 { +00153 if (*this < RealTime::zeroTime) return "-" + (-*this).toText(); +00154 +00155 std::stringstream out; +00156 +00157 if (sec >= 3600) { +00158 out << (sec / 3600) << ":"; +00159 } +00160 +00161 if (sec >= 60) { +00162 out << (sec % 3600) / 60 << ":"; +00163 } +00164 +00165 if (sec >= 10) { +00166 out << ((sec % 60) / 10); +00167 } +00168 +00169 out << (sec % 10); +00170 +00171 int ms = msec(); +00172 +00173 if (ms != 0) { +00174 out << "."; +00175 out << (ms / 100); +00176 ms = ms % 100; +00177 if (ms != 0) { +00178 out << (ms / 10); +00179 ms = ms % 10; +00180 } else if (fixedDp) { +00181 out << "0"; +00182 } +00183 if (ms != 0) { +00184 out << ms; +00185 } else if (fixedDp) { +00186 out << "0"; +00187 } +00188 } else if (fixedDp) { +00189 out << ".000"; +00190 } +00191 +00192 #if (__GNUC__ < 3) +00193 out << std::ends; +00194 #endif +00195 +00196 std::string s = out.str(); +00197 +00198 return s; +00199 } +00200 +00201 +00202 RealTime +00203 RealTime::operator/(int d) const +00204 { +00205 int secdiv = sec / d; +00206 int secrem = sec % d; +00207 +00208 double nsecdiv = (double(nsec) + ONE_BILLION * double(secrem)) / d; +00209 +00210 return RealTime(secdiv, int(nsecdiv + 0.5)); +00211 } +00212 +00213 double +00214 RealTime::operator/(const RealTime &r) const +00215 { +00216 double lTotal = double(sec) * ONE_BILLION + double(nsec); +00217 double rTotal = double(r.sec) * ONE_BILLION + double(r.nsec); +00218 +00219 if (rTotal == 0) return 0.0; +00220 else return lTotal/rTotal; +00221 } +00222 +00223 long +00224 RealTime::realTime2Frame(const RealTime &time, unsigned int sampleRate) +00225 { +00226 if (time < zeroTime) return -realTime2Frame(-time, sampleRate); +00227 double s = time.sec + double(time.nsec + 1) / 1000000000.0; +00228 return long(s * sampleRate); +00229 } +00230 +00231 RealTime +00232 RealTime::frame2RealTime(long frame, unsigned int sampleRate) +00233 { +00234 if (frame < 0) return -frame2RealTime(-frame, sampleRate); +00235 +00236 RealTime rt; +00237 rt.sec = frame / long(sampleRate); +00238 frame -= rt.sec * long(sampleRate); +00239 rt.nsec = (int)(((double(frame) * 1000000.0) / sampleRate) * 1000.0); +00240 return rt; +00241 } +00242 +00243 const RealTime RealTime::zeroTime(0,0); +00244 +00245 } +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
Defines | |
#define | stringstream strstream |
#define | ONE_BILLION 1000000000 |
Functions | |
std::ostream & | Vamp::operator<< (std::ostream &out, const RealTime &rt) |
#define stringstream strstream | +
+ +
Definition at line 48 of file RealTime.cpp.
+ +Referenced by Vamp::RealTime::toString(), and Vamp::RealTime::toText().
+ +#define ONE_BILLION 1000000000 | +
+ +
Definition at line 73 of file RealTime.cpp.
+ +Referenced by Vamp::RealTime::fromSeconds(), Vamp::RealTime::operator/(), Vamp::operator<<(), and Vamp::RealTime::RealTime().
+ ++
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 /* +00038 This is a modified version of a source file from the +00039 Rosegarden MIDI and audio sequencer and notation editor. +00040 This file copyright 2000-2006 Chris Cannam. +00041 Relicensed by the author as detailed above. +00042 */ +00043 +00044 #ifndef _VAMP_REAL_TIME_H_ +00045 #define _VAMP_REAL_TIME_H_ +00046 +00047 #include <iostream> +00048 #include <string> +00049 +00050 #ifndef _WIN32 +00051 struct timeval; +00052 #endif +00053 +00054 namespace Vamp { +00055 +00063 struct RealTime +00064 { +00065 int sec; +00066 int nsec; +00067 +00068 int usec() const { return nsec / 1000; } +00069 int msec() const { return nsec / 1000000; } +00070 +00071 RealTime(): sec(0), nsec(0) {} +00072 RealTime(int s, int n); +00073 +00074 RealTime(const RealTime &r) : +00075 sec(r.sec), nsec(r.nsec) { } +00076 +00077 static RealTime fromSeconds(double sec); +00078 static RealTime fromMilliseconds(int msec); +00079 +00080 #ifndef _WIN32 +00081 static RealTime fromTimeval(const struct timeval &); +00082 #endif +00083 +00084 RealTime &operator=(const RealTime &r) { +00085 sec = r.sec; nsec = r.nsec; return *this; +00086 } +00087 +00088 RealTime operator+(const RealTime &r) const { +00089 return RealTime(sec + r.sec, nsec + r.nsec); +00090 } +00091 RealTime operator-(const RealTime &r) const { +00092 return RealTime(sec - r.sec, nsec - r.nsec); +00093 } +00094 RealTime operator-() const { +00095 return RealTime(-sec, -nsec); +00096 } +00097 +00098 bool operator <(const RealTime &r) const { +00099 if (sec == r.sec) return nsec < r.nsec; +00100 else return sec < r.sec; +00101 } +00102 +00103 bool operator >(const RealTime &r) const { +00104 if (sec == r.sec) return nsec > r.nsec; +00105 else return sec > r.sec; +00106 } +00107 +00108 bool operator==(const RealTime &r) const { +00109 return (sec == r.sec && nsec == r.nsec); +00110 } +00111 +00112 bool operator!=(const RealTime &r) const { +00113 return !(r == *this); +00114 } +00115 +00116 bool operator>=(const RealTime &r) const { +00117 if (sec == r.sec) return nsec >= r.nsec; +00118 else return sec >= r.sec; +00119 } +00120 +00121 bool operator<=(const RealTime &r) const { +00122 if (sec == r.sec) return nsec <= r.nsec; +00123 else return sec <= r.sec; +00124 } +00125 +00126 RealTime operator/(int d) const; +00127 +00131 double operator/(const RealTime &r) const; +00132 +00137 std::string toString() const; +00138 +00143 std::string toText(bool fixedDp = false) const; +00144 +00148 static long realTime2Frame(const RealTime &r, unsigned int sampleRate); +00149 +00153 static RealTime frame2RealTime(long frame, unsigned int sampleRate); +00154 +00155 static const RealTime zeroTime; +00156 }; +00157 +00158 std::ostream &operator<<(std::ostream &out, const RealTime &rt); +00159 +00160 } +00161 +00162 #endif +
+ +
+Go to the source code of this file.
Namespaces | |
namespace | Vamp |
Classes | |
class | Vamp::RealTime |
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions. More... | |
Functions | |
std::ostream & | Vamp::operator<< (std::ostream &out, const RealTime &rt) |
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 <cmath> +00045 +00046 +00047 SpectralCentroid::SpectralCentroid(float inputSampleRate) : +00048 Plugin(inputSampleRate), +00049 m_stepSize(0), +00050 m_blockSize(0) +00051 { +00052 } +00053 +00054 SpectralCentroid::~SpectralCentroid() +00055 { +00056 } +00057 +00058 string +00059 SpectralCentroid::getIdentifier() const +00060 { +00061 return "spectralcentroid"; +00062 } +00063 +00064 string +00065 SpectralCentroid::getName() const +00066 { +00067 return "Spectral Centroid"; +00068 } +00069 +00070 string +00071 SpectralCentroid::getDescription() const +00072 { +00073 return "Calculate the centroid frequency of the spectrum of the input signal"; +00074 } +00075 +00076 string +00077 SpectralCentroid::getMaker() const +00078 { +00079 return "Vamp SDK Example Plugins"; +00080 } +00081 +00082 int +00083 SpectralCentroid::getPluginVersion() const +00084 { +00085 return 2; +00086 } +00087 +00088 string +00089 SpectralCentroid::getCopyright() const +00090 { +00091 return "Freely redistributable (BSD license)"; +00092 } +00093 +00094 bool +00095 SpectralCentroid::initialise(size_t channels, size_t stepSize, size_t blockSize) +00096 { +00097 if (channels < getMinChannelCount() || +00098 channels > getMaxChannelCount()) return false; +00099 +00100 m_stepSize = stepSize; +00101 m_blockSize = blockSize; +00102 +00103 return true; +00104 } +00105 +00106 void +00107 SpectralCentroid::reset() +00108 { +00109 } +00110 +00111 SpectralCentroid::OutputList +00112 SpectralCentroid::getOutputDescriptors() const +00113 { +00114 OutputList list; +00115 +00116 OutputDescriptor d; +00117 d.identifier = "logcentroid"; +00118 d.name = "Log Frequency Centroid"; +00119 d.description = "Centroid of the log weighted frequency spectrum"; +00120 d.unit = "Hz"; +00121 d.hasFixedBinCount = true; +00122 d.binCount = 1; +00123 d.hasKnownExtents = false; +00124 d.isQuantized = false; +00125 d.sampleType = OutputDescriptor::OneSamplePerStep; +00126 list.push_back(d); +00127 +00128 d.identifier = "linearcentroid"; +00129 d.name = "Linear Frequency Centroid"; +00130 d.description = "Centroid of the linear frequency spectrum"; +00131 list.push_back(d); +00132 +00133 return list; +00134 } +00135 +00136 SpectralCentroid::FeatureSet +00137 SpectralCentroid::process(const float *const *inputBuffers, Vamp::RealTime) +00138 { +00139 if (m_stepSize == 0) { +00140 cerr << "ERROR: SpectralCentroid::process: " +00141 << "SpectralCentroid has not been initialised" +00142 << endl; +00143 return FeatureSet(); +00144 } +00145 +00146 double numLin = 0.0, numLog = 0.0, denom = 0.0; +00147 +00148 for (size_t i = 1; i <= m_blockSize/2; ++i) { +00149 double freq = (double(i) * m_inputSampleRate) / m_blockSize; +00150 double real = inputBuffers[0][i*2]; +00151 double imag = inputBuffers[0][i*2 + 1]; +00152 double power = sqrt(real * real + imag * imag) / (m_blockSize/2); +00153 numLin += freq * power; +00154 numLog += log10f(freq) * power; +00155 denom += power; +00156 } +00157 +00158 FeatureSet returnFeatures; +00159 +00160 // std::cerr << "power " << denom << ", block size " << m_blockSize << std::endl; +00161 +00162 if (denom != 0.0) { +00163 float centroidLin = float(numLin / denom); +00164 float centroidLog = powf(10, float(numLog / denom)); +00165 +00166 Feature feature; +00167 feature.hasTimestamp = false; +00168 if (!std::isnan(centroidLog) && !std::isinf(centroidLog)) { +00169 feature.values.push_back(centroidLog); +00170 } +00171 returnFeatures[0].push_back(feature); +00172 +00173 feature.values.clear(); +00174 if (!std::isnan(centroidLin) && !std::isinf(centroidLin)) { +00175 feature.values.push_back(centroidLin); +00176 } +00177 returnFeatures[1].push_back(feature); +00178 } +00179 +00180 return returnFeatures; +00181 } +00182 +00183 SpectralCentroid::FeatureSet +00184 SpectralCentroid::getRemainingFeatures() +00185 { +00186 return FeatureSet(); +00187 } +00188 +
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 +
+ +
+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... |
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 +00045 ZeroCrossing::ZeroCrossing(float inputSampleRate) : +00046 Plugin(inputSampleRate), +00047 m_stepSize(0), +00048 m_previousSample(0.0f) +00049 { +00050 } +00051 +00052 ZeroCrossing::~ZeroCrossing() +00053 { +00054 } +00055 +00056 string +00057 ZeroCrossing::getIdentifier() const +00058 { +00059 return "zerocrossing"; +00060 } +00061 +00062 string +00063 ZeroCrossing::getName() const +00064 { +00065 return "Zero Crossings"; +00066 } +00067 +00068 string +00069 ZeroCrossing::getDescription() const +00070 { +00071 return "Detect and count zero crossing points"; +00072 } +00073 +00074 string +00075 ZeroCrossing::getMaker() const +00076 { +00077 return "Vamp SDK Example Plugins"; +00078 } +00079 +00080 int +00081 ZeroCrossing::getPluginVersion() const +00082 { +00083 return 2; +00084 } +00085 +00086 string +00087 ZeroCrossing::getCopyright() const +00088 { +00089 return "Freely redistributable (BSD license)"; +00090 } +00091 +00092 bool +00093 ZeroCrossing::initialise(size_t channels, size_t stepSize, size_t blockSize) +00094 { +00095 if (channels < getMinChannelCount() || +00096 channels > getMaxChannelCount()) return false; +00097 +00098 m_stepSize = std::min(stepSize, blockSize); +00099 +00100 return true; +00101 } +00102 +00103 void +00104 ZeroCrossing::reset() +00105 { +00106 m_previousSample = 0.0f; +00107 } +00108 +00109 ZeroCrossing::OutputList +00110 ZeroCrossing::getOutputDescriptors() const +00111 { +00112 OutputList list; +00113 +00114 OutputDescriptor zc; +00115 zc.identifier = "counts"; +00116 zc.name = "Zero Crossing Counts"; +00117 zc.description = "The number of zero crossing points per processing block"; +00118 zc.unit = "crossings"; +00119 zc.hasFixedBinCount = true; +00120 zc.binCount = 1; +00121 zc.hasKnownExtents = false; +00122 zc.isQuantized = true; +00123 zc.quantizeStep = 1.0; +00124 zc.sampleType = OutputDescriptor::OneSamplePerStep; +00125 list.push_back(zc); +00126 +00127 zc.identifier = "zerocrossings"; +00128 zc.name = "Zero Crossings"; +00129 zc.description = "The locations of zero crossing points"; +00130 zc.unit = ""; +00131 zc.hasFixedBinCount = true; +00132 zc.binCount = 0; +00133 zc.sampleType = OutputDescriptor::VariableSampleRate; +00134 zc.sampleRate = m_inputSampleRate; +00135 list.push_back(zc); +00136 +00137 return list; +00138 } +00139 +00140 ZeroCrossing::FeatureSet +00141 ZeroCrossing::process(const float *const *inputBuffers, +00142 Vamp::RealTime timestamp) +00143 { +00144 if (m_stepSize == 0) { +00145 cerr << "ERROR: ZeroCrossing::process: " +00146 << "ZeroCrossing has not been initialised" +00147 << endl; +00148 return FeatureSet(); +00149 } +00150 +00151 float prev = m_previousSample; +00152 size_t count = 0; +00153 +00154 FeatureSet returnFeatures; +00155 +00156 for (size_t i = 0; i < m_stepSize; ++i) { +00157 +00158 float sample = inputBuffers[0][i]; +00159 bool crossing = false; +00160 +00161 if (sample <= 0.0) { +00162 if (prev > 0.0) crossing = true; +00163 } else if (sample > 0.0) { +00164 if (prev <= 0.0) crossing = true; +00165 } +00166 +00167 if (crossing) { +00168 ++count; +00169 Feature feature; +00170 feature.hasTimestamp = true; +00171 feature.timestamp = timestamp + +00172 Vamp::RealTime::frame2RealTime(i, (size_t)m_inputSampleRate); +00173 returnFeatures[1].push_back(feature); +00174 } +00175 +00176 prev = sample; +00177 } +00178 +00179 m_previousSample = prev; +00180 +00181 Feature feature; +00182 feature.hasTimestamp = false; +00183 feature.values.push_back(count); +00184 +00185 returnFeatures[0].push_back(feature); +00186 return returnFeatures; +00187 } +00188 +00189 ZeroCrossing::FeatureSet +00190 ZeroCrossing::getRemainingFeatures() +00191 { +00192 return FeatureSet(); +00193 } +00194 +
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 +
+ +
+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... |
_VampFeature | |
_VampFeatureList | |
_VampOutputDescriptor | |
_VampParameterDescriptor | C language API for Vamp plugins |
_VampPluginDescriptor | |
AmplitudeFollower | Example plugin implementing the SuperCollider amplitude follower function |
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::Plugin::Feature | |
Vamp::Plugin::OutputDescriptor | |
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::PluginAdapterBase::Impl | |
Vamp::PluginBase | A base class for plugins with optional configurable parameters, programs, etc |
Vamp::PluginBase::ParameterDescriptor | |
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::PluginBufferingAdapter::Impl | |
Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer | |
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::HostExt::PluginChannelAdapter::Impl | |
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::PluginInputDomainAdapter::Impl | |
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::PluginLoader::Impl | |
Vamp::HostExt::PluginLoader::Impl::InstanceCleaner | |
Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter | |
Vamp::HostExt::PluginRateExtractor | |
Vamp::HostExt::PluginWrapper | PluginWrapper is a simple base class for adapter plugins |
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 |
#include <AmplitudeFollower.h>
++
Definition at line 47 of file 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 |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
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 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 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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 171 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 186 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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 191 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::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 196 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::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.
+ + + +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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +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 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ ++
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 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
#include <PercussionOnsetDetector.h>
++
Definition at line 46 of file 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 |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
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 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 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 281 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 191 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), initialise(), AmplitudeFollower::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 196 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), initialise(), AmplitudeFollower::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.
+ + + +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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +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 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ ++
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 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and process().
+ ++
#include <SpectralCentroid.h>
++
Definition at line 47 of file 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 |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
SpectralCentroid::SpectralCentroid | +( | +float | +inputSampleRate | +) | ++ |
+ +
Definition at line 47 of file SpectralCentroid.cpp.
+ +SpectralCentroid::~SpectralCentroid | +( | ++ | ) | + [virtual] |
+
+ +
Definition at line 54 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 95 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 107 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 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 59 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 65 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 71 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 77 of file SpectralCentroid.cpp.
+ +int SpectralCentroid::getPluginVersion | +( | ++ | ) | + const [virtual] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 83 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 89 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 112 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 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 137 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 184 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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 171 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 186 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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 191 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), ZeroCrossing::initialise(), initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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 196 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), ZeroCrossing::initialise(), initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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.
+ + + +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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | ++ | ) | + const [inline, virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 200 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getParameterDescriptors().
+ +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, and PercussionOnsetDetector.
+ +Definition at line 208 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getParameter().
+ +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::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 214 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::setParameter().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +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 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ ++
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 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), process(), and PercussionOnsetDetector::process().
+ ++
#include <vamp-sdk/hostext/PluginBufferingAdapter.h>
++
+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 72 of file 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) | |
virtual | ~PluginBufferingAdapter () |
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). | |
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. | |
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. | |
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 | 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. | |
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 |
Classes | |
class | Impl |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter | +( | +Plugin * | +plugin | +) | ++ |
+ +
Definition at line 238 of file PluginBufferingAdapter.cpp.
+ +References m_impl, and Vamp::Plugin::m_inputSampleRate.
+ +Vamp::HostExt::PluginBufferingAdapter::~PluginBufferingAdapter | +( | ++ | ) | + [virtual] |
+
+
bool Vamp::HostExt::PluginBufferingAdapter::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.
+ +Definition at line 250 of file PluginBufferingAdapter.cpp.
+ +References Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), and m_impl.
+ +size_t Vamp::HostExt::PluginBufferingAdapter::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.
+ +Definition at line 308 of file PluginBufferingAdapter.cpp.
+ +References Vamp::HostExt::PluginWrapper::getPreferredBlockSize().
+ +PluginBufferingAdapter::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.
+ +Definition at line 256 of file PluginBufferingAdapter.cpp.
+ +References Vamp::HostExt::PluginBufferingAdapter::Impl::getOutputDescriptors(), and m_impl.
+ +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.
+ +Definition at line 262 of file PluginBufferingAdapter.cpp.
+ +References m_impl, and Vamp::HostExt::PluginBufferingAdapter::Impl::reset().
+ +PluginBufferingAdapter::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 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.
+ +Definition at line 268 of file PluginBufferingAdapter.cpp.
+ +References m_impl, and Vamp::HostExt::PluginBufferingAdapter::Impl::process().
+ +PluginBufferingAdapter::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.
+ +Definition at line 275 of file PluginBufferingAdapter.cpp.
+ +References Vamp::HostExt::PluginBufferingAdapter::Impl::getRemainingFeatures(), and m_impl.
+ +Plugin::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 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.
+ +Definition at line 74 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getInputDomain(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the Vamp API compatibility level of the plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 80 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getVampApiVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 86 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getIdentifier(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 92 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getName(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 98 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getDescription(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 104 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getMaker(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 110 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPluginVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 116 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCopyright(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +PluginBase::ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 122 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameterDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 128 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameter(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 134 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::setParameter().
+ +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.
+ +Definition at line 140 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPrograms(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the current program. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 146 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCurrentProgram(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 152 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::selectProgram().
+ +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::PluginInputDomainAdapter.
+ +Definition at line 164 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredBlockSize(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +Referenced by getPreferredStepSize().
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the minimum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 170 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMinChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the maximum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 175 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ + + ++
Impl* Vamp::HostExt::PluginBufferingAdapter::m_impl [protected] |
+
+ +
Definition at line 91 of file PluginBufferingAdapter.h.
+ +Referenced by getOutputDescriptors(), getRemainingFeatures(), initialise(), PluginBufferingAdapter(), process(), reset(), and ~PluginBufferingAdapter().
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
+ +
Definition at line 99 of file PluginWrapper.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), Vamp::HostExt::PluginWrapper::getCurrentProgram(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::HostExt::PluginWrapper::getIdentifier(), Vamp::HostExt::PluginWrapper::getInputDomain(), Vamp::HostExt::PluginWrapper::getMaker(), Vamp::HostExt::PluginWrapper::getMaxChannelCount(), Vamp::HostExt::PluginWrapper::getMinChannelCount(), Vamp::HostExt::PluginWrapper::getName(), Vamp::HostExt::PluginWrapper::getOutputDescriptors(), Vamp::HostExt::PluginWrapper::getParameter(), Vamp::HostExt::PluginWrapper::getParameterDescriptors(), Vamp::HostExt::PluginWrapper::getPluginVersion(), Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginWrapper::getPrograms(), Vamp::HostExt::PluginWrapper::getRemainingFeatures(), Vamp::HostExt::PluginWrapper::getVampApiVersion(), Vamp::HostExt::PluginWrapper::initialise(), Vamp::HostExt::PluginWrapper::process(), Vamp::HostExt::PluginWrapper::reset(), Vamp::HostExt::PluginWrapper::selectProgram(), Vamp::HostExt::PluginWrapper::setParameter(), Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter(), and Vamp::HostExt::PluginWrapper::~PluginWrapper().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
Definition at line 50 of file PluginBufferingAdapter.cpp.
+Public Member Functions | |
Impl (Plugin *plugin, float inputSampleRate) | |
~Impl () | |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
OutputList | getOutputDescriptors () const |
void | reset () |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
FeatureSet | getRemainingFeatures () |
Protected Member Functions | |
void | processBlock (FeatureSet &allFeatureSets) |
Protected Attributes | |
Plugin * | m_plugin |
size_t | m_inputStepSize |
size_t | m_inputBlockSize |
size_t | m_stepSize |
size_t | m_blockSize |
size_t | m_channels |
vector< RingBuffer * > | m_queue |
float ** | m_buffers |
float | m_inputSampleRate |
long | m_frame |
bool | m_unrun |
OutputList | m_outputs |
std::map< int, bool > | m_rewriteOutputTimes |
Classes | |
class | RingBuffer |
Vamp::HostExt::PluginBufferingAdapter::Impl::Impl | +( | +Plugin * | +plugin, | +|
+ | + | float | +inputSampleRate | + |
+ | ) | ++ |
+ +
Definition at line 280 of file PluginBufferingAdapter.cpp.
+ +References getOutputDescriptors().
+ +Vamp::HostExt::PluginBufferingAdapter::Impl::~Impl | +( | ++ | ) | ++ |
+ +
Definition at line 296 of file PluginBufferingAdapter.cpp.
+ +References m_buffers, m_channels, and m_queue.
+ ++
bool Vamp::HostExt::PluginBufferingAdapter::Impl::initialise | +( | +size_t | +channels, | +|
+ | + | size_t | +stepSize, | +|
+ | + | size_t | +blockSize | + |
+ | ) | ++ |
+ +
Definition at line 314 of file PluginBufferingAdapter.cpp.
+ +References Vamp::Plugin::FrequencyDomain, Vamp::Plugin::getInputDomain(), Vamp::Plugin::getPreferredBlockSize(), Vamp::Plugin::getPreferredStepSize(), Vamp::Plugin::initialise(), m_blockSize, m_buffers, m_channels, m_inputBlockSize, m_inputStepSize, m_plugin, m_queue, and m_stepSize.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::initialise().
+ +PluginBufferingAdapter::OutputList Vamp::HostExt::PluginBufferingAdapter::Impl::getOutputDescriptors | +( | ++ | ) | +const | +
+ +
Definition at line 367 of file PluginBufferingAdapter.cpp.
+ +References Vamp::Plugin::OutputDescriptor::FixedSampleRate, Vamp::Plugin::getOutputDescriptors(), m_inputSampleRate, m_outputs, m_plugin, m_rewriteOutputTimes, m_stepSize, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::getOutputDescriptors(), and Impl().
+ +void Vamp::HostExt::PluginBufferingAdapter::Impl::reset | +( | ++ | ) | ++ |
+ +
Definition at line 406 of file PluginBufferingAdapter.cpp.
+ +References m_frame, m_queue, and m_unrun.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::reset().
+ +PluginBufferingAdapter::FeatureSet Vamp::HostExt::PluginBufferingAdapter::Impl::process | +( | +const float *const * | +inputBuffers, | +|
+ | + | RealTime | +timestamp | + |
+ | ) | ++ |
+ +
Definition at line 417 of file PluginBufferingAdapter.cpp.
+ +References m_blockSize, m_channels, m_frame, m_inputBlockSize, m_inputSampleRate, m_queue, m_stepSize, m_unrun, processBlock(), and Vamp::RealTime::realTime2Frame().
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::process().
+ +PluginBufferingAdapter::FeatureSet Vamp::HostExt::PluginBufferingAdapter::Impl::getRemainingFeatures | +( | ++ | ) | ++ |
+ +
Definition at line 452 of file PluginBufferingAdapter.cpp.
+ +References Vamp::Plugin::getRemainingFeatures(), m_blockSize, m_channels, m_plugin, m_queue, and processBlock().
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::getRemainingFeatures().
+ +void Vamp::HostExt::PluginBufferingAdapter::Impl::processBlock | +( | +FeatureSet & | +allFeatureSets | +) | + [protected] |
+
+ +
Definition at line 485 of file PluginBufferingAdapter.cpp.
+ +References Vamp::Plugin::OutputDescriptor::FixedSampleRate, Vamp::RealTime::frame2RealTime(), m_blockSize, m_buffers, m_channels, m_frame, m_inputSampleRate, m_outputs, m_plugin, m_queue, m_rewriteOutputTimes, m_stepSize, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::process(), and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +Referenced by getRemainingFeatures(), and process().
+ ++
Plugin* Vamp::HostExt::PluginBufferingAdapter::Impl::m_plugin [protected] |
+
+ +
Definition at line 221 of file PluginBufferingAdapter.cpp.
+ +Referenced by getOutputDescriptors(), getRemainingFeatures(), initialise(), and processBlock().
+ +size_t Vamp::HostExt::PluginBufferingAdapter::Impl::m_inputStepSize [protected] |
+
+ +
Definition at line 222 of file PluginBufferingAdapter.cpp.
+ +Referenced by initialise().
+ +size_t Vamp::HostExt::PluginBufferingAdapter::Impl::m_inputBlockSize [protected] |
+
+ +
Definition at line 223 of file PluginBufferingAdapter.cpp.
+ +Referenced by initialise(), and process().
+ +size_t Vamp::HostExt::PluginBufferingAdapter::Impl::m_stepSize [protected] |
+
+ +
Definition at line 224 of file PluginBufferingAdapter.cpp.
+ +Referenced by getOutputDescriptors(), initialise(), process(), and processBlock().
+ +size_t Vamp::HostExt::PluginBufferingAdapter::Impl::m_blockSize [protected] |
+
+ +
Definition at line 225 of file PluginBufferingAdapter.cpp.
+ +Referenced by getRemainingFeatures(), initialise(), process(), and processBlock().
+ +size_t Vamp::HostExt::PluginBufferingAdapter::Impl::m_channels [protected] |
+
+ +
Definition at line 226 of file PluginBufferingAdapter.cpp.
+ +Referenced by getRemainingFeatures(), initialise(), process(), processBlock(), and ~Impl().
+ +vector<RingBuffer *> Vamp::HostExt::PluginBufferingAdapter::Impl::m_queue [protected] |
+
+ +
Definition at line 227 of file PluginBufferingAdapter.cpp.
+ +Referenced by getRemainingFeatures(), initialise(), process(), processBlock(), reset(), and ~Impl().
+ +float** Vamp::HostExt::PluginBufferingAdapter::Impl::m_buffers [protected] |
+
+ +
Definition at line 228 of file PluginBufferingAdapter.cpp.
+ +Referenced by initialise(), processBlock(), and ~Impl().
+ +float Vamp::HostExt::PluginBufferingAdapter::Impl::m_inputSampleRate [protected] |
+
+ +
Definition at line 229 of file PluginBufferingAdapter.cpp.
+ +Referenced by getOutputDescriptors(), process(), and processBlock().
+ +long Vamp::HostExt::PluginBufferingAdapter::Impl::m_frame [protected] |
+
+ +
Definition at line 230 of file PluginBufferingAdapter.cpp.
+ +Referenced by process(), processBlock(), and reset().
+ +bool Vamp::HostExt::PluginBufferingAdapter::Impl::m_unrun [protected] |
+
+ +
Definition at line 231 of file PluginBufferingAdapter.cpp.
+ + + +OutputList Vamp::HostExt::PluginBufferingAdapter::Impl::m_outputs [mutable, protected] |
+
+ +
Definition at line 232 of file PluginBufferingAdapter.cpp.
+ +Referenced by getOutputDescriptors(), and processBlock().
+ +std::map<int, bool> Vamp::HostExt::PluginBufferingAdapter::Impl::m_rewriteOutputTimes [mutable, protected] |
+
+ +
Definition at line 233 of file PluginBufferingAdapter.cpp.
+ +Referenced by getOutputDescriptors(), and processBlock().
+ ++
Definition at line 67 of file PluginBufferingAdapter.cpp.
+Public Member Functions | |
RingBuffer (int n) | |
virtual | ~RingBuffer () |
int | getSize () const |
void | reset () |
int | getReadSpace () const |
int | getWriteSpace () const |
int | peek (float *destination, int n) const |
int | skip (int n) |
int | write (const float *source, int n) |
int | zero (int n) |
Protected Attributes | |
float * | m_buffer |
int | m_writer |
int | m_reader |
int | m_size |
Private Member Functions | |
RingBuffer (const RingBuffer &) | |
RingBuffer & | operator= (const RingBuffer &) |
Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::RingBuffer | +( | +int | +n | +) | + [inline] |
+
+ +
Definition at line 70 of file PluginBufferingAdapter.cpp.
+ +virtual Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::~RingBuffer | +( | ++ | ) | + [inline, virtual] |
+
Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::RingBuffer | +( | +const RingBuffer & | ++ | ) | + [private] |
+
+ +
+
int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::getSize | +( | ++ | ) | + const [inline] |
+
void Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::reset | +( | ++ | ) | + [inline] |
+
+ +
Definition at line 75 of file PluginBufferingAdapter.cpp.
+ + + +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::getReadSpace | +( | ++ | ) | + const [inline] |
+
int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::getWriteSpace | +( | ++ | ) | + const [inline] |
+
int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::peek | +( | +float * | +destination, | +|
+ | + | int | +n | + |
+ | ) | + const [inline] |
+
+ +
Definition at line 93 of file PluginBufferingAdapter.cpp.
+ +References getReadSpace(), m_buffer, m_reader, and m_size.
+ +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::skip | +( | +int | +n | +) | + [inline] |
+
+ +
Definition at line 127 of file PluginBufferingAdapter.cpp.
+ +References getReadSpace(), m_reader, and m_size.
+ +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::write | +( | +const float * | +source, | +|
+ | + | int | +n | + |
+ | ) | + [inline] |
+
+ +
Definition at line 142 of file PluginBufferingAdapter.cpp.
+ +References getWriteSpace(), m_buffer, m_size, and m_writer.
+ +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::zero | +( | +int | +n | +) | + [inline] |
+
+ +
Definition at line 177 of file PluginBufferingAdapter.cpp.
+ +References getWriteSpace(), m_buffer, m_size, and m_writer.
+ +RingBuffer& Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::operator= | +( | +const RingBuffer & | ++ | ) | + [private] |
+
+ +
+
float* Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::m_buffer [protected] |
+
+ +
Definition at line 211 of file PluginBufferingAdapter.cpp.
+ +Referenced by peek(), write(), zero(), and ~RingBuffer().
+ +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::m_writer [protected] |
+
+ +
Definition at line 212 of file PluginBufferingAdapter.cpp.
+ +Referenced by getReadSpace(), getWriteSpace(), reset(), write(), and zero().
+ +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::m_reader [protected] |
+
+ +
Definition at line 213 of file PluginBufferingAdapter.cpp.
+ +Referenced by getReadSpace(), getWriteSpace(), peek(), reset(), and skip().
+ +int Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer::m_size [protected] |
+
+ +
Definition at line 214 of file PluginBufferingAdapter.cpp.
+ +Referenced by getReadSpace(), getSize(), getWriteSpace(), peek(), skip(), write(), and zero().
+ ++
#include <vamp-sdk/hostext/PluginChannelAdapter.h>
++
+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 109 of file 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) | |
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. | |
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. | |
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 |
Classes | |
class | Impl |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::HostExt::PluginChannelAdapter::PluginChannelAdapter | +( | +Plugin * | +plugin | +) | ++ |
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.
+ +Definition at line 74 of file PluginChannelAdapter.cpp.
+ +References Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), and m_impl.
+ +PluginChannelAdapter::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 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.
+ +Definition at line 80 of file PluginChannelAdapter.cpp.
+ +References m_impl, and Vamp::HostExt::PluginChannelAdapter::Impl::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.
+ +Definition at line 68 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::Plugin::reset().
+ +Plugin::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 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.
+ +Definition at line 74 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getInputDomain(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the Vamp API compatibility level of the plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 80 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getVampApiVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 86 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getIdentifier(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 92 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getName(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 98 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getDescription(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 104 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getMaker(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 110 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPluginVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 116 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCopyright(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +PluginBase::ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 122 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameterDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 128 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameter(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 134 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::setParameter().
+ +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.
+ +Definition at line 140 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPrograms(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the current program. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 146 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCurrentProgram(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 152 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::selectProgram().
+ +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::PluginBufferingAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 158 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredStepSize(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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::PluginInputDomainAdapter.
+ +Definition at line 164 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredBlockSize(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::getPreferredStepSize().
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the minimum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 170 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMinChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the maximum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 175 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 181 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getOutputDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +Plugin::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.
+ +Definition at line 193 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getRemainingFeatures(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ + + ++
Impl* Vamp::HostExt::PluginChannelAdapter::m_impl [protected] |
+
+ +
Definition at line 120 of file PluginChannelAdapter.h.
+ +Referenced by initialise(), PluginChannelAdapter(), process(), and ~PluginChannelAdapter().
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
+ +
Definition at line 99 of file PluginWrapper.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), Vamp::HostExt::PluginWrapper::getCurrentProgram(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::HostExt::PluginWrapper::getIdentifier(), Vamp::HostExt::PluginWrapper::getInputDomain(), Vamp::HostExt::PluginWrapper::getMaker(), Vamp::HostExt::PluginWrapper::getMaxChannelCount(), Vamp::HostExt::PluginWrapper::getMinChannelCount(), Vamp::HostExt::PluginWrapper::getName(), Vamp::HostExt::PluginWrapper::getOutputDescriptors(), Vamp::HostExt::PluginWrapper::getParameter(), Vamp::HostExt::PluginWrapper::getParameterDescriptors(), Vamp::HostExt::PluginWrapper::getPluginVersion(), Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginWrapper::getPrograms(), Vamp::HostExt::PluginWrapper::getRemainingFeatures(), Vamp::HostExt::PluginWrapper::getVampApiVersion(), Vamp::HostExt::PluginWrapper::initialise(), Vamp::HostExt::PluginWrapper::process(), Vamp::HostExt::PluginWrapper::reset(), Vamp::HostExt::PluginWrapper::selectProgram(), Vamp::HostExt::PluginWrapper::setParameter(), Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter(), and Vamp::HostExt::PluginWrapper::~PluginWrapper().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
Impl(Plugin *plugin) | Vamp::HostExt::PluginChannelAdapter::Impl | |
initialise(size_t channels, size_t stepSize, size_t blockSize) | Vamp::HostExt::PluginChannelAdapter::Impl | |
m_blockSize | Vamp::HostExt::PluginChannelAdapter::Impl | [protected] |
m_buffer | Vamp::HostExt::PluginChannelAdapter::Impl | [protected] |
m_forwardPtrs | Vamp::HostExt::PluginChannelAdapter::Impl | [protected] |
m_inputChannels | Vamp::HostExt::PluginChannelAdapter::Impl | [protected] |
m_plugin | Vamp::HostExt::PluginChannelAdapter::Impl | [protected] |
m_pluginChannels | Vamp::HostExt::PluginChannelAdapter::Impl | [protected] |
process(const float *const *inputBuffers, RealTime timestamp) | Vamp::HostExt::PluginChannelAdapter::Impl | |
~Impl() | Vamp::HostExt::PluginChannelAdapter::Impl |
Definition at line 43 of file PluginChannelAdapter.cpp.
+Public Member Functions | |
Impl (Plugin *plugin) | |
~Impl () | |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Protected Attributes | |
Plugin * | m_plugin |
size_t | m_blockSize |
size_t | m_inputChannels |
size_t | m_pluginChannels |
float ** | m_buffer |
const float ** | m_forwardPtrs |
Vamp::HostExt::PluginChannelAdapter::Impl::Impl | +( | +Plugin * | +plugin | +) | ++ |
+ +
Definition at line 86 of file PluginChannelAdapter.cpp.
+ +Vamp::HostExt::PluginChannelAdapter::Impl::~Impl | +( | ++ | ) | ++ |
+ +
Definition at line 96 of file PluginChannelAdapter.cpp.
+ +References m_buffer, m_forwardPtrs, m_inputChannels, and m_pluginChannels.
+ ++
bool Vamp::HostExt::PluginChannelAdapter::Impl::initialise | +( | +size_t | +channels, | +|
+ | + | size_t | +stepSize, | +|
+ | + | size_t | +blockSize | + |
+ | ) | ++ |
+ +
Definition at line 119 of file PluginChannelAdapter.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), Vamp::Plugin::initialise(), m_blockSize, m_buffer, m_forwardPtrs, m_inputChannels, m_plugin, and m_pluginChannels.
+ +Referenced by Vamp::HostExt::PluginChannelAdapter::initialise().
+ +PluginChannelAdapter::FeatureSet Vamp::HostExt::PluginChannelAdapter::Impl::process | +( | +const float *const * | +inputBuffers, | +|
+ | + | RealTime | +timestamp | + |
+ | ) | ++ |
+ +
Definition at line 177 of file PluginChannelAdapter.cpp.
+ +References m_blockSize, m_buffer, m_forwardPtrs, m_inputChannels, m_plugin, m_pluginChannels, and Vamp::Plugin::process().
+ +Referenced by Vamp::HostExt::PluginChannelAdapter::process().
+ ++
Plugin* Vamp::HostExt::PluginChannelAdapter::Impl::m_plugin [protected] |
+
+ +
Definition at line 54 of file PluginChannelAdapter.cpp.
+ +Referenced by initialise(), and process().
+ +size_t Vamp::HostExt::PluginChannelAdapter::Impl::m_blockSize [protected] |
+
+ +
Definition at line 55 of file PluginChannelAdapter.cpp.
+ +Referenced by initialise(), and process().
+ +size_t Vamp::HostExt::PluginChannelAdapter::Impl::m_inputChannels [protected] |
+
+ +
Definition at line 56 of file PluginChannelAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +size_t Vamp::HostExt::PluginChannelAdapter::Impl::m_pluginChannels [protected] |
+
+ +
Definition at line 57 of file PluginChannelAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +float** Vamp::HostExt::PluginChannelAdapter::Impl::m_buffer [protected] |
+
+ +
Definition at line 58 of file PluginChannelAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +const float** Vamp::HostExt::PluginChannelAdapter::Impl::m_forwardPtrs [protected] |
+
+ +
Definition at line 59 of file PluginChannelAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ ++
#include <vamp-sdk/hostext/PluginInputDomainAdapter.h>
++
+This permits a host to use time- and frequency-domain plugins interchangeably without needing to handle the conversion itself.
+This adapter uses a basic Hanning windowed FFT 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.
+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 79 of file PluginInputDomainAdapter.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 | |
PluginInputDomainAdapter (Plugin *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). | |
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 | reset () |
Reset the plugin after use, to prepare it for another clean run. | |
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. | |
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 |
Classes | |
class | Impl |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter | +( | +Plugin * | +plugin | +) | ++ |
+ +
Definition at line 113 of file PluginInputDomainAdapter.cpp.
+ +References m_impl, and Vamp::Plugin::m_inputSampleRate.
+ +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.
+ +Definition at line 125 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise(), and m_impl.
+ +Plugin::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 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.
+ +Definition at line 131 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::Plugin::TimeDomain.
+ +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.
+ +Definition at line 137 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), and m_impl.
+ +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.
+ +Definition at line 143 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), and m_impl.
+ +Plugin::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 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.
+ +Definition at line 149 of file PluginInputDomainAdapter.cpp.
+ +References m_impl, and Vamp::HostExt::PluginInputDomainAdapter::Impl::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.
+ +Definition at line 68 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::Plugin::reset().
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the Vamp API compatibility level of the plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 80 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getVampApiVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 86 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getIdentifier(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 92 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getName(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 98 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getDescription(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 104 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getMaker(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 110 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPluginVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 116 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCopyright(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +PluginBase::ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 122 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameterDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 128 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameter(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 134 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::setParameter().
+ +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.
+ +Definition at line 140 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPrograms(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the current program. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 146 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCurrentProgram(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 152 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::selectProgram().
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the minimum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 170 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMinChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the maximum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 175 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 181 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getOutputDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +Plugin::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.
+ +Definition at line 193 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getRemainingFeatures(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ + + ++
Impl* Vamp::HostExt::PluginInputDomainAdapter::m_impl [protected] |
+
+ +
Definition at line 95 of file PluginInputDomainAdapter.h.
+ +Referenced by getPreferredBlockSize(), getPreferredStepSize(), initialise(), PluginInputDomainAdapter(), process(), and ~PluginInputDomainAdapter().
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
+ +
Definition at line 99 of file PluginWrapper.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), Vamp::HostExt::PluginWrapper::getCurrentProgram(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::HostExt::PluginWrapper::getIdentifier(), Vamp::HostExt::PluginWrapper::getInputDomain(), Vamp::HostExt::PluginWrapper::getMaker(), Vamp::HostExt::PluginWrapper::getMaxChannelCount(), Vamp::HostExt::PluginWrapper::getMinChannelCount(), Vamp::HostExt::PluginWrapper::getName(), Vamp::HostExt::PluginWrapper::getOutputDescriptors(), Vamp::HostExt::PluginWrapper::getParameter(), Vamp::HostExt::PluginWrapper::getParameterDescriptors(), Vamp::HostExt::PluginWrapper::getPluginVersion(), Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginWrapper::getPrograms(), Vamp::HostExt::PluginWrapper::getRemainingFeatures(), Vamp::HostExt::PluginWrapper::getVampApiVersion(), Vamp::HostExt::PluginWrapper::initialise(), Vamp::HostExt::PluginWrapper::process(), Vamp::HostExt::PluginWrapper::reset(), Vamp::HostExt::PluginWrapper::selectProgram(), Vamp::HostExt::PluginWrapper::setParameter(), Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter(), and Vamp::HostExt::PluginWrapper::~PluginWrapper().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
Definition at line 77 of file PluginInputDomainAdapter.cpp.
+Public Member Functions | |
Impl (Plugin *plugin, float inputSampleRate) | |
~Impl () | |
bool | initialise (size_t channels, size_t stepSize, size_t blockSize) |
size_t | getPreferredStepSize () const |
size_t | getPreferredBlockSize () const |
FeatureSet | process (const float *const *inputBuffers, RealTime timestamp) |
Protected Member Functions | |
void | fft (unsigned int n, bool inverse, double *ri, double *ii, double *ro, double *io) |
size_t | makeBlockSizeAcceptable (size_t) const |
Protected Attributes | |
Plugin * | m_plugin |
float | m_inputSampleRate |
int | m_channels |
int | m_blockSize |
float ** | m_freqbuf |
double * | m_ri |
double * | m_window |
double * | m_ro |
double * | m_io |
Vamp::HostExt::PluginInputDomainAdapter::Impl::Impl | +( | +Plugin * | +plugin, | +|
+ | + | float | +inputSampleRate | + |
+ | ) | ++ |
+ +
Definition at line 154 of file PluginInputDomainAdapter.cpp.
+ +Vamp::HostExt::PluginInputDomainAdapter::Impl::~Impl | +( | ++ | ) | ++ |
+ +
Definition at line 172 of file PluginInputDomainAdapter.cpp.
+ +References m_channels, m_freqbuf, m_io, m_ri, m_ro, and m_window.
+ ++
bool Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise | +( | +size_t | +channels, | +|
+ | + | size_t | +stepSize, | +|
+ | + | size_t | +blockSize | + |
+ | ) | ++ |
+ +
Definition at line 203 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::Plugin::getInputDomain(), Vamp::Plugin::initialise(), m_blockSize, m_channels, m_freqbuf, m_io, M_PI, m_plugin, m_ri, m_ro, m_window, and Vamp::Plugin::TimeDomain.
+ +Referenced by Vamp::HostExt::PluginInputDomainAdapter::initialise().
+ +size_t Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize | +( | ++ | ) | +const | +
+ +
Definition at line 271 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::Plugin::FrequencyDomain, Vamp::Plugin::getInputDomain(), getPreferredBlockSize(), Vamp::Plugin::getPreferredStepSize(), and m_plugin.
+ +Referenced by Vamp::HostExt::PluginInputDomainAdapter::getPreferredStepSize().
+ +size_t Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize | +( | ++ | ) | +const | +
+ +
Definition at line 283 of file PluginInputDomainAdapter.cpp.
+ +References Vamp::Plugin::FrequencyDomain, Vamp::Plugin::getInputDomain(), Vamp::Plugin::getPreferredBlockSize(), m_plugin, and makeBlockSizeAcceptable().
+ +Referenced by Vamp::HostExt::PluginInputDomainAdapter::getPreferredBlockSize(), and getPreferredStepSize().
+ +Plugin::FeatureSet Vamp::HostExt::PluginInputDomainAdapter::Impl::process | +( | +const float *const * | +inputBuffers, | +|
+ | + | RealTime | +timestamp | + |
+ | ) | ++ |
+ +
Definition at line 342 of file PluginInputDomainAdapter.cpp.
+ +References fft(), Vamp::RealTime::frame2RealTime(), Vamp::Plugin::getInputDomain(), m_blockSize, m_channels, m_freqbuf, m_inputSampleRate, m_io, m_plugin, m_ri, m_ro, m_window, Vamp::Plugin::process(), and Vamp::Plugin::TimeDomain.
+ +Referenced by Vamp::HostExt::PluginInputDomainAdapter::process().
+ +void Vamp::HostExt::PluginInputDomainAdapter::Impl::fft | +( | +unsigned int | +n, | +|
+ | + | bool | +inverse, | +|
+ | + | double * | +ri, | +|
+ | + | double * | +ii, | +|
+ | + | double * | +ro, | +|
+ | + | double * | +io | + |
+ | ) | + [protected] |
+
+ +
Definition at line 438 of file PluginInputDomainAdapter.cpp.
+ +References M_PI.
+ +Referenced by process().
+ +size_t Vamp::HostExt::PluginInputDomainAdapter::Impl::makeBlockSizeAcceptable | +( | +size_t | +blockSize | +) | + const [protected] |
+
+ +
Definition at line 299 of file PluginInputDomainAdapter.cpp.
+ +Referenced by getPreferredBlockSize().
+ ++
Plugin* Vamp::HostExt::PluginInputDomainAdapter::Impl::m_plugin [protected] |
+
+ +
Definition at line 91 of file PluginInputDomainAdapter.cpp.
+ +Referenced by getPreferredBlockSize(), getPreferredStepSize(), initialise(), and process().
+ +float Vamp::HostExt::PluginInputDomainAdapter::Impl::m_inputSampleRate [protected] |
+
int Vamp::HostExt::PluginInputDomainAdapter::Impl::m_channels [protected] |
+
+ +
Definition at line 93 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +int Vamp::HostExt::PluginInputDomainAdapter::Impl::m_blockSize [protected] |
+
+ +
Definition at line 94 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), and process().
+ +float** Vamp::HostExt::PluginInputDomainAdapter::Impl::m_freqbuf [protected] |
+
+ +
Definition at line 95 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +double* Vamp::HostExt::PluginInputDomainAdapter::Impl::m_ri [protected] |
+
+ +
Definition at line 97 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +double* Vamp::HostExt::PluginInputDomainAdapter::Impl::m_window [protected] |
+
+ +
Definition at line 98 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +double* Vamp::HostExt::PluginInputDomainAdapter::Impl::m_ro [protected] |
+
+ +
Definition at line 104 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ +double* Vamp::HostExt::PluginInputDomainAdapter::Impl::m_io [protected] |
+
+ +
Definition at line 105 of file PluginInputDomainAdapter.cpp.
+ +Referenced by initialise(), process(), and ~Impl().
+ ++
#include <vamp-sdk/hostext/PluginLoader.h>
++ +
+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 69 of file 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 = 0 |
Classes | |
class | Impl |
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 98 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 104 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 116 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 166 of file PluginLoader.h.
+ ++
Vamp::HostExt::PluginLoader::PluginLoader | +( | ++ | ) | + [protected] |
+
+ +
Definition at line 141 of file PluginLoader.cpp.
+ +References m_impl.
+ +Referenced by getInstance().
+ +Vamp::HostExt::PluginLoader::~PluginLoader | +( | ++ | ) | + [protected, virtual] |
+
+
PluginLoader * Vamp::HostExt::PluginLoader::getInstance | +( | ++ | ) | + [static] |
+
+Obtain a pointer to the singleton instance of PluginLoader. +
+Use this to obtain your loader object. +
Definition at line 152 of file PluginLoader.cpp.
+ +References m_instance, PluginLoader(), and Vamp::HostExt::PluginLoader::Impl::setInstanceToClean().
+ +vector< PluginLoader::PluginKey > Vamp::HostExt::PluginLoader::listPlugins | +( | ++ | ) | ++ |
+Search for all available Vamp plugins, and return a list of them in the order in which they were found. +
+ +
Definition at line 165 of file PluginLoader.cpp.
+ +References Vamp::HostExt::PluginLoader::Impl::listPlugins(), and m_impl.
+ +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. |
Definition at line 171 of file PluginLoader.cpp.
+ +References Vamp::HostExt::PluginLoader::Impl::loadPlugin(), and m_impl.
+ +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().
+ +PluginLoader::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.
+
Definition at line 185 of file PluginLoader.cpp.
+ +References Vamp::HostExt::PluginLoader::Impl::getPluginCategory(), and m_impl.
+ +Referenced by enumeratePlugins(), and printPluginCategoryList().
+ +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). +
+ +
Definition at line 191 of file PluginLoader.cpp.
+ +References Vamp::HostExt::PluginLoader::Impl::getLibraryPathForPlugin(), and m_impl.
+ +Referenced by enumeratePlugins().
+ ++
Impl* Vamp::HostExt::PluginLoader::m_impl [protected] |
+
+ +
Definition at line 227 of file PluginLoader.h.
+ +Referenced by getLibraryPathForPlugin(), getPluginCategory(), listPlugins(), loadPlugin(), PluginLoader(), and ~PluginLoader().
+ +PluginLoader * Vamp::HostExt::PluginLoader::m_instance = 0 [static, protected] |
+
+
Definition at line 73 of file PluginLoader.cpp.
+Public Member Functions | |
Impl () | |
virtual | ~Impl () |
PluginKeyList | listPlugins () |
Plugin * | loadPlugin (PluginKey key, float inputSampleRate, int adapterFlags) |
PluginKey | composePluginKey (string libraryName, string identifier) |
PluginCategoryHierarchy | getPluginCategory (PluginKey key) |
string | getLibraryPathForPlugin (PluginKey key) |
Static Public Member Functions | |
static void | setInstanceToClean (PluginLoader *instance) |
Protected Member Functions | |
virtual void | pluginDeleted (PluginDeletionNotifyAdapter *adapter) |
void | enumeratePlugins (PluginKey forPlugin="") |
void | generateTaxonomy () |
bool | decomposePluginKey (PluginKey key, string &libraryName, string &identifier) |
void * | loadLibrary (string path) |
void | unloadLibrary (void *handle) |
void * | lookupInLibrary (void *handle, const char *symbol) |
string | splicePath (string a, string b) |
vector< string > | listFiles (string dir, string ext) |
Protected Attributes | |
map< PluginKey, string > | m_pluginLibraryNameMap |
bool | m_allPluginsEnumerated |
map< PluginKey, +PluginCategoryHierarchy > | m_taxonomy |
map< Plugin *, void * > | m_pluginLibraryHandleMap |
Static Protected Attributes | |
static InstanceCleaner | m_cleaner |
Classes | |
class | InstanceCleaner |
class | PluginDeletionNotifyAdapter |
Vamp::HostExt::PluginLoader::Impl::Impl | +( | ++ | ) | ++ |
+ +
Definition at line 196 of file PluginLoader.cpp.
+ +Vamp::HostExt::PluginLoader::Impl::~Impl | +( | ++ | ) | + [virtual] |
+
+ +
Definition at line 201 of file PluginLoader.cpp.
+ ++
vector< PluginLoader::PluginKey > Vamp::HostExt::PluginLoader::Impl::listPlugins | +( | ++ | ) | ++ |
+ +
Definition at line 212 of file PluginLoader.cpp.
+ +References enumeratePlugins(), m_allPluginsEnumerated, and m_pluginLibraryNameMap.
+ +Referenced by Vamp::HostExt::PluginLoader::listPlugins().
+ +Plugin * Vamp::HostExt::PluginLoader::Impl::loadPlugin | +( | +PluginKey | +key, | +|
+ | + | float | +inputSampleRate, | +|
+ | + | int | +adapterFlags | + |
+ | ) | ++ |
+ +
Definition at line 355 of file PluginLoader.cpp.
+ +References Vamp::HostExt::PluginLoader::ADAPT_BUFFER_SIZE, Vamp::HostExt::PluginLoader::ADAPT_CHANNEL_COUNT, Vamp::HostExt::PluginLoader::ADAPT_INPUT_DOMAIN, decomposePluginKey(), Vamp::Plugin::FrequencyDomain, Vamp::Plugin::getInputDomain(), getLibraryPathForPlugin(), _VampPluginDescriptor::identifier, loadLibrary(), lookupInLibrary(), m_pluginLibraryHandleMap, unloadLibrary(), and VAMP_API_VERSION.
+ +Referenced by Vamp::HostExt::PluginLoader::loadPlugin().
+ +PluginLoader::PluginKey Vamp::HostExt::PluginLoader::Impl::composePluginKey | +( | +string | +libraryName, | +|
+ | + | string | +identifier | + |
+ | ) | ++ |
PluginLoader::PluginCategoryHierarchy Vamp::HostExt::PluginLoader::Impl::getPluginCategory | +( | +PluginKey | +key | +) | ++ |
+ +
Definition at line 332 of file PluginLoader.cpp.
+ +References generateTaxonomy(), and m_taxonomy.
+ +Referenced by Vamp::HostExt::PluginLoader::getPluginCategory().
+ +string Vamp::HostExt::PluginLoader::Impl::getLibraryPathForPlugin | +( | +PluginKey | +key | +) | ++ |
+ +
Definition at line 342 of file PluginLoader.cpp.
+ +References enumeratePlugins(), m_allPluginsEnumerated, and m_pluginLibraryNameMap.
+ +Referenced by Vamp::HostExt::PluginLoader::getLibraryPathForPlugin(), and loadPlugin().
+ +void Vamp::HostExt::PluginLoader::Impl::setInstanceToClean | +( | +PluginLoader * | +instance | +) | + [static] |
+
+ +
Definition at line 206 of file PluginLoader.cpp.
+ +References m_cleaner, and Vamp::HostExt::PluginLoader::Impl::InstanceCleaner::setInstance().
+ +Referenced by Vamp::HostExt::PluginLoader::getInstance().
+ +void Vamp::HostExt::PluginLoader::Impl::pluginDeleted | +( | +PluginDeletionNotifyAdapter * | +adapter | +) | + [protected, virtual] |
+
+ +
Definition at line 606 of file PluginLoader.cpp.
+ +References m_pluginLibraryHandleMap, and unloadLibrary().
+ +Referenced by Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter().
+ +void Vamp::HostExt::PluginLoader::Impl::enumeratePlugins | +( | +PluginKey | + forPlugin = "" |
+ ) | + [protected] |
+
+ +
Definition at line 226 of file PluginLoader.cpp.
+ +References composePluginKey(), decomposePluginKey(), Vamp::PluginHostAdapter::getPluginPath(), _VampPluginDescriptor::identifier, listFiles(), loadLibrary(), lookupInLibrary(), m_allPluginsEnumerated, m_pluginLibraryNameMap, PLUGIN_SUFFIX, splicePath(), unloadLibrary(), and VAMP_API_VERSION.
+ +Referenced by getLibraryPathForPlugin(), and listPlugins().
+ +void Vamp::HostExt::PluginLoader::Impl::generateTaxonomy | +( | ++ | ) | + [protected] |
+
+ +
Definition at line 422 of file PluginLoader.cpp.
+ +References Vamp::PluginHostAdapter::getPluginPath(), listFiles(), m_taxonomy, and splicePath().
+ +Referenced by getPluginCategory().
+ +bool Vamp::HostExt::PluginLoader::Impl::decomposePluginKey | +( | +PluginKey | +key, | +|
+ | + | string & | +libraryName, | +|
+ | + | string & | +identifier | + |
+ | ) | + [protected] |
+
+ +
Definition at line 317 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), and loadPlugin().
+ +void * Vamp::HostExt::PluginLoader::Impl::loadLibrary | +( | +string | +path | +) | + [protected] |
+
+ +
Definition at line 510 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), and loadPlugin().
+ +void Vamp::HostExt::PluginLoader::Impl::unloadLibrary | +( | +void * | +handle | +) | + [protected] |
+
+ +
Definition at line 530 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), loadPlugin(), and pluginDeleted().
+ +void * Vamp::HostExt::PluginLoader::Impl::lookupInLibrary | +( | +void * | +handle, | +|
+ | + | const char * | +symbol | + |
+ | ) | + [protected] |
+
+ +
Definition at line 540 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), and loadPlugin().
+ +string Vamp::HostExt::PluginLoader::Impl::splicePath | +( | +string | +a, | +|
+ | + | string | +b | + |
+ | ) | + [protected] |
+
+ +
Definition at line 550 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), and generateTaxonomy().
+ +vector< string > Vamp::HostExt::PluginLoader::Impl::listFiles | +( | +string | +dir, | +|
+ | + | string | +ext | + |
+ | ) | + [protected] |
+
+ +
Definition at line 560 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), and generateTaxonomy().
+ ++
map<PluginKey, string> Vamp::HostExt::PluginLoader::Impl::m_pluginLibraryNameMap [protected] |
+
+ +
Definition at line 113 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), getLibraryPathForPlugin(), and listPlugins().
+ +bool Vamp::HostExt::PluginLoader::Impl::m_allPluginsEnumerated [protected] |
+
+ +
Definition at line 114 of file PluginLoader.cpp.
+ +Referenced by enumeratePlugins(), getLibraryPathForPlugin(), and listPlugins().
+ +map<PluginKey, PluginCategoryHierarchy> Vamp::HostExt::PluginLoader::Impl::m_taxonomy [protected] |
+
+ +
Definition at line 117 of file PluginLoader.cpp.
+ +Referenced by generateTaxonomy(), and getPluginCategory().
+ +map<Plugin *, void *> Vamp::HostExt::PluginLoader::Impl::m_pluginLibraryHandleMap [protected] |
+
+ +
Definition at line 120 of file PluginLoader.cpp.
+ +Referenced by loadPlugin(), and pluginDeleted().
+ +PluginLoader::Impl::InstanceCleaner Vamp::HostExt::PluginLoader::Impl::m_cleaner [static, protected] |
+
+
InstanceCleaner() | Vamp::HostExt::PluginLoader::Impl::InstanceCleaner | [inline] |
m_instance | Vamp::HostExt::PluginLoader::Impl::InstanceCleaner | [protected] |
setInstance(PluginLoader *instance) | Vamp::HostExt::PluginLoader::Impl::InstanceCleaner | [inline] |
~InstanceCleaner() | Vamp::HostExt::PluginLoader::Impl::InstanceCleaner | [inline] |
Definition at line 102 of file PluginLoader.cpp.
+Public Member Functions | |
InstanceCleaner () | |
~InstanceCleaner () | |
void | setInstance (PluginLoader *instance) |
Protected Attributes | |
PluginLoader * | m_instance |
Vamp::HostExt::PluginLoader::Impl::InstanceCleaner::InstanceCleaner | +( | ++ | ) | + [inline] |
+
+ +
Definition at line 104 of file PluginLoader.cpp.
+ +Vamp::HostExt::PluginLoader::Impl::InstanceCleaner::~InstanceCleaner | +( | ++ | ) | + [inline] |
+
+
void Vamp::HostExt::PluginLoader::Impl::InstanceCleaner::setInstance | +( | +PluginLoader * | +instance | +) | + [inline] |
+
+ +
Definition at line 106 of file PluginLoader.cpp.
+ +References m_instance.
+ +Referenced by Vamp::HostExt::PluginLoader::Impl::setInstanceToClean().
+ ++
PluginLoader* Vamp::HostExt::PluginLoader::Impl::InstanceCleaner::m_instance [protected] |
+
+ +
Definition at line 108 of file PluginLoader.cpp.
+ +Referenced by setInstance(), and ~InstanceCleaner().
+ ++
Definition at line 94 of file PluginLoader.cpp.
+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 | |
PluginDeletionNotifyAdapter (Plugin *plugin, Impl *loader) | |
virtual | ~PluginDeletionNotifyAdapter () |
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. | |
Protected Attributes | |
Impl * | m_loader |
Plugin * | m_plugin |
float | m_inputSampleRate |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::PluginDeletionNotifyAdapter | +( | +Plugin * | +plugin, | +|
+ | + | Impl * | +loader | + |
+ | ) | ++ |
+ +
Definition at line 613 of file PluginLoader.cpp.
+ +Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter | +( | ++ | ) | + [virtual] |
+
+ +
Definition at line 620 of file PluginLoader.cpp.
+ +References m_loader, Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::HostExt::PluginLoader::Impl::pluginDeleted().
+ ++
bool Vamp::HostExt::PluginWrapper::initialise | +( | +size_t | +inputChannels, | +|
+ | + | size_t | +stepSize, | +|
+ | + | size_t | +blockSize | + |
+ | ) | + [virtual, inherited] |
+
+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::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 62 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::initialise(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 68 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::Plugin::reset().
+ +Plugin::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 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.
+ +Definition at line 74 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getInputDomain(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the Vamp API compatibility level of the plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 80 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getVampApiVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 86 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getIdentifier(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 92 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getName(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 98 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getDescription(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 104 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getMaker(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 110 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPluginVersion(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 116 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCopyright(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +PluginBase::ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 122 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameterDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 128 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameter(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 134 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::setParameter().
+ +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.
+ +Definition at line 140 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPrograms(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the current program. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 146 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCurrentProgram(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 152 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::PluginBase::selectProgram().
+ +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::PluginBufferingAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 158 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredStepSize(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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::PluginInputDomainAdapter.
+ +Definition at line 164 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredBlockSize(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::getPreferredStepSize().
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the minimum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 170 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMinChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | ++ | ) | + const [virtual, inherited] |
+
+Get the maximum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 175 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ +Definition at line 181 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getOutputDescriptors(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +Plugin::FeatureSet Vamp::HostExt::PluginWrapper::process | +( | +const float *const * | +inputBuffers, | +|
+ | + | RealTime | +timestamp | + |
+ | ) | + [virtual, inherited] |
+
+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 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, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 187 of file PluginWrapper.cpp.
+ +References Vamp::HostExt::PluginWrapper::m_plugin, and Vamp::Plugin::process().
+ +Plugin::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.
+ +Definition at line 193 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getRemainingFeatures(), and Vamp::HostExt::PluginWrapper::m_plugin.
+ +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.
+ + + ++
Impl* Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::m_loader [protected] |
+
+ +
Definition at line 99 of file PluginLoader.cpp.
+ +Referenced by ~PluginDeletionNotifyAdapter().
+ +Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected, inherited] |
+
+ +
Definition at line 99 of file PluginWrapper.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), Vamp::HostExt::PluginWrapper::getCurrentProgram(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::HostExt::PluginWrapper::getIdentifier(), Vamp::HostExt::PluginWrapper::getInputDomain(), Vamp::HostExt::PluginWrapper::getMaker(), Vamp::HostExt::PluginWrapper::getMaxChannelCount(), Vamp::HostExt::PluginWrapper::getMinChannelCount(), Vamp::HostExt::PluginWrapper::getName(), Vamp::HostExt::PluginWrapper::getOutputDescriptors(), Vamp::HostExt::PluginWrapper::getParameter(), Vamp::HostExt::PluginWrapper::getParameterDescriptors(), Vamp::HostExt::PluginWrapper::getPluginVersion(), Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginWrapper::getPrograms(), Vamp::HostExt::PluginWrapper::getRemainingFeatures(), Vamp::HostExt::PluginWrapper::getVampApiVersion(), Vamp::HostExt::PluginWrapper::initialise(), Vamp::HostExt::PluginWrapper::process(), Vamp::HostExt::PluginWrapper::reset(), Vamp::HostExt::PluginWrapper::selectProgram(), Vamp::HostExt::PluginWrapper::setParameter(), ~PluginDeletionNotifyAdapter(), and Vamp::HostExt::PluginWrapper::~PluginWrapper().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
Definition at line 43 of file PluginWrapper.cpp.
+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 | |
PluginRateExtractor () | |
float | getRate () const |
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 Attributes | |
float | m_inputSampleRate |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::HostExt::PluginRateExtractor::PluginRateExtractor | +( | ++ | ) | + [inline] |
+
+ +
Definition at line 46 of file PluginWrapper.cpp.
+ ++
float Vamp::HostExt::PluginRateExtractor::getRate | +( | ++ | ) | + const [inline] |
+
+ +
Definition at line 47 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::m_inputSampleRate.
+ +virtual bool Vamp::Plugin::initialise | +( | +size_t | +inputChannels, | +|
+ | + | size_t | +stepSize, | +|
+ | + | size_t | +blockSize | + |
+ | ) | + [pure virtual, inherited] |
+
+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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::initialise(), Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), and runPlugin().
+ +virtual void Vamp::Plugin::reset | +( | ++ | ) | + [pure 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). +
Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::reset().
+ +virtual InputDomain Vamp::Plugin::getInputDomain | +( | ++ | ) | + const [pure 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 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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getInputDomain(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), Vamp::HostExt::PluginLoader::Impl::loadPlugin(), Vamp::HostExt::PluginInputDomainAdapter::Impl::process(), and runPlugin().
+ +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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 171 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 186 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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 191 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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 196 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::initialise(), and runPlugin().
+ +virtual OutputList Vamp::Plugin::getOutputDescriptors | +( | ++ | ) | + const [pure 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. +
Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::checkOutputMap(), enumeratePlugins(), Vamp::HostExt::PluginWrapper::getOutputDescriptors(), Vamp::HostExt::PluginBufferingAdapter::Impl::getOutputDescriptors(), and runPlugin().
+ +virtual FeatureSet Vamp::Plugin::process | +( | +const float *const * | +inputBuffers, | +|
+ | + | RealTime | +timestamp | + |
+ | ) | + [pure virtual, inherited] |
+
+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 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::process(), Vamp::HostExt::PluginInputDomainAdapter::Impl::process(), Vamp::HostExt::PluginChannelAdapter::Impl::process(), Vamp::PluginAdapterBase::Impl::process(), Vamp::HostExt::PluginBufferingAdapter::Impl::processBlock(), and runPlugin().
+ +virtual FeatureSet Vamp::Plugin::getRemainingFeatures | +( | ++ | ) | + [pure virtual, inherited] |
+
+After all blocks have been processed, calculate and return any remaining features derived from the complete input. +
+ +
Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::getRemainingFeatures(), Vamp::HostExt::PluginBufferingAdapter::Impl::getRemainingFeatures(), Vamp::PluginAdapterBase::Impl::getRemainingFeatures(), 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.
+ + + +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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getIdentifier(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getName(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::PluginAdapterBase::Impl::getDescriptor(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getMaker(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), and Vamp::PluginAdapterBase::Impl::getDescriptor().
+ +virtual int Vamp::PluginBase::getPluginVersion | +( | ++ | ) | + const [pure virtual, inherited] |
+
+Get the version number of the plugin. +
+ +
Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPluginVersion().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | ++ | ) | + const [inline, virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 200 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getParameterDescriptors().
+ +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, and PercussionOnsetDetector.
+ +Definition at line 208 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getParameter().
+ +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::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 214 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::setParameter().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +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 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ ++
float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
#include <vamp-sdk/hostext/PluginWrapper.h>
++
+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 59 of file 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. | |
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 |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::HostExt::PluginWrapper::~PluginWrapper | +( | ++ | ) | + [virtual] |
+
Vamp::HostExt::PluginWrapper::PluginWrapper | +( | +Plugin * | +plugin | +) | + [protected] |
+
+ +
Definition at line 50 of file PluginWrapper.cpp.
+ ++
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::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 62 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::initialise(), and m_plugin.
+ +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.
+ +Definition at line 68 of file PluginWrapper.cpp.
+ +References m_plugin, and Vamp::Plugin::reset().
+ +Plugin::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 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.
+ +Definition at line 74 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getInputDomain(), and m_plugin.
+ +unsigned int Vamp::HostExt::PluginWrapper::getVampApiVersion | +( | ++ | ) | + const [virtual] |
+
+Get the Vamp API compatibility level of the plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 80 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getVampApiVersion(), and m_plugin.
+ +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.
+ +Definition at line 86 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getIdentifier(), and m_plugin.
+ +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.
+ +Definition at line 92 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getName(), and m_plugin.
+ +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.
+ +Definition at line 98 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getDescription(), and m_plugin.
+ +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.
+ +Definition at line 104 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getMaker(), and m_plugin.
+ +int Vamp::HostExt::PluginWrapper::getPluginVersion | +( | ++ | ) | + const [virtual] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 110 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPluginVersion(), and m_plugin.
+ +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.
+ +Definition at line 116 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCopyright(), and m_plugin.
+ +PluginBase::ParameterList Vamp::HostExt::PluginWrapper::getParameterDescriptors | +( | ++ | ) | + const [virtual] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 122 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameterDescriptors(), and m_plugin.
+ +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.
+ +Definition at line 128 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getParameter(), and m_plugin.
+ +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.
+ +Definition at line 134 of file PluginWrapper.cpp.
+ +References m_plugin, and Vamp::PluginBase::setParameter().
+ +PluginBase::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.
+ +Definition at line 140 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getPrograms(), and m_plugin.
+ +std::string Vamp::HostExt::PluginWrapper::getCurrentProgram | +( | ++ | ) | + const [virtual] |
+
+Get the current program. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 146 of file PluginWrapper.cpp.
+ +References Vamp::PluginBase::getCurrentProgram(), and m_plugin.
+ +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.
+ +Definition at line 152 of file PluginWrapper.cpp.
+ +References m_plugin, and Vamp::PluginBase::selectProgram().
+ +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::PluginBufferingAdapter, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 158 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredStepSize(), and m_plugin.
+ +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::PluginInputDomainAdapter.
+ +Definition at line 164 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getPreferredBlockSize(), and m_plugin.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::getPreferredStepSize().
+ +size_t Vamp::HostExt::PluginWrapper::getMinChannelCount | +( | ++ | ) | + const [virtual] |
+
+Get the minimum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 170 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMinChannelCount(), and m_plugin.
+ +size_t Vamp::HostExt::PluginWrapper::getMaxChannelCount | +( | ++ | ) | + const [virtual] |
+
+Get the maximum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 175 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getMaxChannelCount(), and m_plugin.
+ +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.
+ +Definition at line 181 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getOutputDescriptors(), and m_plugin.
+ +Plugin::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 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, and Vamp::HostExt::PluginInputDomainAdapter.
+ +Definition at line 187 of file PluginWrapper.cpp.
+ +References m_plugin, and Vamp::Plugin::process().
+ +Plugin::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.
+ +Definition at line 193 of file PluginWrapper.cpp.
+ +References Vamp::Plugin::getRemainingFeatures(), and m_plugin.
+ +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.
+ + + ++
Plugin* Vamp::HostExt::PluginWrapper::m_plugin [protected] |
+
+ +
Definition at line 99 of file PluginWrapper.h.
+ +Referenced by getCopyright(), getCurrentProgram(), getDescription(), getIdentifier(), getInputDomain(), getMaker(), getMaxChannelCount(), getMinChannelCount(), getName(), getOutputDescriptors(), getParameter(), getParameterDescriptors(), getPluginVersion(), getPreferredBlockSize(), getPreferredStepSize(), getPrograms(), getRemainingFeatures(), getVampApiVersion(), initialise(), process(), reset(), selectProgram(), setParameter(), Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter::~PluginDeletionNotifyAdapter(), and ~PluginWrapper().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
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] |
#include <vamp-sdk/Plugin.h>
++
+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 121 of file Plugin.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 | ~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 |
Classes | |
struct | Feature |
struct | OutputDescriptor |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList | +
typedef std::vector<Feature> Vamp::Plugin::FeatureList | +
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet | +
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain | +
+
virtual Vamp::Plugin::~Plugin | +( | ++ | ) | + [inline, virtual] |
+
Vamp::Plugin::Plugin | +( | +float | +inputSampleRate | +) | + [inline, protected] |
+
+
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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::initialise(), Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), and 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::reset().
+ +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 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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getInputDomain(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::initialise(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), Vamp::HostExt::PluginLoader::Impl::loadPlugin(), Vamp::HostExt::PluginInputDomainAdapter::Impl::process(), 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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 171 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 186 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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 191 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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 196 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), ZeroCrossing::initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::checkOutputMap(), enumeratePlugins(), Vamp::HostExt::PluginWrapper::getOutputDescriptors(), Vamp::HostExt::PluginBufferingAdapter::Impl::getOutputDescriptors(), 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 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginChannelAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::process(), Vamp::HostExt::PluginInputDomainAdapter::Impl::process(), Vamp::HostExt::PluginChannelAdapter::Impl::process(), Vamp::PluginAdapterBase::Impl::process(), Vamp::HostExt::PluginBufferingAdapter::Impl::processBlock(), and 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::getRemainingFeatures(), Vamp::HostExt::PluginBufferingAdapter::Impl::getRemainingFeatures(), Vamp::PluginAdapterBase::Impl::getRemainingFeatures(), and 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.
+ + + +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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getIdentifier(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getName(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::PluginAdapterBase::Impl::getDescriptor(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getMaker(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), and Vamp::PluginAdapterBase::Impl::getDescriptor().
+ +virtual int Vamp::PluginBase::getPluginVersion | +( | ++ | ) | + const [pure virtual, inherited] |
+
+Get the version number of the plugin. +
+ +
Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPluginVersion().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | ++ | ) | + const [inline, virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 200 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getParameterDescriptors().
+ +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, and PercussionOnsetDetector.
+ +Definition at line 208 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getParameter().
+ +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::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 214 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::setParameter().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +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 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ ++
float Vamp::Plugin::m_inputSampleRate [protected] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
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] |
#include <vamp-sdk/PluginAdapter.h>
++
+See PluginAdapterBase. +
Definition at line 93 of file 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 |
Vamp::PluginAdapter< P >::PluginAdapter | +( | ++ | ) | + [inline] |
+
+ +
Definition at line 96 of file PluginAdapter.h.
+ +virtual Vamp::PluginAdapter< P >::~PluginAdapter | +( | ++ | ) | + [inline, virtual] |
+
+ +
Definition at line 97 of file PluginAdapter.h.
+ ++
Plugin* Vamp::PluginAdapter< P >::createPlugin | +( | +float | +inputSampleRate | +) | + [inline, protected, virtual] |
+
const VampPluginDescriptor * Vamp::PluginAdapterBase::getDescriptor | +( | ++ | ) | + [inherited] |
+
+Return a VampPluginDescriptor describing the plugin that is wrapped by this adapter. +
+ +
Definition at line 138 of file PluginAdapter.cpp.
+ +References Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginAdapterBase::m_impl.
+ +Referenced by vampGetPluginDescriptor().
+ ++
Impl* Vamp::PluginAdapterBase::m_impl [protected, inherited] |
+
+ +
Definition at line 79 of file PluginAdapter.h.
+ +Referenced by Vamp::PluginAdapterBase::getDescriptor(), Vamp::PluginAdapterBase::PluginAdapterBase(), and Vamp::PluginAdapterBase::~PluginAdapterBase().
+ ++
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] |
#include <vamp-sdk/PluginAdapter.h>
++
+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 63 of file 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 |
Classes | |
class | Impl |
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. +
+ +
Definition at line 138 of file PluginAdapter.cpp.
+ +References Vamp::PluginAdapterBase::Impl::getDescriptor(), and m_impl.
+ +Referenced by vampGetPluginDescriptor().
+ +virtual Plugin* Vamp::PluginAdapterBase::createPlugin | +( | +float | +inputSampleRate | +) | + [protected, pure virtual] |
+
+ +
Implemented in Vamp::PluginAdapter< P >.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginAdapterBase::Impl::vampInstantiate().
+ ++
Impl* Vamp::PluginAdapterBase::m_impl [protected] |
+
+ +
Definition at line 79 of file PluginAdapter.h.
+ +Referenced by getDescriptor(), PluginAdapterBase(), and ~PluginAdapterBase().
+ ++
Definition at line 46 of file PluginAdapter.cpp.
+Public Member Functions | |
Impl (PluginAdapterBase *) | |
~Impl () | |
const VampPluginDescriptor * | getDescriptor () |
Protected Types | |
typedef std::map< const void +*, Impl * > | AdapterMap |
typedef std::map< Plugin +*, Plugin::OutputList * > | OutputMap |
Protected Member Functions | |
void | cleanup (Plugin *plugin) |
void | checkOutputMap (Plugin *plugin) |
unsigned int | getOutputCount (Plugin *plugin) |
VampOutputDescriptor * | getOutputDescriptor (Plugin *plugin, unsigned int i) |
VampFeatureList * | process (Plugin *plugin, const float *const *inputBuffers, int sec, int nsec) |
VampFeatureList * | getRemainingFeatures (Plugin *plugin) |
VampFeatureList * | convertFeatures (Plugin *plugin, const Plugin::FeatureSet &features) |
void | resizeFS (Plugin *plugin, int n) |
void | resizeFL (Plugin *plugin, int n, size_t sz) |
void | resizeFV (Plugin *plugin, int n, int j, size_t sz) |
Static Protected Member Functions | |
static VampPluginHandle | vampInstantiate (const VampPluginDescriptor *desc, float inputSampleRate) |
static void | vampCleanup (VampPluginHandle handle) |
static int | vampInitialise (VampPluginHandle handle, unsigned int channels, unsigned int stepSize, unsigned int blockSize) |
static void | vampReset (VampPluginHandle handle) |
static float | vampGetParameter (VampPluginHandle handle, int param) |
static void | vampSetParameter (VampPluginHandle handle, int param, float value) |
static unsigned int | vampGetCurrentProgram (VampPluginHandle handle) |
static void | vampSelectProgram (VampPluginHandle handle, unsigned int program) |
static unsigned int | vampGetPreferredStepSize (VampPluginHandle handle) |
static unsigned int | vampGetPreferredBlockSize (VampPluginHandle handle) |
static unsigned int | vampGetMinChannelCount (VampPluginHandle handle) |
static unsigned int | vampGetMaxChannelCount (VampPluginHandle handle) |
static unsigned int | vampGetOutputCount (VampPluginHandle handle) |
static VampOutputDescriptor * | vampGetOutputDescriptor (VampPluginHandle handle, unsigned int i) |
static void | vampReleaseOutputDescriptor (VampOutputDescriptor *desc) |
static VampFeatureList * | vampProcess (VampPluginHandle handle, const float *const *inputBuffers, int sec, int nsec) |
static VampFeatureList * | vampGetRemainingFeatures (VampPluginHandle handle) |
static void | vampReleaseFeatureSet (VampFeatureList *fs) |
static Impl * | lookupAdapter (VampPluginHandle) |
Protected Attributes | |
PluginAdapterBase * | m_base |
bool | m_populated |
VampPluginDescriptor | m_descriptor |
Plugin::ParameterList | m_parameters |
Plugin::ProgramList | m_programs |
OutputMap | m_pluginOutputs |
std::map< Plugin +*, VampFeatureList * > | m_fs |
std::map< Plugin +*, std::vector< size_t > > | m_fsizes |
std::map< Plugin +*, std::vector< std::vector +< size_t > > > | m_fvsizes |
Static Protected Attributes | |
static AdapterMap * | m_adapterMap = 0 |
typedef std::map<const void *, Impl *> Vamp::PluginAdapterBase::Impl::AdapterMap [protected] |
+
+ +
Definition at line 107 of file PluginAdapter.cpp.
+ +typedef std::map<Plugin *, Plugin::OutputList *> Vamp::PluginAdapterBase::Impl::OutputMap [protected] |
+
+ +
Definition at line 116 of file PluginAdapter.cpp.
+ ++
Vamp::PluginAdapterBase::Impl::Impl | +( | +PluginAdapterBase * | +base | +) | ++ |
+ +
Definition at line 143 of file PluginAdapter.cpp.
+ +Vamp::PluginAdapterBase::Impl::~Impl | +( | ++ | ) | ++ |
+ +
Definition at line 258 of file PluginAdapter.cpp.
+ +References _VampPluginDescriptor::copyright, _VampParameterDescriptor::description, _VampPluginDescriptor::description, _VampParameterDescriptor::identifier, _VampPluginDescriptor::identifier, m_adapterMap, m_descriptor, m_populated, _VampPluginDescriptor::maker, _VampParameterDescriptor::name, _VampPluginDescriptor::name, _VampPluginDescriptor::parameterCount, _VampPluginDescriptor::parameters, _VampPluginDescriptor::programCount, _VampPluginDescriptor::programs, _VampParameterDescriptor::unit, and _VampParameterDescriptor::valueNames.
+ ++
const VampPluginDescriptor * Vamp::PluginAdapterBase::Impl::getDescriptor | +( | ++ | ) | ++ |
+ +
Definition at line 153 of file PluginAdapter.cpp.
+ +References _VampPluginDescriptor::cleanup, _VampPluginDescriptor::copyright, Vamp::PluginAdapterBase::createPlugin(), _VampParameterDescriptor::defaultValue, _VampParameterDescriptor::description, _VampPluginDescriptor::description, Vamp::Plugin::FrequencyDomain, Vamp::PluginBase::getCopyright(), _VampPluginDescriptor::getCurrentProgram, Vamp::PluginBase::getDescription(), Vamp::PluginBase::getIdentifier(), Vamp::Plugin::getInputDomain(), Vamp::PluginBase::getMaker(), _VampPluginDescriptor::getMaxChannelCount, _VampPluginDescriptor::getMinChannelCount, Vamp::PluginBase::getName(), _VampPluginDescriptor::getOutputCount, _VampPluginDescriptor::getOutputDescriptor, _VampPluginDescriptor::getParameter, Vamp::PluginBase::getParameterDescriptors(), Vamp::PluginBase::getPluginVersion(), _VampPluginDescriptor::getPreferredBlockSize, _VampPluginDescriptor::getPreferredStepSize, Vamp::PluginBase::getPrograms(), _VampPluginDescriptor::getRemainingFeatures, Vamp::PluginBase::getVampApiVersion(), _VampParameterDescriptor::identifier, _VampPluginDescriptor::identifier, _VampPluginDescriptor::initialise, _VampPluginDescriptor::inputDomain, _VampPluginDescriptor::instantiate, _VampParameterDescriptor::isQuantized, m_adapterMap, m_base, m_descriptor, m_parameters, m_populated, m_programs, _VampPluginDescriptor::maker, _VampParameterDescriptor::maxValue, _VampParameterDescriptor::minValue, _VampParameterDescriptor::name, _VampPluginDescriptor::name, _VampPluginDescriptor::parameterCount, _VampPluginDescriptor::parameters, _VampPluginDescriptor::pluginVersion, _VampPluginDescriptor::process, _VampPluginDescriptor::programCount, _VampPluginDescriptor::programs, _VampParameterDescriptor::quantizeStep, _VampPluginDescriptor::releaseFeatureSet, _VampPluginDescriptor::releaseOutputDescriptor, _VampPluginDescriptor::reset, _VampPluginDescriptor::selectProgram, _VampPluginDescriptor::setParameter, _VampParameterDescriptor::unit, _VampParameterDescriptor::valueNames, VAMP_API_VERSION, _VampPluginDescriptor::vampApiVersion, vampCleanup(), vampFrequencyDomain, vampGetCurrentProgram(), vampGetMaxChannelCount(), vampGetMinChannelCount(), vampGetOutputCount(), vampGetOutputDescriptor(), vampGetParameter(), vampGetPreferredBlockSize(), vampGetPreferredStepSize(), vampGetRemainingFeatures(), vampInitialise(), vampInstantiate(), vampProcess(), vampReleaseFeatureSet(), vampReleaseOutputDescriptor(), vampReset(), vampSelectProgram(), vampSetParameter(), and vampTimeDomain.
+ +Referenced by Vamp::PluginAdapterBase::getDescriptor().
+ +VampPluginHandle Vamp::PluginAdapterBase::Impl::vampInstantiate | +( | +const VampPluginDescriptor * | +desc, | +|
+ | + | float | +inputSampleRate | + |
+ | ) | + [static, protected] |
+
+ +
Definition at line 317 of file PluginAdapter.cpp.
+ +References Vamp::PluginAdapterBase::createPlugin(), m_adapterMap, m_base, and m_descriptor.
+ +Referenced by getDescriptor().
+ +void Vamp::PluginAdapterBase::Impl::vampCleanup | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
+ +
Definition at line 349 of file PluginAdapter.cpp.
+ +References cleanup(), and lookupAdapter().
+ +Referenced by getDescriptor().
+ +int Vamp::PluginAdapterBase::Impl::vampInitialise | +( | +VampPluginHandle | +handle, | +|
+ | + | unsigned int | +channels, | +|
+ | + | unsigned int | +stepSize, | +|
+ | + | unsigned int | +blockSize | + |
+ | ) | + [static, protected] |
+
void Vamp::PluginAdapterBase::Impl::vampReset | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
float Vamp::PluginAdapterBase::Impl::vampGetParameter | +( | +VampPluginHandle | +handle, | +|
+ | + | int | +param | + |
+ | ) | + [static, protected] |
+
+ +
Definition at line 389 of file PluginAdapter.cpp.
+ +References lookupAdapter(), and m_parameters.
+ +Referenced by getDescriptor().
+ +void Vamp::PluginAdapterBase::Impl::vampSetParameter | +( | +VampPluginHandle | +handle, | +|
+ | + | int | +param, | +|
+ | + | float | +value | + |
+ | ) | + [static, protected] |
+
+ +
Definition at line 403 of file PluginAdapter.cpp.
+ +References lookupAdapter(), and m_parameters.
+ +Referenced by getDescriptor().
+ +unsigned int Vamp::PluginAdapterBase::Impl::vampGetCurrentProgram | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
+ +
Definition at line 417 of file PluginAdapter.cpp.
+ +References lookupAdapter(), and m_programs.
+ +Referenced by getDescriptor().
+ +void Vamp::PluginAdapterBase::Impl::vampSelectProgram | +( | +VampPluginHandle | +handle, | +|
+ | + | unsigned int | +program | + |
+ | ) | + [static, protected] |
+
+ +
Definition at line 434 of file PluginAdapter.cpp.
+ +References lookupAdapter(), and m_programs.
+ +Referenced by getDescriptor().
+ +unsigned int Vamp::PluginAdapterBase::Impl::vampGetPreferredStepSize | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
unsigned int Vamp::PluginAdapterBase::Impl::vampGetPreferredBlockSize | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
unsigned int Vamp::PluginAdapterBase::Impl::vampGetMinChannelCount | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
unsigned int Vamp::PluginAdapterBase::Impl::vampGetMaxChannelCount | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
unsigned int Vamp::PluginAdapterBase::Impl::vampGetOutputCount | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
+ +
Definition at line 488 of file PluginAdapter.cpp.
+ +References getOutputCount(), and lookupAdapter().
+ +Referenced by getDescriptor().
+ +VampOutputDescriptor * Vamp::PluginAdapterBase::Impl::vampGetOutputDescriptor | +( | +VampPluginHandle | +handle, | +|
+ | + | unsigned int | +i | + |
+ | ) | + [static, protected] |
+
+ +
Definition at line 503 of file PluginAdapter.cpp.
+ +References getOutputDescriptor(), and lookupAdapter().
+ +Referenced by getDescriptor().
+ +void Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor | +( | +VampOutputDescriptor * | +desc | +) | + [static, protected] |
+
+ +
Definition at line 519 of file PluginAdapter.cpp.
+ +References _VampOutputDescriptor::binCount, _VampOutputDescriptor::binNames, _VampOutputDescriptor::description, _VampOutputDescriptor::hasFixedBinCount, _VampOutputDescriptor::identifier, _VampOutputDescriptor::name, and _VampOutputDescriptor::unit.
+ +Referenced by getDescriptor().
+ +VampFeatureList * Vamp::PluginAdapterBase::Impl::vampProcess | +( | +VampPluginHandle | +handle, | +|
+ | + | const float *const * | +inputBuffers, | +|
+ | + | int | +sec, | +|
+ | + | int | +nsec | + |
+ | ) | + [static, protected] |
+
+ +
Definition at line 541 of file PluginAdapter.cpp.
+ +References lookupAdapter(), and process().
+ +Referenced by getDescriptor().
+ +VampFeatureList * Vamp::PluginAdapterBase::Impl::vampGetRemainingFeatures | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
+ +
Definition at line 557 of file PluginAdapter.cpp.
+ +References getRemainingFeatures(), and lookupAdapter().
+ +Referenced by getDescriptor().
+ +void Vamp::PluginAdapterBase::Impl::vampReleaseFeatureSet | +( | +VampFeatureList * | +fs | +) | + [static, protected] |
+
void Vamp::PluginAdapterBase::Impl::cleanup | +( | +Plugin * | +plugin | +) | + [protected] |
+
+ +
Definition at line 577 of file PluginAdapter.cpp.
+ +References m_adapterMap, m_fs, m_fsizes, m_fvsizes, and m_pluginOutputs.
+ +Referenced by vampCleanup().
+ +void Vamp::PluginAdapterBase::Impl::checkOutputMap | +( | +Plugin * | +plugin | +) | + [protected] |
+
+ +
Definition at line 619 of file PluginAdapter.cpp.
+ +References Vamp::Plugin::getOutputDescriptors(), and m_pluginOutputs.
+ +Referenced by getOutputCount(), getOutputDescriptor(), getRemainingFeatures(), and process().
+ +unsigned int Vamp::PluginAdapterBase::Impl::getOutputCount | +( | +Plugin * | +plugin | +) | + [protected] |
+
+ +
Definition at line 630 of file PluginAdapter.cpp.
+ +References checkOutputMap(), and m_pluginOutputs.
+ +Referenced by vampGetOutputCount().
+ +VampOutputDescriptor * Vamp::PluginAdapterBase::Impl::getOutputDescriptor | +( | +Plugin * | +plugin, | +|
+ | + | unsigned int | +i | + |
+ | ) | + [protected] |
+
+ +
Definition at line 637 of file PluginAdapter.cpp.
+ +References Vamp::Plugin::OutputDescriptor::binCount, _VampOutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::binNames, _VampOutputDescriptor::binNames, checkOutputMap(), Vamp::Plugin::OutputDescriptor::description, _VampOutputDescriptor::description, Vamp::Plugin::OutputDescriptor::FixedSampleRate, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, _VampOutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasKnownExtents, _VampOutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::identifier, _VampOutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::isQuantized, _VampOutputDescriptor::isQuantized, m_pluginOutputs, Vamp::Plugin::OutputDescriptor::maxValue, _VampOutputDescriptor::maxValue, Vamp::Plugin::OutputDescriptor::minValue, _VampOutputDescriptor::minValue, Vamp::Plugin::OutputDescriptor::name, _VampOutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, Vamp::Plugin::OutputDescriptor::quantizeStep, _VampOutputDescriptor::quantizeStep, Vamp::Plugin::OutputDescriptor::sampleRate, _VampOutputDescriptor::sampleRate, _VampOutputDescriptor::sampleType, Vamp::Plugin::OutputDescriptor::sampleType, Vamp::Plugin::OutputDescriptor::unit, _VampOutputDescriptor::unit, vampFixedSampleRate, vampOneSamplePerStep, vampVariableSampleRate, and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +Referenced by vampGetOutputDescriptor().
+ +VampFeatureList * Vamp::PluginAdapterBase::Impl::process | +( | +Plugin * | +plugin, | +|
+ | + | const float *const * | +inputBuffers, | +|
+ | + | int | +sec, | +|
+ | + | int | +nsec | + |
+ | ) | + [protected] |
+
+ +
Definition at line 690 of file PluginAdapter.cpp.
+ +References checkOutputMap(), convertFeatures(), and Vamp::Plugin::process().
+ +Referenced by vampProcess().
+ +VampFeatureList * Vamp::PluginAdapterBase::Impl::getRemainingFeatures | +( | +Plugin * | +plugin | +) | + [protected] |
+
+ +
Definition at line 701 of file PluginAdapter.cpp.
+ +References checkOutputMap(), convertFeatures(), and Vamp::Plugin::getRemainingFeatures().
+ +Referenced by vampGetRemainingFeatures().
+ +VampFeatureList * Vamp::PluginAdapterBase::Impl::convertFeatures | +( | +Plugin * | +plugin, | +|
+ | + | const Plugin::FeatureSet & | +features | + |
+ | ) | + [protected] |
+
+ +
Definition at line 709 of file PluginAdapter.cpp.
+ +References _VampFeatureList::featureCount, _VampFeatureList::features, _VampFeature::hasTimestamp, _VampFeature::label, m_fs, m_fsizes, m_fvsizes, m_pluginOutputs, _VampFeature::nsec, resizeFL(), resizeFS(), resizeFV(), _VampFeature::sec, _VampFeature::valueCount, and _VampFeature::values.
+ +Referenced by getRemainingFeatures(), and process().
+ +PluginAdapterBase::Impl * Vamp::PluginAdapterBase::Impl::lookupAdapter | +( | +VampPluginHandle | +handle | +) | + [static, protected] |
+
+ +
Definition at line 304 of file PluginAdapter.cpp.
+ +References m_adapterMap.
+ +Referenced by vampCleanup(), vampGetCurrentProgram(), vampGetOutputCount(), vampGetOutputDescriptor(), vampGetParameter(), vampGetRemainingFeatures(), vampProcess(), vampSelectProgram(), and vampSetParameter().
+ +void Vamp::PluginAdapterBase::Impl::resizeFS | +( | +Plugin * | +plugin, | +|
+ | + | int | +n | + |
+ | ) | + [protected] |
+
+ +
Definition at line 788 of file PluginAdapter.cpp.
+ +References m_fs, m_fsizes, and m_fvsizes.
+ +Referenced by convertFeatures().
+ +void Vamp::PluginAdapterBase::Impl::resizeFL | +( | +Plugin * | +plugin, | +|
+ | + | int | +n, | +|
+ | + | size_t | +sz | + |
+ | ) | + [protected] |
+
+ +
Definition at line 810 of file PluginAdapter.cpp.
+ +References m_fs, m_fsizes, and m_fvsizes.
+ +Referenced by convertFeatures().
+ +void Vamp::PluginAdapterBase::Impl::resizeFV | +( | +Plugin * | +plugin, | +|
+ | + | int | +n, | +|
+ | + | int | +j, | +|
+ | + | size_t | +sz | + |
+ | ) | + [protected] |
+
+ +
Definition at line 833 of file PluginAdapter.cpp.
+ +References m_fs, and m_fvsizes.
+ +Referenced by convertFeatures().
+ ++
PluginAdapterBase* Vamp::PluginAdapterBase::Impl::m_base [protected] |
+
+ +
Definition at line 55 of file PluginAdapter.cpp.
+ +Referenced by getDescriptor(), and vampInstantiate().
+ +PluginAdapterBase::Impl::AdapterMap * Vamp::PluginAdapterBase::Impl::m_adapterMap = 0 [static, protected] |
+
+ +
Definition at line 108 of file PluginAdapter.cpp.
+ +Referenced by cleanup(), getDescriptor(), lookupAdapter(), vampInstantiate(), and ~Impl().
+ +bool Vamp::PluginAdapterBase::Impl::m_populated [protected] |
+
+ +
Definition at line 111 of file PluginAdapter.cpp.
+ +Referenced by getDescriptor(), and ~Impl().
+ +VampPluginDescriptor Vamp::PluginAdapterBase::Impl::m_descriptor [protected] |
+
+ +
Definition at line 112 of file PluginAdapter.cpp.
+ +Referenced by getDescriptor(), vampInstantiate(), and ~Impl().
+ +Plugin::ParameterList Vamp::PluginAdapterBase::Impl::m_parameters [protected] |
+
+ +
Definition at line 113 of file PluginAdapter.cpp.
+ +Referenced by getDescriptor(), vampGetParameter(), and vampSetParameter().
+ +Plugin::ProgramList Vamp::PluginAdapterBase::Impl::m_programs [protected] |
+
+ +
Definition at line 114 of file PluginAdapter.cpp.
+ +Referenced by getDescriptor(), vampGetCurrentProgram(), and vampSelectProgram().
+ +OutputMap Vamp::PluginAdapterBase::Impl::m_pluginOutputs [protected] |
+
+ +
Definition at line 117 of file PluginAdapter.cpp.
+ +Referenced by checkOutputMap(), cleanup(), convertFeatures(), getOutputCount(), and getOutputDescriptor().
+ +std::map<Plugin *, VampFeatureList *> Vamp::PluginAdapterBase::Impl::m_fs [protected] |
+
+ +
Definition at line 119 of file PluginAdapter.cpp.
+ +Referenced by cleanup(), convertFeatures(), resizeFL(), resizeFS(), and resizeFV().
+ +std::map<Plugin *, std::vector<size_t> > Vamp::PluginAdapterBase::Impl::m_fsizes [protected] |
+
+ +
Definition at line 120 of file PluginAdapter.cpp.
+ +Referenced by cleanup(), convertFeatures(), resizeFL(), and resizeFS().
+ +std::map<Plugin *, std::vector<std::vector<size_t> > > Vamp::PluginAdapterBase::Impl::m_fvsizes [protected] |
+
+ +
Definition at line 121 of file PluginAdapter.cpp.
+ +Referenced by cleanup(), convertFeatures(), resizeFL(), resizeFS(), and resizeFV().
+ ++
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] |
#include <PluginBase.h>
++
+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 59 of file PluginBase.h.
+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. | |
Classes | |
struct | ParameterDescriptor |
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList | +
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList | +
+ +
Definition at line 217 of file PluginBase.h.
+ ++
virtual Vamp::PluginBase::~PluginBase | +( | ++ | ) | + [inline, virtual] |
+
+ +
Definition at line 62 of file 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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getIdentifier(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getName(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::HostExt::PluginWrapper::getDescription(), Vamp::PluginAdapterBase::Impl::getDescriptor(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginWrapper::getMaker(), 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, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCopyright(), and Vamp::PluginAdapterBase::Impl::getDescriptor().
+ +virtual int Vamp::PluginBase::getPluginVersion | +( | ++ | ) | + const [pure virtual] |
+
+Get the version number of the plugin. +
+ +
Implemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, PercussionOnsetDetector, SpectralCentroid, and ZeroCrossing.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPluginVersion().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | ++ | ) | + const [inline, virtual] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 200 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getParameterDescriptors().
+ +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, and PercussionOnsetDetector.
+ +Definition at line 208 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getParameter().
+ +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::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 214 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::setParameter().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +virtual std::string Vamp::PluginBase::getCurrentProgram | +( | ++ | ) | + const [inline, virtual] |
+
+Get the current program. +
+ +
Reimplemented in Vamp::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ +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.
+ ++
#include <vamp-sdk/PluginHostAdapter.h>
++
+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 64 of file 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 |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
Vamp::PluginHostAdapter::PluginHostAdapter | +( | +const VampPluginDescriptor * | +descriptor, | +|
+ | + | float | +inputSampleRate | + |
+ | ) | ++ |
+ +
Definition at line 43 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::instantiate, m_descriptor, and m_handle.
+ +Vamp::PluginHostAdapter::~PluginHostAdapter | +( | ++ | ) | + [virtual] |
+
+ +
Definition at line 55 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::cleanup, m_descriptor, and m_handle.
+ ++
std::vector< std::string > Vamp::PluginHostAdapter::getPluginPath | +( | ++ | ) | + [static] |
+
+ +
Definition at line 62 of file PluginHostAdapter.cpp.
+ +References DEFAULT_VAMP_PATH, and PATH_SEPARATOR.
+ +Referenced by Vamp::HostExt::PluginLoader::Impl::enumeratePlugins(), and Vamp::HostExt::PluginLoader::Impl::generateTaxonomy().
+ +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.
+ +Definition at line 118 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::initialise, m_descriptor, and m_handle.
+ +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.
+ +Definition at line 128 of file PluginHostAdapter.cpp.
+ +References m_descriptor, m_handle, and _VampPluginDescriptor::reset.
+ +PluginHostAdapter::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 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 135 of file PluginHostAdapter.cpp.
+ +References Vamp::Plugin::FrequencyDomain, _VampPluginDescriptor::inputDomain, m_descriptor, Vamp::Plugin::TimeDomain, and vampFrequencyDomain.
+ +unsigned int Vamp::PluginHostAdapter::getVampApiVersion | +( | ++ | ) | + const [virtual] |
+
+Get the Vamp API compatibility level of the plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 145 of file PluginHostAdapter.cpp.
+ +References m_descriptor, and _VampPluginDescriptor::vampApiVersion.
+ +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.
+ +Definition at line 151 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::identifier, and m_descriptor.
+ +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.
+ +Definition at line 157 of file PluginHostAdapter.cpp.
+ +References m_descriptor, and _VampPluginDescriptor::name.
+ +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.
+ +Definition at line 163 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::description, and m_descriptor.
+ +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.
+ +Definition at line 169 of file PluginHostAdapter.cpp.
+ +References m_descriptor, and _VampPluginDescriptor::maker.
+ +int Vamp::PluginHostAdapter::getPluginVersion | +( | ++ | ) | + const [virtual] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 175 of file PluginHostAdapter.cpp.
+ +References m_descriptor, and _VampPluginDescriptor::pluginVersion.
+ +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.
+ +Definition at line 181 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::copyright, and m_descriptor.
+ +PluginHostAdapter::ParameterList Vamp::PluginHostAdapter::getParameterDescriptors | +( | ++ | ) | + const [virtual] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 187 of file PluginHostAdapter.cpp.
+ +References _VampParameterDescriptor::defaultValue, Vamp::PluginBase::ParameterDescriptor::defaultValue, _VampParameterDescriptor::description, Vamp::PluginBase::ParameterDescriptor::description, _VampParameterDescriptor::identifier, Vamp::PluginBase::ParameterDescriptor::identifier, _VampParameterDescriptor::isQuantized, Vamp::PluginBase::ParameterDescriptor::isQuantized, m_descriptor, _VampParameterDescriptor::maxValue, Vamp::PluginBase::ParameterDescriptor::maxValue, _VampParameterDescriptor::minValue, Vamp::PluginBase::ParameterDescriptor::minValue, _VampParameterDescriptor::name, Vamp::PluginBase::ParameterDescriptor::name, _VampPluginDescriptor::parameterCount, _VampPluginDescriptor::parameters, _VampParameterDescriptor::quantizeStep, Vamp::PluginBase::ParameterDescriptor::quantizeStep, _VampParameterDescriptor::unit, Vamp::PluginBase::ParameterDescriptor::unit, Vamp::PluginBase::ParameterDescriptor::valueNames, and _VampParameterDescriptor::valueNames.
+ +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.
+ +Definition at line 213 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::getParameter, _VampParameterDescriptor::identifier, m_descriptor, m_handle, _VampPluginDescriptor::parameterCount, and _VampPluginDescriptor::parameters.
+ +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.
+ +Definition at line 227 of file PluginHostAdapter.cpp.
+ +References _VampParameterDescriptor::identifier, m_descriptor, m_handle, _VampPluginDescriptor::parameterCount, _VampPluginDescriptor::parameters, and _VampPluginDescriptor::setParameter.
+ +PluginHostAdapter::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.
+ +Definition at line 241 of file PluginHostAdapter.cpp.
+ +References m_descriptor, _VampPluginDescriptor::programCount, and _VampPluginDescriptor::programs.
+ +std::string Vamp::PluginHostAdapter::getCurrentProgram | +( | ++ | ) | + const [virtual] |
+
+Get the current program. +
+ +
Reimplemented from Vamp::PluginBase.
+ +Definition at line 253 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::getCurrentProgram, m_descriptor, m_handle, and _VampPluginDescriptor::programs.
+ +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.
+ +Definition at line 262 of file PluginHostAdapter.cpp.
+ +References m_descriptor, m_handle, _VampPluginDescriptor::programCount, _VampPluginDescriptor::programs, and _VampPluginDescriptor::selectProgram.
+ +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.
+ +Definition at line 275 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::getPreferredStepSize, m_descriptor, and m_handle.
+ +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.
+ +Definition at line 282 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::getPreferredBlockSize, m_descriptor, and m_handle.
+ +size_t Vamp::PluginHostAdapter::getMinChannelCount | +( | ++ | ) | + const [virtual] |
+
+Get the minimum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 289 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::getMinChannelCount, m_descriptor, and m_handle.
+ +size_t Vamp::PluginHostAdapter::getMaxChannelCount | +( | ++ | ) | + const [virtual] |
+
+Get the maximum supported number of input channels. +
+ +
Reimplemented from Vamp::Plugin.
+ +Definition at line 296 of file PluginHostAdapter.cpp.
+ +References _VampPluginDescriptor::getMaxChannelCount, m_descriptor, and m_handle.
+ +PluginHostAdapter::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.
+ +Definition at line 303 of file PluginHostAdapter.cpp.
+ +References _VampOutputDescriptor::binCount, Vamp::Plugin::OutputDescriptor::binCount, _VampOutputDescriptor::binNames, Vamp::Plugin::OutputDescriptor::binNames, _VampOutputDescriptor::description, Vamp::Plugin::OutputDescriptor::description, Vamp::Plugin::OutputDescriptor::FixedSampleRate, _VampPluginDescriptor::getOutputCount, _VampPluginDescriptor::getOutputDescriptor, _VampOutputDescriptor::hasFixedBinCount, Vamp::Plugin::OutputDescriptor::hasFixedBinCount, _VampOutputDescriptor::hasKnownExtents, Vamp::Plugin::OutputDescriptor::hasKnownExtents, _VampOutputDescriptor::identifier, Vamp::Plugin::OutputDescriptor::identifier, _VampOutputDescriptor::isQuantized, Vamp::Plugin::OutputDescriptor::isQuantized, m_descriptor, m_handle, _VampOutputDescriptor::maxValue, Vamp::Plugin::OutputDescriptor::maxValue, _VampOutputDescriptor::minValue, Vamp::Plugin::OutputDescriptor::minValue, _VampOutputDescriptor::name, Vamp::Plugin::OutputDescriptor::name, Vamp::Plugin::OutputDescriptor::OneSamplePerStep, _VampOutputDescriptor::quantizeStep, Vamp::Plugin::OutputDescriptor::quantizeStep, _VampPluginDescriptor::releaseOutputDescriptor, _VampOutputDescriptor::sampleRate, Vamp::Plugin::OutputDescriptor::sampleRate, Vamp::Plugin::OutputDescriptor::sampleType, _VampOutputDescriptor::sampleType, _VampOutputDescriptor::unit, Vamp::Plugin::OutputDescriptor::unit, vampFixedSampleRate, vampOneSamplePerStep, vampVariableSampleRate, and Vamp::Plugin::OutputDescriptor::VariableSampleRate.
+ +PluginHostAdapter::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 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 353 of file PluginHostAdapter.cpp.
+ +References convertFeatures(), m_descriptor, m_handle, Vamp::RealTime::nsec, _VampPluginDescriptor::process, _VampPluginDescriptor::releaseFeatureSet, and Vamp::RealTime::sec.
+ +PluginHostAdapter::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.
+ +Definition at line 372 of file PluginHostAdapter.cpp.
+ +References convertFeatures(), _VampPluginDescriptor::getRemainingFeatures, m_descriptor, m_handle, and _VampPluginDescriptor::releaseFeatureSet.
+ +void Vamp::PluginHostAdapter::convertFeatures | +( | +VampFeatureList * | +features, | +|
+ | + | FeatureSet & | +fs | + |
+ | ) | + [protected] |
+
+ +
Definition at line 385 of file PluginHostAdapter.cpp.
+ +References _VampFeatureList::featureCount, _VampFeatureList::features, _VampPluginDescriptor::getOutputCount, _VampFeature::hasTimestamp, Vamp::Plugin::Feature::hasTimestamp, Vamp::Plugin::Feature::label, _VampFeature::label, m_descriptor, m_handle, _VampFeature::nsec, _VampFeature::sec, Vamp::Plugin::Feature::timestamp, _VampFeature::valueCount, _VampFeature::values, and Vamp::Plugin::Feature::values.
+ +Referenced by getRemainingFeatures(), and process().
+ +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.
+ + + ++
const VampPluginDescriptor* Vamp::PluginHostAdapter::m_descriptor [protected] |
+
+ +
Definition at line 109 of file PluginHostAdapter.h.
+ +Referenced by convertFeatures(), getCopyright(), getCurrentProgram(), getDescription(), getIdentifier(), getInputDomain(), getMaker(), getMaxChannelCount(), getMinChannelCount(), getName(), getOutputDescriptors(), getParameter(), getParameterDescriptors(), getPluginVersion(), getPreferredBlockSize(), getPreferredStepSize(), getPrograms(), getRemainingFeatures(), getVampApiVersion(), initialise(), PluginHostAdapter(), process(), reset(), selectProgram(), setParameter(), and ~PluginHostAdapter().
+ +VampPluginHandle Vamp::PluginHostAdapter::m_handle [protected] |
+
+ +
Definition at line 110 of file PluginHostAdapter.h.
+ +Referenced by convertFeatures(), getCurrentProgram(), getMaxChannelCount(), getMinChannelCount(), getOutputDescriptors(), getParameter(), getPreferredBlockSize(), getPreferredStepSize(), getRemainingFeatures(), initialise(), PluginHostAdapter(), process(), reset(), selectProgram(), setParameter(), and ~PluginHostAdapter().
+ +float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by ZeroCrossing::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), ZeroCrossing::process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
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] |
#include <ZeroCrossing.h>
++
Definition at line 47 of file 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 |
typedef std::vector<OutputDescriptor> Vamp::Plugin::OutputList [inherited] |
+
typedef std::vector<Feature> Vamp::Plugin::FeatureList [inherited] |
+
typedef std::map<int, FeatureList> Vamp::Plugin::FeatureSet [inherited] |
+
typedef std::vector<ParameterDescriptor> Vamp::PluginBase::ParameterList [inherited] |
+
+ +
Definition at line 195 of file PluginBase.h.
+ +typedef std::vector<std::string> Vamp::PluginBase::ProgramList [inherited] |
+
+ +
Definition at line 217 of file PluginBase.h.
+ ++
enum Vamp::Plugin::InputDomain [inherited] |
+
+
ZeroCrossing::ZeroCrossing | +( | +float | +inputSampleRate | +) | ++ |
+ +
Definition at line 45 of file ZeroCrossing.cpp.
+ +ZeroCrossing::~ZeroCrossing | +( | ++ | ) | + [virtual] |
+
+ +
Definition at line 52 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 93 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 104 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 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 57 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 63 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 69 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 75 of file ZeroCrossing.cpp.
+ +int ZeroCrossing::getPluginVersion | +( | ++ | ) | + const [virtual] |
+
+Get the version number of the plugin. +
+ +
Implements Vamp::PluginBase.
+ +Definition at line 81 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 87 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 110 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 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 141 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 190 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::PluginHostAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 171 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredBlockSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredBlockSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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::PluginHostAdapter, Vamp::HostExt::PluginBufferingAdapter, Vamp::HostExt::PluginInputDomainAdapter, Vamp::HostExt::PluginWrapper, and PercussionOnsetDetector.
+ +Definition at line 186 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getPreferredStepSize(), Vamp::HostExt::PluginInputDomainAdapter::Impl::getPreferredStepSize(), Vamp::HostExt::PluginBufferingAdapter::Impl::initialise(), 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 191 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMinChannelCount(), initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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 196 of file Plugin.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getMaxChannelCount(), initialise(), SpectralCentroid::initialise(), Vamp::HostExt::PluginChannelAdapter::Impl::initialise(), PercussionOnsetDetector::initialise(), AmplitudeFollower::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.
+ + + +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 67 of file PluginBase.h.
+ +Referenced by enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getVampApiVersion().
+ +virtual ParameterList Vamp::PluginBase::getParameterDescriptors | +( | ++ | ) | + const [inline, virtual, inherited] |
+
+Get the controllable parameters of this plugin. +
+ +
Reimplemented in Vamp::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 200 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getParameterDescriptors().
+ +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, and PercussionOnsetDetector.
+ +Definition at line 208 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getParameter().
+ +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::PluginHostAdapter, Vamp::HostExt::PluginWrapper, AmplitudeFollower, and PercussionOnsetDetector.
+ +Definition at line 214 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::setParameter().
+ +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 229 of file PluginBase.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::HostExt::PluginWrapper::getPrograms().
+ +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 234 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::getCurrentProgram().
+ +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::PluginHostAdapter, and Vamp::HostExt::PluginWrapper.
+ +Definition at line 240 of file PluginBase.h.
+ +Referenced by Vamp::HostExt::PluginWrapper::selectProgram().
+ ++
size_t ZeroCrossing::m_stepSize [protected] |
+
+ +
Definition at line 73 of file ZeroCrossing.h.
+ +Referenced by initialise(), and process().
+ +float ZeroCrossing::m_previousSample [protected] |
+
float Vamp::Plugin::m_inputSampleRate [protected, inherited] |
+
+ +
Definition at line 397 of file Plugin.h.
+ +Referenced by getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), Vamp::HostExt::PluginRateExtractor::getRate(), AmplitudeFollower::initialise(), Vamp::HostExt::PluginBufferingAdapter::PluginBufferingAdapter(), Vamp::HostExt::PluginInputDomainAdapter::PluginInputDomainAdapter(), process(), SpectralCentroid::process(), and PercussionOnsetDetector::process().
+ ++
+ +
+
Files | |
file | AmplitudeFollower.cpp [code] |
file | AmplitudeFollower.h [code] |
file | PercussionOnsetDetector.cpp [code] |
file | PercussionOnsetDetector.h [code] |
file | plugins.cpp [code] |
file | SpectralCentroid.cpp [code] |
file | SpectralCentroid.h [code] |
file | ZeroCrossing.cpp [code] |
file | ZeroCrossing.h [code] |
+ +
+
Directories | |
directory | hostext |
Files | |
file | doc-overview [code] |
file | Plugin.h [code] |
file | PluginAdapter.cpp [code] |
file | PluginAdapter.h [code] |
file | PluginBase.h [code] |
file | PluginHostAdapter.cpp [code] |
file | PluginHostAdapter.h [code] |
file | RealTime.cpp [code] |
file | RealTime.h [code] |
+ +
+
Files | |
file | system.h [code] |
file | vamp-simple-host.cpp [code] |
+ +
+
Files | |
file | PluginBufferingAdapter.cpp [code] |
file | PluginBufferingAdapter.h [code] |
file | PluginChannelAdapter.cpp [code] |
file | PluginChannelAdapter.h [code] |
file | PluginInputDomainAdapter.cpp [code] |
file | PluginInputDomainAdapter.h [code] |
file | PluginLoader.cpp [code] |
file | PluginLoader.h [code] |
file | PluginWrapper.cpp [code] |
file | PluginWrapper.h [code] |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
++
+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; +}; +
MAX_DOT_GRAPH_HEIGHT
tag in the configuration file is set to 240 this will result in the following graph:+
+The boxes in the above graph have the following meaning:
+This inheritance list is sorted roughly, but not completely, alphabetically:
+
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
+
+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 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.
+The following example plugins are provided:
+
+
+
+
+Starting with version 1.1 of the Vamp SDK, there are several classes in the Vamp::HostExt namespace that aim to make the host's life as easy as possible:
+
+
+
+
+The PluginLoader class can also use the input domain and channel adapters automatically to make the entire conversion process transparent to the host if required.
+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.
+Our suggestion for a 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 API itself.
+There is an example host in the "host" directory from which code may be drawn.
+Be aware that FFTW is licensed under the GPL -- unlike this SDK, which is provided under a more liberal BSD license in order to permit use in closed source applications. The use of FFTW would mean that your code would need to be licensed under the GPL as well. Do not define this symbol unless you understand and accept the implications of this.
+Parties such as Linux distribution packagers who redistribute this SDK for use in other programs should _not_ define this symbol, as it would change the effective licensing terms under which the SDK was available to third party developers.
+The default is not to use FFTW, and to use the built-in FFT instead.
+Note: The FFTW code uses FFTW_MEASURE, and so will perform badly on its first invocation unless the host has saved and restored FFTW wisdom (see the FFTW documentation). +
+ +
+
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 | 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... | |
class | RealTime |
RealTime represents time values to nanosecond precision with accurate arithmetic and frame-rate conversion functions. More... | |
Namespaces | |
namespace | HostExt |
Functions | |
std::ostream & | operator<< (std::ostream &out, const RealTime &rt) |
std::ostream & Vamp::operator<< | +( | +std::ostream & | +out, | +|
+ | + | const RealTime & | +rt | + |
+ | ) | ++ |
+ +
Definition at line 110 of file RealTime.cpp.
+ +References Vamp::RealTime::nsec, ONE_BILLION, Vamp::RealTime::sec, and Vamp::RealTime::zeroTime.
+ ++
+ +
+
Classes | |
class | 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... | |
class | 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... | |
class | PluginInputDomainAdapter |
PluginInputDomainAdapter is a Vamp plugin adapter that converts time-domain input into frequency-domain input for plugins that need it. More... | |
class | 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... | |
class | PluginRateExtractor |
class | PluginWrapper |
PluginWrapper is a simple base class for adapter plugins. More... |
+
+
Vamp | If you want to compile using FFTW instead of the built-in FFT implementation for the PluginInputDomainAdapter, define HAVE_FFTW3 in the Makefile |
Vamp::HostExt |
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 "vamp/vamp.h" +00038 #include "vamp-sdk/PluginAdapter.h" +00039 +00040 #include "ZeroCrossing.h" +00041 #include "SpectralCentroid.h" +00042 #include "PercussionOnsetDetector.h" +00043 #include "AmplitudeFollower.h" +00044 +00045 static Vamp::PluginAdapter<ZeroCrossing> zeroCrossingAdapter; +00046 static Vamp::PluginAdapter<SpectralCentroid> spectralCentroidAdapter; +00047 static Vamp::PluginAdapter<PercussionOnsetDetector> percussionOnsetAdapter; +00048 static Vamp::PluginAdapter<AmplitudeFollower> amplitudeAdapter; +00049 +00050 const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int version, +00051 unsigned int index) +00052 { +00053 if (version < 1) return 0; +00054 +00055 switch (index) { +00056 case 0: return zeroCrossingAdapter.getDescriptor(); +00057 case 1: return spectralCentroidAdapter.getDescriptor(); +00058 case 2: return percussionOnsetAdapter.getDescriptor(); +00059 case 3: return amplitudeAdapter.getDescriptor(); +00060 default: return 0; +00061 } +00062 } +00063 +
+ +
+Go to the source code of this file.
Functions | |
const VampPluginDescriptor * | vampGetPluginDescriptor (unsigned int version, unsigned int index) |
Get the descriptor for a given plugin index in this library. | |
Variables | |
static Vamp::PluginAdapter +< ZeroCrossing > | zeroCrossingAdapter |
static Vamp::PluginAdapter +< SpectralCentroid > | spectralCentroidAdapter |
static Vamp::PluginAdapter +< PercussionOnsetDetector > | percussionOnsetAdapter |
static Vamp::PluginAdapter +< AmplitudeFollower > | amplitudeAdapter |
const VampPluginDescriptor* vampGetPluginDescriptor | +( | +unsigned int | +hostApiVersion, | +|
+ | + | unsigned int | +index | + |
+ | ) | ++ |
+Get the descriptor for a given plugin index in this library. +
+Return NULL if the index is outside the range of valid indices for this plugin library.
+The hostApiVersion argument tells the library code the highest Vamp API version supported by the host. The function should return a plugin descriptor compatible with the highest API version supported by the library that is no higher than that supported by the host. Provided the descriptor has the correct vampApiVersion field for its actual compatibility level, the host should be able to do the right thing with it: use it if possible, discard it otherwise.
+This is the only symbol that a Vamp plugin actually needs to export from its shared object; all others can be hidden. See the accompanying documentation for notes on how to achieve this with certain compilers. +
Definition at line 50 of file plugins.cpp.
+ +References Vamp::PluginAdapterBase::getDescriptor().
+ ++
Vamp::PluginAdapter<ZeroCrossing> zeroCrossingAdapter [static] |
+
+ +
Definition at line 45 of file plugins.cpp.
+ +Vamp::PluginAdapter<SpectralCentroid> spectralCentroidAdapter [static] |
+
+ +
Definition at line 46 of file plugins.cpp.
+ +Vamp::PluginAdapter<PercussionOnsetDetector> percussionOnsetAdapter [static] |
+
+ +
Definition at line 47 of file plugins.cpp.
+ +Vamp::PluginAdapter<AmplitudeFollower> amplitudeAdapter [static] |
+
+ +
Definition at line 48 of file plugins.cpp.
+ ++
#include <PluginBase.h>
++ +
Definition at line 125 of file PluginBase.h.
+Public Attributes | |
std::string | identifier |
The name of the parameter, in computer-usable form. | |
std::string | name |
The human-readable name of the parameter. | |
std::string | description |
A human-readable short text describing the parameter. | |
std::string | unit |
The unit of the parameter, in human-readable form. | |
float | minValue |
The minimum value of the parameter. | |
float | maxValue |
The maximum value of the parameter. | |
float | defaultValue |
The default value of the parameter. | |
bool | isQuantized |
True if the parameter values are quantized to a particular resolution. | |
float | quantizeStep |
Quantization resolution of the parameter values (e.g. | |
std::vector< std::string > | valueNames |
Names for the quantized values. |
std::string Vamp::PluginBase::ParameterDescriptor::identifier | +
+The name of the parameter, in computer-usable form. +
+Should be reasonably short, and may only contain the characters [a-zA-Z0-9_-]. +
Definition at line 132 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +std::string Vamp::PluginBase::ParameterDescriptor::name | +
+The human-readable name of the parameter. +
+ +
Definition at line 137 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +std::string Vamp::PluginBase::ParameterDescriptor::description | +
+A human-readable short text describing the parameter. +
+May be empty if the name has said it all already. +
Definition at line 143 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +std::string Vamp::PluginBase::ParameterDescriptor::unit | +
+The unit of the parameter, in human-readable form. +
+ +
Definition at line 148 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +float Vamp::PluginBase::ParameterDescriptor::minValue | +
+The minimum value of the parameter. +
+ +
Definition at line 153 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +float Vamp::PluginBase::ParameterDescriptor::maxValue | +
+The maximum value of the parameter. +
+ +
Definition at line 158 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +float Vamp::PluginBase::ParameterDescriptor::defaultValue | +
+The default value of the parameter. +
+The plugin should ensure that parameters have this value on initialisation (i.e. the host is not required to explicitly set parameters if it wants to use their default values). +
Definition at line 166 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +bool Vamp::PluginBase::ParameterDescriptor::isQuantized | +
+True if the parameter values are quantized to a particular resolution. +
+ +
Definition at line 172 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors(), PercussionOnsetDetector::getParameterDescriptors(), and AmplitudeFollower::getParameterDescriptors().
+ +float Vamp::PluginBase::ParameterDescriptor::quantizeStep | +
+Quantization resolution of the parameter values (e.g. +
+1.0 if they are all integers). Undefined if isQuantized is false. +
Definition at line 179 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors().
+ +std::vector<std::string> Vamp::PluginBase::ParameterDescriptor::valueNames | +
+Names for the quantized values. +
+If isQuantized is true, this may either be empty or contain one string for each of the quantize steps from minValue up to maxValue inclusive. Undefined if isQuantized is false.
+If these names are provided, they should be shown to the user in preference to the values themselves. The user may never see the actual numeric values unless they are also encoded in the names. +
Definition at line 192 of file PluginBase.h.
+ +Referenced by Vamp::PluginHostAdapter::getParameterDescriptors().
+ ++
hasTimestamp | Vamp::Plugin::Feature | |
label | Vamp::Plugin::Feature | |
timestamp | Vamp::Plugin::Feature | |
values | Vamp::Plugin::Feature |
#include <Plugin.h>
++ +
Definition at line 318 of file Plugin.h.
+Public Attributes | |
bool | hasTimestamp |
True if an output feature has its own timestamp. | |
RealTime | timestamp |
Timestamp of the output feature. | |
std::vector< float > | values |
Results for a single sample of this feature. | |
std::string | label |
Label for the sample of this feature. |
bool Vamp::Plugin::Feature::hasTimestamp | +
+True if an output feature has its own timestamp. +
+This is mandatory if the output has VariableSampleRate, and is likely to be disregarded otherwise. +
Definition at line 325 of file Plugin.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and AmplitudeFollower::process().
+ +RealTime Vamp::Plugin::Feature::timestamp | +
+Timestamp of the output feature. +
+This is mandatory if the output has VariableSampleRate, and is likely to be disregarded otherwise. Undefined if hasTimestamp is false. +
Definition at line 332 of file Plugin.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), ZeroCrossing::process(), and PercussionOnsetDetector::process().
+ +std::vector<float> Vamp::Plugin::Feature::values | +
+Results for a single sample of this feature. +
+If the output hasFixedBinCount, there must be the same number of values as the output's binCount count. +
Definition at line 339 of file Plugin.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), ZeroCrossing::process(), SpectralCentroid::process(), PercussionOnsetDetector::process(), and AmplitudeFollower::process().
+ +std::string Vamp::Plugin::Feature::label | +
+Label for the sample of this feature. +
+ +
Definition at line 344 of file Plugin.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures().
+ ++
#include <Plugin.h>
++ +
Definition at line 198 of file Plugin.h.
+Public Types | |
enum | SampleType { OneSamplePerStep, +FixedSampleRate, +VariableSampleRate + } |
Public Attributes | |
std::string | identifier |
The name of the output, in computer-usable form. | |
std::string | name |
The human-readable name of the output. | |
std::string | description |
A human-readable short text describing the output. | |
std::string | unit |
The unit of the output, in human-readable form. | |
bool | hasFixedBinCount |
True if the output has the same number of values per sample for every output sample. | |
size_t | binCount |
The number of values per result of the output. | |
std::vector< std::string > | binNames |
The (human-readable) names of each of the bins, if appropriate. | |
bool | hasKnownExtents |
True if the results in each output bin fall within a fixed numeric range (minimum and maximum values). | |
float | minValue |
Minimum value of the results in the output. | |
float | maxValue |
Maximum value of the results in the output. | |
bool | isQuantized |
True if the output values are quantized to a particular resolution. | |
float | quantizeStep |
Quantization resolution of the output values (e.g. | |
SampleType | sampleType |
Positioning in time of the output results. | |
float | sampleRate |
Sample rate of the output results, as samples per second. |
enum Vamp::Plugin::OutputDescriptor::SampleType | +
+
OneSamplePerStep | +Results from each process() align with that call's block start. |
FixedSampleRate | +Results are evenly spaced in time (sampleRate specified below). |
VariableSampleRate | +Results are unevenly spaced and have individual timestamps. |
+
std::string Vamp::Plugin::OutputDescriptor::identifier | +
+The name of the output, in computer-usable form. +
+Should be reasonably short and without whitespace or punctuation, using the characters [a-zA-Z0-9_-] only. Example: "zero_crossing_count" +
Definition at line 206 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +std::string Vamp::Plugin::OutputDescriptor::name | +
+The human-readable name of the output. +
+Example: "Zero Crossing Counts" +
Definition at line 212 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +std::string Vamp::Plugin::OutputDescriptor::description | +
+A human-readable short text describing the output. +
+May be empty if the name has said it all already. Example: "The number of zero crossing points per processing block" +
Definition at line 219 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +std::string Vamp::Plugin::OutputDescriptor::unit | +
+The unit of the output, in human-readable form. +
+ +
Definition at line 224 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +bool Vamp::Plugin::OutputDescriptor::hasFixedBinCount | +
+True if the output has the same number of values per sample for every output sample. +
+Outputs for which this is false are unlikely to be very useful in a general-purpose host. +
Definition at line 231 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +size_t Vamp::Plugin::OutputDescriptor::binCount | +
+The number of values per result of the output. +
+Undefined if hasFixedBinCount is false. If this is zero, the output is point data (i.e. only the time of each output is of interest, the value list will be empty). +
Definition at line 239 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +std::vector<std::string> Vamp::Plugin::OutputDescriptor::binNames | +
+The (human-readable) names of each of the bins, if appropriate. +
+This is always optional. +
Definition at line 245 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +bool Vamp::Plugin::OutputDescriptor::hasKnownExtents | +
+True if the results in each output bin fall within a fixed numeric range (minimum and maximum values). +
+Undefined if binCount is zero. +
Definition at line 252 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +float Vamp::Plugin::OutputDescriptor::minValue | +
+Minimum value of the results in the output. +
+Undefined if hasKnownExtents is false or binCount is zero. +
Definition at line 258 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +float Vamp::Plugin::OutputDescriptor::maxValue | +
+Maximum value of the results in the output. +
+Undefined if hasKnownExtents is false or binCount is zero. +
Definition at line 264 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +bool Vamp::Plugin::OutputDescriptor::isQuantized | +
+True if the output values are quantized to a particular resolution. +
+Undefined if binCount is zero. +
Definition at line 270 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +float Vamp::Plugin::OutputDescriptor::quantizeStep | +
+Quantization resolution of the output values (e.g. +
+1.0 if they are all integers). Undefined if isQuantized is false or binCount is zero. +
Definition at line 277 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), and PercussionOnsetDetector::getOutputDescriptors().
+ +SampleType Vamp::Plugin::OutputDescriptor::sampleType | +
+Positioning in time of the output results. +
+ +
Definition at line 294 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), SpectralCentroid::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), PercussionOnsetDetector::getOutputDescriptors(), and AmplitudeFollower::getOutputDescriptors().
+ +float Vamp::Plugin::OutputDescriptor::sampleRate | +
+Sample rate of the output results, as samples per second. +
+Undefined if sampleType is OneSamplePerStep.
+If sampleType is VariableSampleRate and this value is non-zero, then it may be used to calculate a resolution for the output (i.e. the "duration" of each sample, in time, will be 1/sampleRate seconds). It's recommended to set this to zero if that behaviour is not desired. +
Definition at line 306 of file Plugin.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), ZeroCrossing::getOutputDescriptors(), Vamp::PluginHostAdapter::getOutputDescriptors(), and PercussionOnsetDetector::getOutputDescriptors().
+ ++
#include <vamp-sdk/RealTime.h>
++ +
Definition at line 63 of file RealTime.h.
+Public Member Functions | |
int | usec () const |
int | msec () const |
RealTime () | |
RealTime (int s, int n) | |
RealTime (const RealTime &r) | |
RealTime & | operator= (const RealTime &r) |
RealTime | operator+ (const RealTime &r) const |
RealTime | operator- (const RealTime &r) const |
RealTime | operator- () const |
bool | operator< (const RealTime &r) const |
bool | operator> (const RealTime &r) const |
bool | operator== (const RealTime &r) const |
bool | operator!= (const RealTime &r) const |
bool | operator>= (const RealTime &r) const |
bool | operator<= (const RealTime &r) const |
RealTime | operator/ (int d) const |
double | operator/ (const RealTime &r) const |
Return the ratio of two times. | |
std::string | toString () const |
Return a human-readable debug-type string to full precision (probably not a format to show to a user directly). | |
std::string | toText (bool fixedDp=false) const |
Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm. | |
Static Public Member Functions | |
static RealTime | fromSeconds (double sec) |
static RealTime | fromMilliseconds (int msec) |
static RealTime | fromTimeval (const struct timeval &) |
static long | realTime2Frame (const RealTime &r, unsigned int sampleRate) |
Convert a RealTime into a sample frame at the given sample rate. | |
static RealTime | frame2RealTime (long frame, unsigned int sampleRate) |
Convert a sample frame at the given sample rate into a RealTime. | |
Public Attributes | |
int | sec |
int | nsec |
Static Public Attributes | |
static const RealTime | zeroTime |
Vamp::RealTime::RealTime | +( | ++ | ) | + [inline] |
+
+ +
Definition at line 71 of file RealTime.h.
+ +Referenced by fromMilliseconds(), fromSeconds(), fromTimeval(), operator+(), operator-(), and operator/().
+ +Vamp::RealTime::RealTime | +( | +int | +s, | +|
+ | + | int | +n | + |
+ | ) | ++ |
Vamp::RealTime::RealTime | +( | +const RealTime & | +r | +) | + [inline] |
+
+ +
Definition at line 74 of file RealTime.h.
+ ++
int Vamp::RealTime::usec | +( | ++ | ) | + const [inline] |
+
int Vamp::RealTime::msec | +( | ++ | ) | + const [inline] |
+
RealTime Vamp::RealTime::fromSeconds | +( | +double | +sec | +) | + [static] |
+
RealTime Vamp::RealTime::fromMilliseconds | +( | +int | +msec | +) | + [static] |
+
RealTime Vamp::RealTime::fromTimeval | +( | +const struct timeval & | +tv | +) | + [static] |
+
RealTime Vamp::RealTime::operator- | +( | ++ | ) | + const [inline] |
+
bool Vamp::RealTime::operator< | +( | +const RealTime & | +r | +) | + const [inline] |
+
bool Vamp::RealTime::operator> | +( | +const RealTime & | +r | +) | + const [inline] |
+
bool Vamp::RealTime::operator== | +( | +const RealTime & | +r | +) | + const [inline] |
+
bool Vamp::RealTime::operator!= | +( | +const RealTime & | +r | +) | + const [inline] |
+
+ +
Definition at line 112 of file RealTime.h.
+ +bool Vamp::RealTime::operator>= | +( | +const RealTime & | +r | +) | + const [inline] |
+
bool Vamp::RealTime::operator<= | +( | +const RealTime & | +r | +) | + const [inline] |
+
RealTime Vamp::RealTime::operator/ | +( | +int | +d | +) | +const | +
+ +
Definition at line 203 of file RealTime.cpp.
+ +References nsec, ONE_BILLION, RealTime(), and sec.
+ +double Vamp::RealTime::operator/ | +( | +const RealTime & | +r | +) | +const | +
+Return the ratio of two times. +
+ +
Definition at line 214 of file RealTime.cpp.
+ +References nsec, ONE_BILLION, and sec.
+ +std::string Vamp::RealTime::toString | +( | ++ | ) | +const | +
+Return a human-readable debug-type string to full precision (probably not a format to show to a user directly). +
+ +
Definition at line 135 of file RealTime.cpp.
+ +References stringstream.
+ +Referenced by printFeatures().
+ +std::string Vamp::RealTime::toText | +( | +bool | + fixedDp = false |
+ ) | +const | +
+Return a user-readable string to the nearest millisecond in a form like HH:MM:SS.mmm. +
+ +
Definition at line 151 of file RealTime.cpp.
+ +References msec(), sec, stringstream, and zeroTime.
+ +long Vamp::RealTime::realTime2Frame | +( | +const RealTime & | +r, | +|
+ | + | unsigned int | +sampleRate | + |
+ | ) | + [static] |
+
+Convert a RealTime into a sample frame at the given sample rate. +
+ +
Definition at line 224 of file RealTime.cpp.
+ +References nsec, sec, and zeroTime.
+ +Referenced by Vamp::HostExt::PluginBufferingAdapter::Impl::process().
+ +RealTime Vamp::RealTime::frame2RealTime | +( | +long | +frame, | +|
+ | + | unsigned int | +sampleRate | + |
+ | ) | + [static] |
+
+Convert a sample frame at the given sample rate into a RealTime. +
+ +
Definition at line 232 of file RealTime.cpp.
+ + + +Referenced by ZeroCrossing::process(), Vamp::HostExt::PluginInputDomainAdapter::Impl::process(), PercussionOnsetDetector::process(), and Vamp::HostExt::PluginBufferingAdapter::Impl::processBlock().
+ ++
int Vamp::RealTime::sec | +
+ +
Definition at line 65 of file RealTime.h.
+ +Referenced by frame2RealTime(), operator+(), operator-(), operator/(), operator<(), Vamp::operator<<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), Vamp::PluginHostAdapter::process(), RealTime(), realTime2Frame(), and toText().
+ +int Vamp::RealTime::nsec | +
+ +
Definition at line 66 of file RealTime.h.
+ +Referenced by frame2RealTime(), msec(), operator+(), operator-(), operator/(), operator<(), Vamp::operator<<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), Vamp::PluginHostAdapter::process(), RealTime(), realTime2Frame(), and usec().
+ +const RealTime Vamp::RealTime::zeroTime [static] |
+
+ +
Definition at line 155 of file RealTime.h.
+ +Referenced by Vamp::operator<<(), realTime2Frame(), and toText().
+ ++
hasTimestamp | _VampFeature | |
label | _VampFeature | |
nsec | _VampFeature | |
sec | _VampFeature | |
valueCount | _VampFeature | |
values | _VampFeature |
#include <vamp.h>
++ +
Definition at line 165 of file vamp.h.
+Public Attributes | |
int | hasTimestamp |
1 if the feature has a timestamp (i.e. | |
int | sec |
Seconds component of timestamp. | |
int | nsec |
Nanoseconds component of timestamp. | |
unsigned int | valueCount |
Number of values. | |
float * | values |
Values for this returned sample. | |
char * | label |
Label for this returned sample. |
int _VampFeature::hasTimestamp | +
+1 if the feature has a timestamp (i.e. +
+if vampVariableSampleRate). +
Definition at line 168 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ +int _VampFeature::sec | +
+Seconds component of timestamp. +
+ +
Definition at line 171 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ +int _VampFeature::nsec | +
+Nanoseconds component of timestamp. +
+ +
Definition at line 174 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ +unsigned int _VampFeature::valueCount | +
+Number of values. +
+Must be binCount if hasFixedBinCount. +
Definition at line 177 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ +float* _VampFeature::values | +
+Values for this returned sample. +
+ +
Definition at line 180 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ +char* _VampFeature::label | +
+Label for this returned sample. +
+May be NULL. +
Definition at line 183 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ ++
featureCount | _VampFeatureList | |
features | _VampFeatureList |
#include <vamp.h>
++ +
Definition at line 187 of file vamp.h.
+Public Attributes | |
unsigned int | featureCount |
Number of features in this feature list. | |
VampFeature * | features |
Features in this feature list. |
unsigned int _VampFeatureList::featureCount | +
+Number of features in this feature list. +
+ +
Definition at line 190 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ +VampFeature* _VampFeatureList::features | +
+Features in this feature list. +
+May be NULL if featureCount is zero. +
Definition at line 193 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::convertFeatures(), and Vamp::PluginAdapterBase::Impl::convertFeatures().
+ ++
#include <vamp.h>
++ +
Definition at line 118 of file vamp.h.
+Public Attributes | |
const char * | identifier |
Computer-usable name of the output. | |
const char * | name |
Human-readable name of the output. | |
const char * | description |
Human-readable short text about the output. | |
const char * | unit |
Human-readable name of the unit of the output. | |
int | hasFixedBinCount |
1 if output has equal number of values for each returned result. | |
unsigned int | binCount |
Number of values per result, if hasFixedBinCount. | |
const char ** | binNames |
Names of returned value bins, if hasFixedBinCount. | |
int | hasKnownExtents |
1 if each returned value falls within the same fixed min/max range. | |
float | minValue |
Minimum value for a returned result in any bin, if hasKnownExtents. | |
float | maxValue |
Maximum value for a returned result in any bin, if hasKnownExtents. | |
int | isQuantized |
1 if returned results are quantized to a particular resolution. | |
float | quantizeStep |
Quantization resolution for returned results, if isQuantized. | |
VampSampleType | sampleType |
Time positioning method for returned results (see VampSampleType). | |
float | sampleRate |
Sample rate of returned results, if sampleType is vampFixedSampleRate. |
const char* _VampOutputDescriptor::identifier | +
+Computer-usable name of the output. +
+Must not change. [a-zA-Z0-9_] +
Definition at line 121 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +const char* _VampOutputDescriptor::name | +
+Human-readable name of the output. +
+May be translatable. +
Definition at line 124 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +const char* _VampOutputDescriptor::description | +
+Human-readable short text about the output. +
+May be translatable. +
Definition at line 127 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +const char* _VampOutputDescriptor::unit | +
+Human-readable name of the unit of the output. +
+ +
Definition at line 130 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +int _VampOutputDescriptor::hasFixedBinCount | +
+1 if output has equal number of values for each returned result. +
+ +
Definition at line 133 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +unsigned int _VampOutputDescriptor::binCount | +
+Number of values per result, if hasFixedBinCount. +
+ +
Definition at line 136 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +const char** _VampOutputDescriptor::binNames | +
+Names of returned value bins, if hasFixedBinCount. +
+May be NULL. +
Definition at line 139 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), Vamp::PluginHostAdapter::getOutputDescriptors(), and Vamp::PluginAdapterBase::Impl::vampReleaseOutputDescriptor().
+ +int _VampOutputDescriptor::hasKnownExtents | +
+1 if each returned value falls within the same fixed min/max range. +
+ +
Definition at line 142 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +float _VampOutputDescriptor::minValue | +
+Minimum value for a returned result in any bin, if hasKnownExtents. +
+ +
Definition at line 145 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +float _VampOutputDescriptor::maxValue | +
+Maximum value for a returned result in any bin, if hasKnownExtents. +
+ +
Definition at line 148 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +int _VampOutputDescriptor::isQuantized | +
+1 if returned results are quantized to a particular resolution. +
+ +
Definition at line 151 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +float _VampOutputDescriptor::quantizeStep | +
+Quantization resolution for returned results, if isQuantized. +
+ +
Definition at line 154 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +VampSampleType _VampOutputDescriptor::sampleType | +
+Time positioning method for returned results (see VampSampleType). +
+ +
Definition at line 157 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +float _VampOutputDescriptor::sampleRate | +
+Sample rate of returned results, if sampleType is vampFixedSampleRate. +
+"Resolution" of result, if sampleType is vampVariableSampleRate. +
Definition at line 161 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getOutputDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ ++
#include <vamp.h>
++ +
+This is the formal plugin API for Vamp. Plugin authors may prefer to use the C++ classes provided in the Vamp plugin SDK, instead of using this API directly. There is an adapter class provided that makes C++ plugins available using this C API with relatively little work, and the C++ headers are more thoroughly documented.
+IMPORTANT: The comments in this file summarise the purpose of each of the declared fields and functions, but do not provide a complete guide to their permitted values and expected usage. Please refer to the C++ headers in the Vamp plugin SDK for further details and plugin lifecycle documentation. +
Definition at line 71 of file vamp.h.
+Public Attributes | |
const char * | identifier |
Computer-usable name of the parameter. | |
const char * | name |
Human-readable name of the parameter. | |
const char * | description |
Human-readable short text about the parameter. | |
const char * | unit |
Human-readable unit of the parameter. | |
float | minValue |
Minimum value. | |
float | maxValue |
Maximum value. | |
float | defaultValue |
Default value. | |
int | isQuantized |
1 if parameter values are quantized to a particular resolution. | |
float | quantizeStep |
Quantization resolution, if isQuantized. | |
const char ** | valueNames |
Human-readable names of the values, if isQuantized. |
const char* _VampParameterDescriptor::identifier | +
+Computer-usable name of the parameter. +
+Must not change. [a-zA-Z0-9_] +
Definition at line 74 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameter(), Vamp::PluginHostAdapter::getParameterDescriptors(), Vamp::PluginHostAdapter::setParameter(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char* _VampParameterDescriptor::name | +
+Human-readable name of the parameter. +
+May be translatable. +
Definition at line 77 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameterDescriptors(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char* _VampParameterDescriptor::description | +
+Human-readable short text about the parameter. +
+May be translatable. +
Definition at line 80 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameterDescriptors(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char* _VampParameterDescriptor::unit | +
+Human-readable unit of the parameter. +
+ +
Definition at line 83 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameterDescriptors(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +float _VampParameterDescriptor::minValue | +
+Minimum value. +
+ +
Definition at line 86 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getParameterDescriptors().
+ +float _VampParameterDescriptor::maxValue | +
+Maximum value. +
+ +
Definition at line 89 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getParameterDescriptors().
+ +float _VampParameterDescriptor::defaultValue | +
+Default value. +
+Plugin is responsible for setting this on initialise. +
Definition at line 92 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getParameterDescriptors().
+ +int _VampParameterDescriptor::isQuantized | +
+1 if parameter values are quantized to a particular resolution. +
+ +
Definition at line 95 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getParameterDescriptors().
+ +float _VampParameterDescriptor::quantizeStep | +
+Quantization resolution, if isQuantized. +
+ +
Definition at line 98 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getParameterDescriptors().
+ +const char** _VampParameterDescriptor::valueNames | +
+Human-readable names of the values, if isQuantized. +
+May be NULL. +
Definition at line 101 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameterDescriptors(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ ++
#include <vamp.h>
++ +
Definition at line 206 of file vamp.h.
+Public Attributes | |
unsigned int | vampApiVersion |
API version with which this descriptor is compatible. | |
const char * | identifier |
Computer-usable name of the plugin. | |
const char * | name |
Human-readable name of the plugin. | |
const char * | description |
Human-readable short text about the plugin. | |
const char * | maker |
Human-readable name of plugin's author or vendor. | |
int | pluginVersion |
Version number of the plugin. | |
const char * | copyright |
Human-readable summary of copyright or licensing for plugin. | |
unsigned int | parameterCount |
Number of parameter inputs. | |
const VampParameterDescriptor ** | parameters |
Fixed descriptors for parameter inputs. | |
unsigned int | programCount |
Number of programs. | |
const char ** | programs |
Fixed names for programs. | |
VampInputDomain | inputDomain |
Preferred input domain for audio input (time or frequency). | |
VampPluginHandle(* | instantiate )(const struct _VampPluginDescriptor *, float inputSampleRate) |
Create and return a new instance of this plugin. | |
void(* | cleanup )(VampPluginHandle) |
Destroy an instance of this plugin. | |
int(* | initialise )(VampPluginHandle, unsigned int inputChannels, unsigned int stepSize, unsigned int blockSize) |
Initialise an instance following parameter configuration. | |
void(* | reset )(VampPluginHandle) |
Reset an instance, ready to use again on new input data. | |
float(* | getParameter )(VampPluginHandle, int) |
Get a parameter value. | |
void(* | setParameter )(VampPluginHandle, int, float) |
Set a parameter value. | |
unsigned int(* | getCurrentProgram )(VampPluginHandle) |
Get the current program (if programCount > 0). | |
void(* | selectProgram )(VampPluginHandle, unsigned int) |
Set the current program. | |
unsigned int(* | getPreferredStepSize )(VampPluginHandle) |
Get the plugin's preferred processing window increment in samples. | |
unsigned int(* | getPreferredBlockSize )(VampPluginHandle) |
Get the plugin's preferred processing window size in samples. | |
unsigned int(* | getMinChannelCount )(VampPluginHandle) |
Get the minimum number of input channels this plugin can handle. | |
unsigned int(* | getMaxChannelCount )(VampPluginHandle) |
Get the maximum number of input channels this plugin can handle. | |
unsigned int(* | getOutputCount )(VampPluginHandle) |
Get the number of feature outputs (distinct sets of results). | |
VampOutputDescriptor *(* | getOutputDescriptor )(VampPluginHandle, unsigned int) |
Get a descriptor for a given feature output. | |
void(* | releaseOutputDescriptor )(VampOutputDescriptor *) |
Destroy a descriptor for a feature output. | |
VampFeatureList *(* | process )(VampPluginHandle, const float *const *inputBuffers, int sec, int nsec) |
Process an input block and return a set of features. | |
VampFeatureList *(* | getRemainingFeatures )(VampPluginHandle) |
Return any remaining features at the end of processing. | |
void(* | releaseFeatureSet )(VampFeatureList *) |
Release a feature set returned from process or getRemainingFeatures. |
unsigned int _VampPluginDescriptor::vampApiVersion | +
+API version with which this descriptor is compatible. +
+ +
Definition at line 209 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getVampApiVersion().
+ +const char* _VampPluginDescriptor::identifier | +
+Computer-usable name of the plugin. +
+Must not change. [a-zA-Z0-9_] +
Definition at line 212 of file vamp.h.
+ +Referenced by Vamp::HostExt::PluginLoader::Impl::enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getIdentifier(), Vamp::HostExt::PluginLoader::Impl::loadPlugin(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char* _VampPluginDescriptor::name | +
+Human-readable name of the plugin. +
+May be translatable. +
Definition at line 215 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getName(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char* _VampPluginDescriptor::description | +
+Human-readable short text about the plugin. +
+May be translatable. +
Definition at line 218 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::getDescription(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char* _VampPluginDescriptor::maker | +
+Human-readable name of plugin's author or vendor. +
+ +
Definition at line 221 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getMaker(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +int _VampPluginDescriptor::pluginVersion | +
+Version number of the plugin. +
+ +
Definition at line 224 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getPluginVersion().
+ +const char* _VampPluginDescriptor::copyright | +
+Human-readable summary of copyright or licensing for plugin. +
+ +
Definition at line 227 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::getCopyright(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +unsigned int _VampPluginDescriptor::parameterCount | +
+Number of parameter inputs. +
+ +
Definition at line 230 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameter(), Vamp::PluginHostAdapter::getParameterDescriptors(), Vamp::PluginHostAdapter::setParameter(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const VampParameterDescriptor** _VampPluginDescriptor::parameters | +
+Fixed descriptors for parameter inputs. +
+ +
Definition at line 233 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getParameter(), Vamp::PluginHostAdapter::getParameterDescriptors(), Vamp::PluginHostAdapter::setParameter(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +unsigned int _VampPluginDescriptor::programCount | +
+Number of programs. +
+ +
Definition at line 236 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getPrograms(), Vamp::PluginHostAdapter::selectProgram(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +const char** _VampPluginDescriptor::programs | +
+Fixed names for programs. +
+ +
Definition at line 239 of file vamp.h.
+ +Referenced by Vamp::PluginHostAdapter::getCurrentProgram(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getPrograms(), Vamp::PluginHostAdapter::selectProgram(), and Vamp::PluginAdapterBase::Impl::~Impl().
+ +VampInputDomain _VampPluginDescriptor::inputDomain | +
+Preferred input domain for audio input (time or frequency). +
+ +
Definition at line 242 of file vamp.h.
+ +Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getInputDomain().
+ +VampPluginHandle(* _VampPluginDescriptor::instantiate)(const struct _VampPluginDescriptor *, float inputSampleRate) | +
+Create and return a new instance of this plugin. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::PluginHostAdapter().
+ +void(* _VampPluginDescriptor::cleanup)(VampPluginHandle) | +
+Destroy an instance of this plugin. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::~PluginHostAdapter().
+ +int(* _VampPluginDescriptor::initialise)(VampPluginHandle, unsigned int inputChannels, unsigned int stepSize, unsigned int blockSize) | +
+Initialise an instance following parameter configuration. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::initialise().
+ +void(* _VampPluginDescriptor::reset)(VampPluginHandle) | +
+Reset an instance, ready to use again on new input data. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::reset().
+ +float(* _VampPluginDescriptor::getParameter)(VampPluginHandle, int) | +
+Get a parameter value. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getParameter().
+ +void(* _VampPluginDescriptor::setParameter)(VampPluginHandle, int, float) | +
+Set a parameter value. +
+May only be called before initialise. +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::setParameter().
+ +unsigned int(* _VampPluginDescriptor::getCurrentProgram)(VampPluginHandle) | +
+Get the current program (if programCount > 0). +
+ +
Referenced by Vamp::PluginHostAdapter::getCurrentProgram(), and Vamp::PluginAdapterBase::Impl::getDescriptor().
+ +void(* _VampPluginDescriptor::selectProgram)(VampPluginHandle, unsigned int) | +
+Set the current program. +
+May only be called before initialise. +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::selectProgram().
+ +unsigned int(* _VampPluginDescriptor::getPreferredStepSize)(VampPluginHandle) | +
+Get the plugin's preferred processing window increment in samples. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getPreferredStepSize().
+ +unsigned int(* _VampPluginDescriptor::getPreferredBlockSize)(VampPluginHandle) | +
+Get the plugin's preferred processing window size in samples. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getPreferredBlockSize().
+ +unsigned int(* _VampPluginDescriptor::getMinChannelCount)(VampPluginHandle) | +
+Get the minimum number of input channels this plugin can handle. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getMinChannelCount().
+ +unsigned int(* _VampPluginDescriptor::getMaxChannelCount)(VampPluginHandle) | +
+Get the maximum number of input channels this plugin can handle. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getMaxChannelCount().
+ +unsigned int(* _VampPluginDescriptor::getOutputCount)(VampPluginHandle) | +
+Get the number of feature outputs (distinct sets of results). +
+ +
Referenced by Vamp::PluginHostAdapter::convertFeatures(), Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +VampOutputDescriptor*(* _VampPluginDescriptor::getOutputDescriptor)(VampPluginHandle, unsigned int) | +
+Get a descriptor for a given feature output. +
+Returned pointer is valid only until next call to getOutputDescriptor for this handle, or releaseOutputDescriptor for this descriptor. Host must call releaseOutputDescriptor after use. +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +void(* _VampPluginDescriptor::releaseOutputDescriptor)(VampOutputDescriptor *) | +
+Destroy a descriptor for a feature output. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getOutputDescriptors().
+ +VampFeatureList*(* _VampPluginDescriptor::process)(VampPluginHandle, const float *const *inputBuffers, int sec, int nsec) | +
+Process an input block and return a set of features. +
+Returned pointer is valid only until next call to process, getRemainingFeatures, or cleanup for this handle, or releaseFeatureSet for this feature set. Host must call releaseFeatureSet after use. +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::process().
+ +VampFeatureList*(* _VampPluginDescriptor::getRemainingFeatures)(VampPluginHandle) | +
+Return any remaining features at the end of processing. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), and Vamp::PluginHostAdapter::getRemainingFeatures().
+ +void(* _VampPluginDescriptor::releaseFeatureSet)(VampFeatureList *) | +
+Release a feature set returned from process or getRemainingFeatures. +
+ +
Referenced by Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::PluginHostAdapter::getRemainingFeatures(), and Vamp::PluginHostAdapter::process().
+ ++
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 _SYSTEM_H_ +00038 #define _SYSTEM_H_ +00039 +00040 #ifdef _WIN32 +00041 +00042 #include <windows.h> +00043 +00044 #define DLOPEN(a,b) LoadLibrary((a).c_str()) +00045 #define DLSYM(a,b) GetProcAddress((HINSTANCE)(a),(b)) +00046 #define DLCLOSE(a) FreeLibrary((HINSTANCE)(a)) +00047 #define DLERROR() "" +00048 +00049 #define PLUGIN_SUFFIX "dll" +00050 +00051 #else +00052 +00053 #include <dlfcn.h> +00054 +00055 #define DLOPEN(a,b) dlopen((a).c_str(),(b)) +00056 #define DLSYM(a,b) dlsym((a),(b)) +00057 #define DLCLOSE(a) dlclose((a)) +00058 #define DLERROR() dlerror() +00059 +00060 #ifdef __APPLE__ +00061 +00062 #define PLUGIN_SUFFIX "dylib" +00063 #define HAVE_OPENDIR 1 +00064 +00065 #else +00066 +00067 #define PLUGIN_SUFFIX "so" +00068 #define HAVE_OPENDIR 1 +00069 +00070 #endif /* __APPLE__ */ +00071 +00072 #endif /* ! _WIN32 */ +00073 +00074 #endif +00075 +
+ +
+Go to the source code of this file.
Defines | |
#define | DLOPEN(a, b) dlopen((a).c_str(),(b)) |
#define | DLSYM(a, b) dlsym((a),(b)) |
#define | DLCLOSE(a) dlclose((a)) |
#define | DLERROR() dlerror() |
#define | PLUGIN_SUFFIX "so" |
#define | HAVE_OPENDIR 1 |
#define DLOPEN | +( | +a, | |||
+ | + | b | ++ | ) | +dlopen((a).c_str(),(b)) | +
#define DLSYM | +( | +a, | |||
+ | + | b | ++ | ) | +dlsym((a),(b)) | +
#define DLCLOSE | +( | +a | ++ | ) | +dlclose((a)) | +
#define DLERROR | +( | + ++ | ) | +dlerror() | +
+
Vamp::Plugin::OutputDescriptor
Vamp::PluginBase::ParameterDescriptor
Vamp::HostExt::PluginBufferingAdapter
Vamp::HostExt::PluginBufferingAdapter::Impl
Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer
Vamp::HostExt::PluginChannelAdapter
Vamp::HostExt::PluginChannelAdapter::Impl
Vamp::HostExt::PluginInputDomainAdapter
Vamp::HostExt::PluginInputDomainAdapter::Impl
Vamp::HostExt::PluginLoader::Impl
Vamp::HostExt::PluginLoader::Impl::InstanceCleaner
Vamp::HostExt::PluginLoader::Impl::PluginDeletionNotifyAdapter
Vamp::Plugin::OutputDescriptor
Vamp::PluginBase::ParameterDescriptor
Vamp::HostExt::PluginBufferingAdapter::Impl
Vamp::HostExt::PluginBufferingAdapter::Impl::RingBuffer
Vamp::HostExt::PluginChannelAdapter::Impl
Vamp::HostExt::PluginInputDomainAdapter::Impl
Vamp::HostExt::PluginLoader::Impl
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 FFT code from Don Cross's public domain FFT implementation. +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 #include "vamp-sdk/PluginHostAdapter.h" +00039 #include "vamp-sdk/hostext/PluginChannelAdapter.h" +00040 #include "vamp-sdk/hostext/PluginInputDomainAdapter.h" +00041 #include "vamp-sdk/hostext/PluginLoader.h" +00042 #include "vamp/vamp.h" +00043 +00044 #include <iostream> +00045 #include <fstream> +00046 #include <set> +00047 #include <sndfile.h> +00048 +00049 #include <cstring> +00050 #include <cstdlib> +00051 +00052 #include "system.h" +00053 +00054 #include <cmath> +00055 +00056 using namespace std; +00057 +00058 using Vamp::Plugin; +00059 using Vamp::PluginHostAdapter; +00060 using Vamp::RealTime; +00061 using Vamp::HostExt::PluginLoader; +00062 +00063 #define HOST_VERSION "1.1" +00064 +00065 enum Verbosity { +00066 PluginIds, +00067 PluginOutputIds, +00068 PluginInformation +00069 }; +00070 +00071 void printFeatures(int, int, int, Plugin::FeatureSet, ofstream *, bool frames); +00072 void transformInput(float *, size_t); +00073 void fft(unsigned int, bool, double *, double *, double *, double *); +00074 void printPluginPath(bool verbose); +00075 void printPluginCategoryList(); +00076 void enumeratePlugins(Verbosity); +00077 void listPluginsInLibrary(string soname); +00078 int runPlugin(string myname, string soname, string id, string output, +00079 int outputNo, string inputFile, string outfilename, bool frames); +00080 +00081 void usage(const char *name) +00082 { +00083 cerr << "\n" +00084 << name << ": A simple Vamp plugin host.\n\n" +00085 "Centre for Digital Music, Queen Mary, University of London.\n" +00086 "Copyright 2006-2007 Chris Cannam and QMUL.\n" +00087 "Freely redistributable; published under a BSD-style license.\n\n" +00088 "Usage:\n\n" +00089 " " << name << " [-s] pluginlibrary[." << PLUGIN_SUFFIX << "]:plugin[:output] file.wav [-o out.txt]\n" +00090 " " << name << " [-s] pluginlibrary[." << PLUGIN_SUFFIX << "]:plugin file.wav [outputno] [-o out.txt]\n\n" +00091 " -- Load plugin id \"plugin\" from \"pluginlibrary\" and run it on the\n" +00092 " audio data in \"file.wav\", retrieving the named \"output\", or output\n" +00093 " number \"outputno\" (the first output by default) and dumping it to\n" +00094 " standard output, or to \"out.txt\" if the -o option is given.\n\n" +00095 " \"pluginlibrary\" should be a library name, not a file path; the\n" +00096 " standard Vamp library search path will be used to locate it. If\n" +00097 " a file path is supplied, the directory part(s) will be ignored.\n\n" +00098 " If the -s option is given, results will be labelled with the audio\n" +00099 " sample frame at which they occur. Otherwise, they will be labelled\n" +00100 " with time in seconds.\n\n" +00101 " " << name << " -l\n\n" +00102 " -- List the plugin libraries and Vamp plugins in the library search path\n" +00103 " in a verbose human-readable format.\n\n" +00104 " " << name << " --list-ids\n\n" +00105 " -- List the plugins in the search path in a terse machine-readable format,\n" +00106 " in the form vamp:soname:identifier.\n\n" +00107 " " << name << " --list-outputs\n\n" +00108 " -- List the outputs for plugins in the search path in a machine-readable\n" +00109 " format, in the form vamp:soname:identifier:output.\n\n" +00110 " " << name << " --list-by-category\n\n" +00111 " -- List the plugins as a plugin index by category, in a machine-readable\n" +00112 " format. The format may change in future releases.\n\n" +00113 " " << name << " -p\n\n" +00114 " -- Print out the Vamp library search path.\n\n" +00115 " " << name << " -v\n\n" +00116 " -- Display version information only.\n" +00117 << endl; +00118 exit(2); +00119 } +00120 +00121 int main(int argc, char **argv) +00122 { +00123 char *scooter = argv[0]; +00124 char *name = 0; +00125 while (scooter && *scooter) { +00126 if (*scooter == '/' || *scooter == '\\') name = ++scooter; +00127 else ++scooter; +00128 } +00129 if (!name || !*name) name = argv[0]; +00130 +00131 if (argc < 2) usage(name); +00132 +00133 if (argc == 2) { +00134 +00135 if (!strcmp(argv[1], "-v")) { +00136 +00137 cout << "Simple Vamp plugin host version: " << HOST_VERSION << endl +00138 << "Vamp API version: " << VAMP_API_VERSION << endl +00139 << "Vamp SDK version: " << VAMP_SDK_VERSION << endl; +00140 return 0; +00141 +00142 } else if (!strcmp(argv[1], "-l")) { +00143 +00144 printPluginPath(true); +00145 enumeratePlugins(PluginInformation); +00146 return 0; +00147 +00148 } else if (!strcmp(argv[1], "-p")) { +00149 +00150 printPluginPath(false); +00151 return 0; +00152 +00153 } else if (!strcmp(argv[1], "--list-ids")) { +00154 +00155 enumeratePlugins(PluginIds); +00156 return 0; +00157 +00158 } else if (!strcmp(argv[1], "--list-outputs")) { +00159 +00160 enumeratePlugins(PluginOutputIds); +00161 return 0; +00162 +00163 } else if (!strcmp(argv[1], "--list-by-category")) { +00164 +00165 printPluginCategoryList(); +00166 return 0; +00167 +00168 } else usage(name); +00169 } +00170 +00171 if (argc < 3) usage(name); +00172 +00173 bool useFrames = false; +00174 +00175 int base = 1; +00176 if (!strcmp(argv[1], "-s")) { +00177 useFrames = true; +00178 base = 2; +00179 } +00180 +00181 string soname = argv[base]; +00182 string wavname = argv[base+1]; +00183 string plugid = ""; +00184 string output = ""; +00185 int outputNo = -1; +00186 string outfilename; +00187 +00188 if (argc >= base+3) { +00189 +00190 int idx = base+2; +00191 +00192 if (isdigit(*argv[idx])) { +00193 outputNo = atoi(argv[idx++]); +00194 } +00195 +00196 if (argc == idx + 2) { +00197 if (!strcmp(argv[idx], "-o")) { +00198 outfilename = argv[idx+1]; +00199 } else usage(name); +00200 } else if (argc != idx) { +00201 (usage(name)); +00202 } +00203 } +00204 +00205 cerr << endl << name << ": Running..." << endl; +00206 +00207 cerr << "Reading file: \"" << wavname << "\", writing to "; +00208 if (outfilename == "") { +00209 cerr << "standard output" << endl; +00210 } else { +00211 cerr << "\"" << outfilename << "\"" << endl; +00212 } +00213 +00214 string::size_type sep = soname.find(':'); +00215 +00216 if (sep != string::npos) { +00217 plugid = soname.substr(sep + 1); +00218 soname = soname.substr(0, sep); +00219 +00220 sep = plugid.find(':'); +00221 if (sep != string::npos) { +00222 output = plugid.substr(sep + 1); +00223 plugid = plugid.substr(0, sep); +00224 } +00225 } +00226 +00227 if (plugid == "") { +00228 usage(name); +00229 } +00230 +00231 if (output != "" && outputNo != -1) { +00232 usage(name); +00233 } +00234 +00235 if (output == "" && outputNo == -1) { +00236 outputNo = 0; +00237 } +00238 +00239 return runPlugin(name, soname, plugid, output, outputNo, +00240 wavname, outfilename, useFrames); +00241 } +00242 +00243 +00244 int runPlugin(string myname, string soname, string id, +00245 string output, int outputNo, string wavname, +00246 string outfilename, bool useFrames) +00247 { +00248 PluginLoader *loader = PluginLoader::getInstance(); +00249 +00250 PluginLoader::PluginKey key = loader->composePluginKey(soname, id); +00251 +00252 SNDFILE *sndfile; +00253 SF_INFO sfinfo; +00254 memset(&sfinfo, 0, sizeof(SF_INFO)); +00255 +00256 sndfile = sf_open(wavname.c_str(), SFM_READ, &sfinfo); +00257 if (!sndfile) { +00258 cerr << myname << ": ERROR: Failed to open input file \"" +00259 << wavname << "\": " << sf_strerror(sndfile) << endl; +00260 return 1; +00261 } +00262 +00263 ofstream *out = 0; +00264 if (outfilename != "") { +00265 out = new ofstream(outfilename.c_str(), ios::out); +00266 if (!*out) { +00267 cerr << myname << ": ERROR: Failed to open output file \"" +00268 << outfilename << "\" for writing" << endl; +00269 delete out; +00270 return 1; +00271 } +00272 } +00273 +00274 Plugin *plugin = loader->loadPlugin +00275 (key, sfinfo.samplerate, PluginLoader::ADAPT_ALL_SAFE); +00276 if (!plugin) { +00277 cerr << myname << ": ERROR: Failed to load plugin \"" << id +00278 << "\" from library \"" << soname << "\"" << endl; +00279 sf_close(sndfile); +00280 if (out) { +00281 out->close(); +00282 delete out; +00283 } +00284 return 1; +00285 } +00286 +00287 cerr << "Running plugin: \"" << plugin->getIdentifier() << "\"..." << endl; +00288 +00289 int blockSize = plugin->getPreferredBlockSize(); +00290 int stepSize = plugin->getPreferredStepSize(); +00291 +00292 if (blockSize == 0) { +00293 blockSize = 1024; +00294 } +00295 if (stepSize == 0) { +00296 if (plugin->getInputDomain() == Plugin::FrequencyDomain) { +00297 stepSize = blockSize/2; +00298 } else { +00299 stepSize = blockSize; +00300 } +00301 } else if (stepSize > blockSize) { +00302 cerr << "WARNING: stepSize " << stepSize << " > blockSize " << blockSize << ", resetting blockSize to "; +00303 if (plugin->getInputDomain() == Plugin::FrequencyDomain) { +00304 blockSize = stepSize * 2; +00305 } else { +00306 blockSize = stepSize; +00307 } +00308 cerr << blockSize << endl; +00309 } +00310 +00311 int channels = sfinfo.channels; +00312 +00313 float *filebuf = new float[blockSize * channels]; +00314 float **plugbuf = new float*[channels]; +00315 for (int c = 0; c < channels; ++c) plugbuf[c] = new float[blockSize + 2]; +00316 +00317 cerr << "Using block size = " << blockSize << ", step size = " +00318 << stepSize << endl; +00319 +00320 int minch = plugin->getMinChannelCount(); +00321 int maxch = plugin->getMaxChannelCount(); +00322 cerr << "Plugin accepts " << minch << " -> " << maxch << " channel(s)" << endl; +00323 cerr << "Sound file has " << channels << " (will mix/augment if necessary)" << endl; +00324 +00325 Plugin::OutputList outputs = plugin->getOutputDescriptors(); +00326 Plugin::OutputDescriptor od; +00327 +00328 int returnValue = 1; +00329 int progress = 0; +00330 +00331 if (outputs.empty()) { +00332 cerr << "ERROR: Plugin has no outputs!" << endl; +00333 goto done; +00334 } +00335 +00336 if (outputNo < 0) { +00337 +00338 for (size_t oi = 0; oi < outputs.size(); ++oi) { +00339 if (outputs[oi].identifier == output) { +00340 outputNo = oi; +00341 break; +00342 } +00343 } +00344 +00345 if (outputNo < 0) { +00346 cerr << "ERROR: Non-existent output \"" << output << "\" requested" << endl; +00347 goto done; +00348 } +00349 +00350 } else { +00351 +00352 if (int(outputs.size()) <= outputNo) { +00353 cerr << "ERROR: Output " << outputNo << " requested, but plugin has only " << outputs.size() << " output(s)" << endl; +00354 goto done; +00355 } +00356 } +00357 +00358 od = outputs[outputNo]; +00359 cerr << "Output is: \"" << od.identifier << "\"" << endl; +00360 +00361 if (!plugin->initialise(channels, stepSize, blockSize)) { +00362 cerr << "ERROR: Plugin initialise (channels = " << channels +00363 << ", stepSize = " << stepSize << ", blockSize = " +00364 << blockSize << ") failed." << endl; +00365 goto done; +00366 } +00367 +00368 for (size_t i = 0; i < sfinfo.frames; i += stepSize) { +00369 +00370 int count; +00371 +00372 if (sf_seek(sndfile, i, SEEK_SET) < 0) { +00373 cerr << "ERROR: sf_seek failed: " << sf_strerror(sndfile) << endl; +00374 break; +00375 } +00376 +00377 if ((count = sf_readf_float(sndfile, filebuf, blockSize)) < 0) { +00378 cerr << "ERROR: sf_readf_float failed: " << sf_strerror(sndfile) << endl; +00379 break; +00380 } +00381 +00382 for (int c = 0; c < channels; ++c) { +00383 int j = 0; +00384 while (j < count) { +00385 plugbuf[c][j] = filebuf[j * sfinfo.channels + c]; +00386 ++j; +00387 } +00388 while (j < blockSize) { +00389 plugbuf[c][j] = 0.0f; +00390 ++j; +00391 } +00392 } +00393 +00394 printFeatures +00395 (i, sfinfo.samplerate, outputNo, plugin->process +00396 (plugbuf, RealTime::frame2RealTime(i, sfinfo.samplerate)), +00397 out, useFrames); +00398 +00399 int pp = progress; +00400 progress = lrintf((float(i) / sfinfo.frames) * 100.f); +00401 if (progress != pp && out) { +00402 cerr << "\r" << progress << "%"; +00403 } +00404 } +00405 if (out) cerr << "\rDone" << endl; +00406 +00407 printFeatures(sfinfo.frames, sfinfo.samplerate, outputNo, +00408 plugin->getRemainingFeatures(), out, useFrames); +00409 +00410 returnValue = 0; +00411 +00412 done: +00413 delete plugin; +00414 if (out) { +00415 out->close(); +00416 delete out; +00417 } +00418 sf_close(sndfile); +00419 return returnValue; +00420 } +00421 +00422 void +00423 printFeatures(int frame, int sr, int output, +00424 Plugin::FeatureSet features, ofstream *out, bool useFrames) +00425 { +00426 for (unsigned int i = 0; i < features[output].size(); ++i) { +00427 +00428 if (useFrames) { +00429 +00430 int displayFrame = frame; +00431 +00432 if (features[output][i].hasTimestamp) { +00433 displayFrame = RealTime::realTime2Frame +00434 (features[output][i].timestamp, sr); +00435 } +00436 +00437 (out ? *out : cout) << displayFrame << ":"; +00438 +00439 } else { +00440 +00441 RealTime rt = RealTime::frame2RealTime(frame, sr); +00442 +00443 if (features[output][i].hasTimestamp) { +00444 rt = features[output][i].timestamp; +00445 } +00446 +00447 (out ? *out : cout) << rt.toString() << ":"; +00448 } +00449 +00450 for (unsigned int j = 0; j < features[output][i].values.size(); ++j) { +00451 (out ? *out : cout) << " " << features[output][i].values[j]; +00452 } +00453 +00454 (out ? *out : cout) << endl; +00455 } +00456 } +00457 +00458 void +00459 printPluginPath(bool verbose) +00460 { +00461 if (verbose) { +00462 cout << "\nVamp plugin search path: "; +00463 } +00464 +00465 vector<string> path = PluginHostAdapter::getPluginPath(); +00466 for (size_t i = 0; i < path.size(); ++i) { +00467 if (verbose) { +00468 cout << "[" << path[i] << "]"; +00469 } else { +00470 cout << path[i] << endl; +00471 } +00472 } +00473 +00474 if (verbose) cout << endl; +00475 } +00476 +00477 void +00478 enumeratePlugins(Verbosity verbosity) +00479 { +00480 PluginLoader *loader = PluginLoader::getInstance(); +00481 +00482 if (verbosity == PluginInformation) { +00483 cout << "\nVamp plugin libraries found in search path:" << endl; +00484 } +00485 +00486 vector<PluginLoader::PluginKey> plugins = loader->listPlugins(); +00487 typedef multimap<string, PluginLoader::PluginKey> +00488 LibraryMap; +00489 LibraryMap libraryMap; +00490 +00491 for (size_t i = 0; i < plugins.size(); ++i) { +00492 string path = loader->getLibraryPathForPlugin(plugins[i]); +00493 libraryMap.insert(LibraryMap::value_type(path, plugins[i])); +00494 } +00495 +00496 string prevPath = ""; +00497 int index = 0; +00498 +00499 for (LibraryMap::iterator i = libraryMap.begin(); +00500 i != libraryMap.end(); ++i) { +00501 +00502 string path = i->first; +00503 PluginLoader::PluginKey key = i->second; +00504 +00505 if (path != prevPath) { +00506 prevPath = path; +00507 index = 0; +00508 if (verbosity == PluginInformation) { +00509 cout << "\n " << path << ":" << endl; +00510 } +00511 } +00512 +00513 Plugin *plugin = loader->loadPlugin(key, 48000); +00514 if (plugin) { +00515 +00516 char c = char('A' + index); +00517 if (c > 'Z') c = char('a' + (index - 26)); +00518 +00519 if (verbosity == PluginInformation) { +00520 +00521 cout << " [" << c << "] [v" +00522 << plugin->getVampApiVersion() << "] " +00523 << plugin->getName() << ", \"" +00524 << plugin->getIdentifier() << "\"" << " [" +00525 << plugin->getMaker() << "]" << endl; +00526 +00527 PluginLoader::PluginCategoryHierarchy category = +00528 loader->getPluginCategory(key); +00529 +00530 if (!category.empty()) { +00531 cout << " "; +00532 for (size_t ci = 0; ci < category.size(); ++ci) { +00533 cout << " > " << category[ci]; +00534 } +00535 cout << endl; +00536 } +00537 +00538 if (plugin->getDescription() != "") { +00539 cout << " - " << plugin->getDescription() << endl; +00540 } +00541 +00542 } else if (verbosity == PluginIds) { +00543 cout << "vamp:" << key << endl; +00544 } +00545 +00546 Plugin::OutputList outputs = +00547 plugin->getOutputDescriptors(); +00548 +00549 if (outputs.size() > 1 || verbosity == PluginOutputIds) { +00550 for (size_t j = 0; j < outputs.size(); ++j) { +00551 if (verbosity == PluginInformation) { +00552 cout << " (" << j << ") " +00553 << outputs[j].name << ", \"" +00554 << outputs[j].identifier << "\"" << endl; +00555 if (outputs[j].description != "") { +00556 cout << " - " +00557 << outputs[j].description << endl; +00558 } +00559 } else if (verbosity == PluginOutputIds) { +00560 cout << "vamp:" << key << ":" << outputs[j].identifier << endl; +00561 } +00562 } +00563 } +00564 +00565 ++index; +00566 +00567 delete plugin; +00568 } +00569 } +00570 +00571 if (verbosity == PluginInformation) { +00572 cout << endl; +00573 } +00574 } +00575 +00576 void +00577 printPluginCategoryList() +00578 { +00579 PluginLoader *loader = PluginLoader::getInstance(); +00580 +00581 vector<PluginLoader::PluginKey> plugins = loader->listPlugins(); +00582 +00583 set<string> printedcats; +00584 +00585 for (size_t i = 0; i < plugins.size(); ++i) { +00586 +00587 PluginLoader::PluginKey key = plugins[i]; +00588 +00589 PluginLoader::PluginCategoryHierarchy category = +00590 loader->getPluginCategory(key); +00591 +00592 Plugin *plugin = loader->loadPlugin(key, 48000); +00593 if (!plugin) continue; +00594 +00595 string catstr = ""; +00596 +00597 if (category.empty()) catstr = '|'; +00598 else { +00599 for (size_t j = 0; j < category.size(); ++j) { +00600 catstr += category[j]; +00601 catstr += '|'; +00602 if (printedcats.find(catstr) == printedcats.end()) { +00603 std::cout << catstr << std::endl; +00604 printedcats.insert(catstr); +00605 } +00606 } +00607 } +00608 +00609 std::cout << catstr << key << ":::" << plugin->getName() << ":::" << plugin->getMaker() << ":::" << plugin->getDescription() << std::endl; +00610 } +00611 } +00612 +
+ +
+Go to the source code of this file.
Defines | |
#define | HOST_VERSION "1.1" |
Enumerations | |
enum | Verbosity { PluginIds, +PluginOutputIds, +PluginInformation + } |
Functions | |
void | printFeatures (int, int, int, Plugin::FeatureSet, ofstream *, bool frames) |
void | transformInput (float *, size_t) |
void | fft (unsigned int, bool, double *, double *, double *, double *) |
void | printPluginPath (bool verbose) |
void | printPluginCategoryList () |
void | enumeratePlugins (Verbosity) |
void | listPluginsInLibrary (string soname) |
int | runPlugin (string myname, string soname, string id, string output, int outputNo, string inputFile, string outfilename, bool frames) |
void | usage (const char *name) |
int | main (int argc, char **argv) |
#define HOST_VERSION "1.1" | +
+
enum Verbosity | +
+
+ +Definition at line 65 of file vamp-simple-host.cpp.
+ ++
void printFeatures | +( | +int | +frame, | +|
+ | + | int | +sr, | +|
+ | + | int | +output, | +|
+ | + | Plugin::FeatureSet | +features, | +|
+ | + | ofstream * | +out, | +|
+ | + | bool | +frames | + |
+ | ) | ++ |
+ +
Definition at line 423 of file vamp-simple-host.cpp.
+ +References Vamp::RealTime::toString().
+ +Referenced by runPlugin().
+ +void transformInput | +( | +float * | +, | +|
+ | + | size_t | ++ | |
+ | ) | ++ |
+ +
void fft | +( | +unsigned | +int, | +|
+ | + | bool | +, | +|
+ | + | double * | +, | +|
+ | + | double * | +, | +|
+ | + | double * | +, | +|
+ | + | double * | ++ | |
+ | ) | ++ |
+ +
void printPluginPath | +( | +bool | +verbose | +) | ++ |
void printPluginCategoryList | +( | ++ | ) | ++ |
+ +
Definition at line 577 of file vamp-simple-host.cpp.
+ +References Vamp::PluginBase::getDescription(), Vamp::PluginBase::getMaker(), Vamp::PluginBase::getName(), Vamp::HostExt::PluginLoader::getPluginCategory(), Vamp::HostExt::PluginLoader::listPlugins(), and Vamp::HostExt::PluginLoader::loadPlugin().
+ +Referenced by main().
+ +void enumeratePlugins | +( | +Verbosity | +verbosity | +) | ++ |
+ +
Definition at line 478 of file vamp-simple-host.cpp.
+ +References Vamp::PluginBase::getDescription(), Vamp::PluginBase::getIdentifier(), Vamp::HostExt::PluginLoader::getLibraryPathForPlugin(), Vamp::PluginBase::getMaker(), Vamp::PluginBase::getName(), Vamp::Plugin::getOutputDescriptors(), Vamp::HostExt::PluginLoader::getPluginCategory(), Vamp::PluginBase::getVampApiVersion(), Vamp::HostExt::PluginLoader::listPlugins(), Vamp::HostExt::PluginLoader::loadPlugin(), PluginIds, PluginInformation, and PluginOutputIds.
+ +Referenced by main().
+ +void listPluginsInLibrary | +( | +string | +soname | +) | ++ |
+ +
int runPlugin | +( | +string | +myname, | +|
+ | + | string | +soname, | +|
+ | + | string | +id, | +|
+ | + | string | +output, | +|
+ | + | int | +outputNo, | +|
+ | + | string | +inputFile, | +|
+ | + | string | +outfilename, | +|
+ | + | bool | +frames | + |
+ | ) | ++ |
+ +
Definition at line 244 of file vamp-simple-host.cpp.
+ +References Vamp::HostExt::PluginLoader::composePluginKey(), Vamp::PluginBase::getIdentifier(), Vamp::Plugin::getInputDomain(), Vamp::Plugin::getMaxChannelCount(), Vamp::Plugin::getMinChannelCount(), Vamp::Plugin::getOutputDescriptors(), Vamp::Plugin::getPreferredBlockSize(), Vamp::Plugin::getPreferredStepSize(), Vamp::Plugin::getRemainingFeatures(), Vamp::Plugin::initialise(), Vamp::HostExt::PluginLoader::loadPlugin(), printFeatures(), and Vamp::Plugin::process().
+ +Referenced by main().
+ +void usage | +( | +const char * | +name | +) | ++ |
+ +
Definition at line 81 of file vamp-simple-host.cpp.
+ +References PLUGIN_SUFFIX.
+ +Referenced by main().
+ +int main | +( | +int | +argc, | +|
+ | + | char ** | +argv | + |
+ | ) | ++ |
+ +
Definition at line 121 of file vamp-simple-host.cpp.
+ +References enumeratePlugins(), HOST_VERSION, PluginIds, PluginInformation, PluginOutputIds, printPluginCategoryList(), printPluginPath(), runPlugin(), usage(), VAMP_API_VERSION, and VAMP_SDK_VERSION.
+ ++
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_HEADER_INCLUDED +00038 #define VAMP_HEADER_INCLUDED +00039 +00040 #ifdef __cplusplus +00041 extern "C" { +00042 #endif +00043 +00053 #define VAMP_API_VERSION 1 +00054 +00071 typedef struct _VampParameterDescriptor +00072 { +00074 const char *identifier; +00075 +00077 const char *name; +00078 +00080 const char *description; +00081 +00083 const char *unit; +00084 +00086 float minValue; +00087 +00089 float maxValue; +00090 +00092 float defaultValue; +00093 +00095 int isQuantized; +00096 +00098 float quantizeStep; +00099 +00101 const char **valueNames; +00102 +00103 } VampParameterDescriptor; +00104 +00105 typedef enum +00106 { +00108 vampOneSamplePerStep, +00109 +00111 vampFixedSampleRate, +00112 +00114 vampVariableSampleRate +00115 +00116 } VampSampleType; +00117 +00118 typedef struct _VampOutputDescriptor +00119 { +00121 const char *identifier; +00122 +00124 const char *name; +00125 +00127 const char *description; +00128 +00130 const char *unit; +00131 +00133 int hasFixedBinCount; +00134 +00136 unsigned int binCount; +00137 +00139 const char **binNames; +00140 +00142 int hasKnownExtents; +00143 +00145 float minValue; +00146 +00148 float maxValue; +00149 +00151 int isQuantized; +00152 +00154 float quantizeStep; +00155 +00157 VampSampleType sampleType; +00158 +00161 float sampleRate; +00162 +00163 } VampOutputDescriptor; +00164 +00165 typedef struct _VampFeature +00166 { +00168 int hasTimestamp; +00169 +00171 int sec; +00172 +00174 int nsec; +00175 +00177 unsigned int valueCount; +00178 +00180 float *values; +00181 +00183 char *label; +00184 +00185 } VampFeature; +00186 +00187 typedef struct _VampFeatureList +00188 { +00190 unsigned int featureCount; +00191 +00193 VampFeature *features; +00194 +00195 } VampFeatureList; +00196 +00197 typedef enum +00198 { +00199 vampTimeDomain, +00200 vampFrequencyDomain +00201 +00202 } VampInputDomain; +00203 +00204 typedef void *VampPluginHandle; +00205 +00206 typedef struct _VampPluginDescriptor +00207 { +00209 unsigned int vampApiVersion; +00210 +00212 const char *identifier; +00213 +00215 const char *name; +00216 +00218 const char *description; +00219 +00221 const char *maker; +00222 +00224 int pluginVersion; +00225 +00227 const char *copyright; +00228 +00230 unsigned int parameterCount; +00231 +00233 const VampParameterDescriptor **parameters; +00234 +00236 unsigned int programCount; +00237 +00239 const char **programs; +00240 +00242 VampInputDomain inputDomain; +00243 +00245 VampPluginHandle (*instantiate)(const struct _VampPluginDescriptor *, +00246 float inputSampleRate); +00247 +00249 void (*cleanup)(VampPluginHandle); +00250 +00252 int (*initialise)(VampPluginHandle, +00253 unsigned int inputChannels, +00254 unsigned int stepSize, +00255 unsigned int blockSize); +00256 +00258 void (*reset)(VampPluginHandle); +00259 +00261 float (*getParameter)(VampPluginHandle, int); +00262 +00264 void (*setParameter)(VampPluginHandle, int, float); +00265 +00267 unsigned int (*getCurrentProgram)(VampPluginHandle); +00268 +00270 void (*selectProgram)(VampPluginHandle, unsigned int); +00271 +00273 unsigned int (*getPreferredStepSize)(VampPluginHandle); +00274 +00276 unsigned int (*getPreferredBlockSize)(VampPluginHandle); +00277 +00279 unsigned int (*getMinChannelCount)(VampPluginHandle); +00280 +00282 unsigned int (*getMaxChannelCount)(VampPluginHandle); +00283 +00285 unsigned int (*getOutputCount)(VampPluginHandle); +00286 +00291 VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle, +00292 unsigned int); +00293 +00295 void (*releaseOutputDescriptor)(VampOutputDescriptor *); +00296 +00302 VampFeatureList *(*process)(VampPluginHandle, +00303 const float *const *inputBuffers, +00304 int sec, +00305 int nsec); +00306 +00308 VampFeatureList *(*getRemainingFeatures)(VampPluginHandle); +00309 +00311 void (*releaseFeatureSet)(VampFeatureList *); +00312 +00313 } VampPluginDescriptor; +00314 +00315 +00334 const VampPluginDescriptor *vampGetPluginDescriptor +00335 (unsigned int hostApiVersion, unsigned int index); +00336 +00337 +00339 typedef const VampPluginDescriptor *(*VampGetPluginDescriptorFunction) +00340 (unsigned int, unsigned int); +00341 +00342 #ifdef __cplusplus +00343 } +00344 #endif +00345 +00346 #endif +
+ +
+Go to the source code of this file.
Classes | |
struct | _VampParameterDescriptor |
C language API for Vamp plugins. More... | |
struct | _VampOutputDescriptor |
struct | _VampFeature |
struct | _VampFeatureList |
struct | _VampPluginDescriptor |
Defines | |
#define | VAMP_API_VERSION 1 |
Plugin API version. | |
Typedefs | |
typedef struct +_VampParameterDescriptor | VampParameterDescriptor |
typedef struct +_VampOutputDescriptor | VampOutputDescriptor |
typedef struct _VampFeature | VampFeature |
typedef struct _VampFeatureList | VampFeatureList |
typedef void * | VampPluginHandle |
typedef struct +_VampPluginDescriptor | VampPluginDescriptor |
typedef const +VampPluginDescriptor *(* | VampGetPluginDescriptorFunction )(unsigned int, unsigned int) |
Function pointer type for vampGetPluginDescriptor. | |
Enumerations | |
enum | VampSampleType { vampOneSamplePerStep, +vampFixedSampleRate, +vampVariableSampleRate + } |
enum | VampInputDomain { vampTimeDomain, +vampFrequencyDomain + } |
Functions | |
const VampPluginDescriptor * | vampGetPluginDescriptor (unsigned int hostApiVersion, unsigned int index) |
Get the descriptor for a given plugin index in this library. |
#define VAMP_API_VERSION 1 | +
+Plugin API version. +
+This is incremented when a change is made that changes the binary layout of the descriptor records. When this happens, there should be a mechanism for retaining compatibility with older hosts and/or plugins.
+See also the vampApiVersion field in the plugin descriptor, and the hostApiVersion argument to the vampGetPluginDescriptor function. +
Definition at line 53 of file vamp.h.
+ +Referenced by Vamp::HostExt::PluginLoader::Impl::enumeratePlugins(), Vamp::PluginAdapterBase::Impl::getDescriptor(), Vamp::HostExt::PluginLoader::Impl::loadPlugin(), and main().
+ ++
typedef struct _VampParameterDescriptor VampParameterDescriptor | +
+ +
typedef struct _VampOutputDescriptor VampOutputDescriptor | +
+ +
typedef struct _VampFeature VampFeature | +
+ +
typedef struct _VampFeatureList VampFeatureList | +
+ +
typedef void* VampPluginHandle | +
typedef struct _VampPluginDescriptor VampPluginDescriptor | +
+ +
typedef const VampPluginDescriptor*(* VampGetPluginDescriptorFunction)(unsigned int, unsigned int) | +
+
enum VampSampleType | +
+
+ + + +enum VampInputDomain | +
+
const VampPluginDescriptor* vampGetPluginDescriptor | +( | +unsigned int | +hostApiVersion, | +|
+ | + | unsigned int | +index | + |
+ | ) | ++ |
+Get the descriptor for a given plugin index in this library. +
+Return NULL if the index is outside the range of valid indices for this plugin library.
+The hostApiVersion argument tells the library code the highest Vamp API version supported by the host. The function should return a plugin descriptor compatible with the highest API version supported by the library that is no higher than that supported by the host. Provided the descriptor has the correct vampApiVersion field for its actual compatibility level, the host should be able to do the right thing with it: use it if possible, discard it otherwise.
+This is the only symbol that a Vamp plugin actually needs to export from its shared object; all others can be hidden. See the accompanying documentation for notes on how to achieve this with certain compilers. +
Definition at line 50 of file plugins.cpp.
+ +References Vamp::PluginAdapterBase::getDescriptor().
+ ++
Vamp is a very easy system to develop plugins for, as it has + a standard cross-platform SDK which includes API documentation, + example plugins, ready-to-use C++ base classes, the C API + header, and a test host.
+ +The formal Vamp API is defined in C for the greatest level of + binary compatibility. However, plugins and hosts are strongly + encouraged to make use of the set of C++ base classes provided. + This is particularly advisable since the values returned by a + plugin may have relatively complex structures.
+ +The entire SDK is published under a very permissive BSD-style + license. + You are encouraged to copy from it wholesale, whether developing + open-source or proprietary plugin or host software.
+ +Vamp plugin and host development may be discussed on the vamp-devel list and the Vamp plugins forum.
+ + + diff -r 000000000000 -r 351c4ebce5f9 download.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/download.html Mon Sep 22 13:01:46 2008 +0000 @@ -0,0 +1,200 @@ + + + + + + +Several useful Vamp plugins are linked below, and you'll find + installation instructions at the bottom + of the page.
+ +Some of these may be ready to download and run straight away + on your platform. Some are open source; others are not. Please + see the individual plugin pages for details.
+ +Looking for the developer kit? Look here!
+ +Plugins | Version | Linux | OS/X | Windows | Source code |
Queen Mary plugin set Note onset detector, beat tracker, tempo estimator, key estimator, tonal change detector, structural segmenter, timbral and rhythmic similarity estimator, chromagram, constant Q spectrogram and MFCC calculation plugins from the Centre for Digital Music at Queen Mary, University of London |
+
+ 1.4 | Download (32 and 64 bit) | Download | Download | + +N/A |
Vamp Aubio plugins Onset detection, pitch tracking, note tracking and tempo tracking plugins using Paul Brossier's aubio library. | 0.3.2b | + +Download | + +Download | + +Download | + +Download Browse SVN |
+
+
Mazurka plugins Spectral visualisation and feature extraction plugins from the Mazurka project. |
+
+ 2007-05-08 | + +Download | + ++ + | Download | + +Browse | + +
Vamp libxtract plugins Low-level feature extraction plugins using Jamie Bullock's libxtract library to provide around 50 spectral and other features. |
+
+ 0.4.2.20071019 | + +Download | + +Download | + +Download | + +Download Browse SVN + + |
MATCH Vamp plugin Vamp implementation of the MATCH + audio alignment algorithm from Simon Dixon. Sonic Visualiser + v1.2 can use this for automatic alignment (see tutorial). |
+
+ 0.2 | + +Download (32 bit) Download (64 bit) |
+
+ Download | + +Download | + +Download | + +
MARSYAS Vamp plugins Low-level feature extraction plugins containing functionality from the MARSYAS batch feature extractor. |
+
+ 0.01 | + +Download | + ++ + | + + | Download | + +
OFA Vamp plugin Plugin that performs audio fingerprinting and lookup using the MusicIP OFA library. |
+
+ 20080128 | + ++ | + | + + | Download | + +
OnsetsDS plugin Note onset detector using Dan Stowell's OnsetsDS library. |
+
+ 0.2 | + +Download | +Download | +Download | + +Download | + +
Vamp example plugins A small set of simple plugins as included with the Vamp developers kit. Amplitude tracker, simple percussion onset detector, spectral centroid, and zero-crossing counter. |
+
+ 1.3 | + +Download | + +Download | + +Download | + +Browse SVN + + |
A Vamp plugin set consists of a single dynamic library (DLL) + file containing one or more plugins, and an optional category + file (.cat). To install a plugin set, just copy the plugin's + library file and category file (if supplied) into your system or + personal Vamp plugin location.
+ +The plugin file extension and the location to + copy into depend on your platform:
+ +File extension | System plugin folder | Personal plugin folder | |
Linux | .so | /usr/local/lib/vamp | $HOME/vamp |
OS/X | .dylib | /Library/Audio/Plug-Ins/Vamp | $HOME/Library/Audio/Plug-Ins/Vamp |
Windows | .dll | C:\Program Files\Vamp Plugins |
You can alternatively set the VAMP_PATH
+ environment variable to list the locations a host should look in
+ for Vamp plugins.
VAMP_PATH
should contain a semicolon-separated
+ (on Windows) or colon-separated (OS/X, Linux) list of paths. If
+ it is set, it will completely override the standard locations
+ listed above.
Vamp is an audio processing plugin system for + plugins that extract descriptive information from audio data + — typically referred to as audio analysis plugins + or audio feature extraction plugins.
+ +9th July 2008: Version 1.3 of the Vamp plugin SDK is now
+ available.
See the developers page for more
+ information.
Just like an audio effects plugin (such as a VST), a Vamp + plugin is a binary module that can be loaded up by a host + application and fed audio data. However, unlike an effects + plugin, a Vamp plugin outputs not processed audio but some sort + of symbolic information. Typical things that a Vamp plugin + might calculate include the locations of moments such as note onset + times, visual representations of the audio such as histograms, + or curve data such as power or fundamental frequency. Read more about the rationale for Vamp.
+ +The principal technical differences between Vamp and a real-time audio + plugin system such as VST are:
+ +