cannam@0: cannam@0:
cannam@0:00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ cannam@0: 00002 cannam@0: 00003 /* cannam@0: 00004 Vamp cannam@0: 00005 cannam@0: 00006 An API for audio analysis and feature extraction plugins. cannam@0: 00007 cannam@0: 00008 Centre for Digital Music, Queen Mary, University of London. cannam@0: 00009 Copyright 2006-2007 Chris Cannam and QMUL. cannam@0: 00010 cannam@0: 00011 Permission is hereby granted, free of charge, to any person cannam@0: 00012 obtaining a copy of this software and associated documentation cannam@0: 00013 files (the "Software"), to deal in the Software without cannam@0: 00014 restriction, including without limitation the rights to use, copy, cannam@0: 00015 modify, merge, publish, distribute, sublicense, and/or sell copies cannam@0: 00016 of the Software, and to permit persons to whom the Software is cannam@0: 00017 furnished to do so, subject to the following conditions: cannam@0: 00018 cannam@0: 00019 The above copyright notice and this permission notice shall be cannam@0: 00020 included in all copies or substantial portions of the Software. cannam@0: 00021 cannam@0: 00022 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, cannam@0: 00023 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF cannam@0: 00024 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND cannam@0: 00025 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR cannam@0: 00026 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF cannam@0: 00027 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION cannam@0: 00028 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. cannam@0: 00029 cannam@0: 00030 Except as contained in this notice, the names of the Centre for cannam@0: 00031 Digital Music; Queen Mary, University of London; and Chris Cannam cannam@0: 00032 shall not be used in advertising or otherwise to promote the sale, cannam@0: 00033 use or other dealings in this Software without prior written cannam@0: 00034 authorization. cannam@0: 00035 */ cannam@0: 00036 cannam@0: 00037 #include "PluginWrapper.h" cannam@0: 00038 cannam@0: 00039 namespace Vamp { cannam@0: 00040 cannam@0: 00041 namespace HostExt { cannam@0: 00042 cannam@0: 00043 class PluginRateExtractor : public Plugin cannam@0: 00044 { cannam@0: 00045 public: cannam@0: 00046 PluginRateExtractor() : Plugin(0) { } cannam@0: 00047 float getRate() const { return m_inputSampleRate; } cannam@0: 00048 }; cannam@0: 00049 cannam@0: 00050 PluginWrapper::PluginWrapper(Plugin *plugin) : cannam@0: 00051 Plugin(((PluginRateExtractor *)plugin)->getRate()), cannam@0: 00052 m_plugin(plugin) cannam@0: 00053 { cannam@0: 00054 } cannam@0: 00055 cannam@0: 00056 PluginWrapper::~PluginWrapper() cannam@0: 00057 { cannam@0: 00058 delete m_plugin; cannam@0: 00059 } cannam@0: 00060 cannam@0: 00061 bool cannam@0: 00062 PluginWrapper::initialise(size_t channels, size_t stepSize, size_t blockSize) cannam@0: 00063 { cannam@0: 00064 return m_plugin->initialise(channels, stepSize, blockSize); cannam@0: 00065 } cannam@0: 00066 cannam@0: 00067 void cannam@0: 00068 PluginWrapper::reset() cannam@0: 00069 { cannam@0: 00070 m_plugin->reset(); cannam@0: 00071 } cannam@0: 00072 cannam@0: 00073 Plugin::InputDomain cannam@0: 00074 PluginWrapper::getInputDomain() const cannam@0: 00075 { cannam@0: 00076 return m_plugin->getInputDomain(); cannam@0: 00077 } cannam@0: 00078 cannam@0: 00079 unsigned int cannam@0: 00080 PluginWrapper::getVampApiVersion() const cannam@0: 00081 { cannam@0: 00082 return m_plugin->getVampApiVersion(); cannam@0: 00083 } cannam@0: 00084 cannam@0: 00085 std::string cannam@0: 00086 PluginWrapper::getIdentifier() const cannam@0: 00087 { cannam@0: 00088 return m_plugin->getIdentifier(); cannam@0: 00089 } cannam@0: 00090 cannam@0: 00091 std::string cannam@0: 00092 PluginWrapper::getName() const cannam@0: 00093 { cannam@0: 00094 return m_plugin->getName(); cannam@0: 00095 } cannam@0: 00096 cannam@0: 00097 std::string cannam@0: 00098 PluginWrapper::getDescription() const cannam@0: 00099 { cannam@0: 00100 return m_plugin->getDescription(); cannam@0: 00101 } cannam@0: 00102 cannam@0: 00103 std::string cannam@0: 00104 PluginWrapper::getMaker() const cannam@0: 00105 { cannam@0: 00106 return m_plugin->getMaker(); cannam@0: 00107 } cannam@0: 00108 cannam@0: 00109 int cannam@0: 00110 PluginWrapper::getPluginVersion() const cannam@0: 00111 { cannam@0: 00112 return m_plugin->getPluginVersion(); cannam@0: 00113 } cannam@0: 00114 cannam@0: 00115 std::string cannam@0: 00116 PluginWrapper::getCopyright() const cannam@0: 00117 { cannam@0: 00118 return m_plugin->getCopyright(); cannam@0: 00119 } cannam@0: 00120 cannam@0: 00121 PluginBase::ParameterList cannam@0: 00122 PluginWrapper::getParameterDescriptors() const cannam@0: 00123 { cannam@0: 00124 return m_plugin->getParameterDescriptors(); cannam@0: 00125 } cannam@0: 00126 cannam@0: 00127 float cannam@0: 00128 PluginWrapper::getParameter(std::string parameter) const cannam@0: 00129 { cannam@0: 00130 return m_plugin->getParameter(parameter); cannam@0: 00131 } cannam@0: 00132 cannam@0: 00133 void cannam@0: 00134 PluginWrapper::setParameter(std::string parameter, float value) cannam@0: 00135 { cannam@0: 00136 m_plugin->setParameter(parameter, value); cannam@0: 00137 } cannam@0: 00138 cannam@0: 00139 PluginBase::ProgramList cannam@0: 00140 PluginWrapper::getPrograms() const cannam@0: 00141 { cannam@0: 00142 return m_plugin->getPrograms(); cannam@0: 00143 } cannam@0: 00144 cannam@0: 00145 std::string cannam@0: 00146 PluginWrapper::getCurrentProgram() const cannam@0: 00147 { cannam@0: 00148 return m_plugin->getCurrentProgram(); cannam@0: 00149 } cannam@0: 00150 cannam@0: 00151 void cannam@0: 00152 PluginWrapper::selectProgram(std::string program) cannam@0: 00153 { cannam@0: 00154 m_plugin->selectProgram(program); cannam@0: 00155 } cannam@0: 00156 cannam@0: 00157 size_t cannam@0: 00158 PluginWrapper::getPreferredStepSize() const cannam@0: 00159 { cannam@0: 00160 return m_plugin->getPreferredStepSize(); cannam@0: 00161 } cannam@0: 00162 cannam@0: 00163 size_t cannam@0: 00164 PluginWrapper::getPreferredBlockSize() const cannam@0: 00165 { cannam@0: 00166 return m_plugin->getPreferredBlockSize(); cannam@0: 00167 } cannam@0: 00168 cannam@0: 00169 size_t cannam@0: 00170 PluginWrapper::getMinChannelCount() const cannam@0: 00171 { cannam@0: 00172 return m_plugin->getMinChannelCount(); cannam@0: 00173 } cannam@0: 00174 cannam@0: 00175 size_t PluginWrapper::getMaxChannelCount() const cannam@0: 00176 { cannam@0: 00177 return m_plugin->getMaxChannelCount(); cannam@0: 00178 } cannam@0: 00179 cannam@0: 00180 Plugin::OutputList cannam@0: 00181 PluginWrapper::getOutputDescriptors() const cannam@0: 00182 { cannam@0: 00183 return m_plugin->getOutputDescriptors(); cannam@0: 00184 } cannam@0: 00185 cannam@0: 00186 Plugin::FeatureSet cannam@0: 00187 PluginWrapper::process(const float *const *inputBuffers, RealTime timestamp) cannam@0: 00188 { cannam@0: 00189 return m_plugin->process(inputBuffers, timestamp); cannam@0: 00190 } cannam@0: 00191 cannam@0: 00192 Plugin::FeatureSet cannam@0: 00193 PluginWrapper::getRemainingFeatures() cannam@0: 00194 { cannam@0: 00195 return m_plugin->getRemainingFeatures(); cannam@0: 00196 } cannam@0: 00197 cannam@0: 00198 } cannam@0: 00199 cannam@0: 00200 } cannam@0: 00201 cannam@0: