annotate src/vamp-sdk/PluginAdapter.cpp @ 270:06cfedd040c7

...
author cannam
date Wed, 26 Nov 2008 13:54:17 +0000
parents 6579e441f2fe
children 9abf7455a1a3
rev   line source
cannam@3 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
cannam@3 2
cannam@3 3 /*
cannam@3 4 Vamp
cannam@3 5
cannam@3 6 An API for audio analysis and feature extraction plugins.
cannam@3 7
cannam@3 8 Centre for Digital Music, Queen Mary, University of London.
cannam@3 9 Copyright 2006 Chris Cannam.
cannam@3 10
cannam@3 11 Permission is hereby granted, free of charge, to any person
cannam@3 12 obtaining a copy of this software and associated documentation
cannam@3 13 files (the "Software"), to deal in the Software without
cannam@3 14 restriction, including without limitation the rights to use, copy,
cannam@3 15 modify, merge, publish, distribute, sublicense, and/or sell copies
cannam@3 16 of the Software, and to permit persons to whom the Software is
cannam@3 17 furnished to do so, subject to the following conditions:
cannam@3 18
cannam@3 19 The above copyright notice and this permission notice shall be
cannam@3 20 included in all copies or substantial portions of the Software.
cannam@3 21
cannam@3 22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
cannam@3 23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
cannam@3 24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
cannam@6 25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
cannam@3 26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
cannam@3 27 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
cannam@3 28 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
cannam@3 29
cannam@3 30 Except as contained in this notice, the names of the Centre for
cannam@3 31 Digital Music; Queen Mary, University of London; and Chris Cannam
cannam@3 32 shall not be used in advertising or otherwise to promote the sale,
cannam@3 33 use or other dealings in this Software without prior written
cannam@3 34 authorization.
cannam@3 35 */
cannam@3 36
cannam@230 37 #include <vamp-sdk/PluginAdapter.h>
cannam@3 38
cannam@130 39 #include <cstring>
cannam@130 40 #include <cstdlib>
cannam@130 41
cannam@234 42 #if ( VAMP_SDK_MAJOR_VERSION != 2 || VAMP_SDK_MINOR_VERSION != 0 )
cannam@234 43 #error Incorrect Vamp SDK header included (not the expected 2.0 SDK)
cannam@234 44 #endif
cannam@234 45
cannam@234 46
cannam@23 47 //#define DEBUG_PLUGIN_ADAPTER 1
cannam@22 48
cannam@233 49 _VAMP_SDK_PLUGSPACE_BEGIN(PluginAdapter.cpp)
cannam@230 50
cannam@3 51 namespace Vamp {
cannam@3 52
cannam@76 53 class PluginAdapterBase::Impl
cannam@3 54 {
cannam@76 55 public:
cannam@76 56 Impl(PluginAdapterBase *);
cannam@76 57 ~Impl();
cannam@76 58
cannam@76 59 const VampPluginDescriptor *getDescriptor();
cannam@76 60
cannam@76 61 protected:
cannam@76 62 PluginAdapterBase *m_base;
cannam@76 63
cannam@76 64 static VampPluginHandle vampInstantiate(const VampPluginDescriptor *desc,
cannam@167 65 float inputSampleRate);
cannam@76 66
cannam@76 67 static void vampCleanup(VampPluginHandle handle);
cannam@76 68
cannam@76 69 static int vampInitialise(VampPluginHandle handle, unsigned int channels,
cannam@76 70 unsigned int stepSize, unsigned int blockSize);
cannam@76 71
cannam@76 72 static void vampReset(VampPluginHandle handle);
cannam@76 73
cannam@76 74 static float vampGetParameter(VampPluginHandle handle, int param);
cannam@76 75 static void vampSetParameter(VampPluginHandle handle, int param, float value);
cannam@76 76
cannam@76 77 static unsigned int vampGetCurrentProgram(VampPluginHandle handle);
cannam@76 78 static void vampSelectProgram(VampPluginHandle handle, unsigned int program);
cannam@76 79
cannam@76 80 static unsigned int vampGetPreferredStepSize(VampPluginHandle handle);
cannam@76 81 static unsigned int vampGetPreferredBlockSize(VampPluginHandle handle);
cannam@76 82 static unsigned int vampGetMinChannelCount(VampPluginHandle handle);
cannam@76 83 static unsigned int vampGetMaxChannelCount(VampPluginHandle handle);
cannam@76 84
cannam@76 85 static unsigned int vampGetOutputCount(VampPluginHandle handle);
cannam@76 86
cannam@76 87 static VampOutputDescriptor *vampGetOutputDescriptor(VampPluginHandle handle,
cannam@76 88 unsigned int i);
cannam@76 89
cannam@76 90 static void vampReleaseOutputDescriptor(VampOutputDescriptor *desc);
cannam@76 91
cannam@76 92 static VampFeatureList *vampProcess(VampPluginHandle handle,
cannam@76 93 const float *const *inputBuffers,
cannam@76 94 int sec,
cannam@76 95 int nsec);
cannam@76 96
cannam@76 97 static VampFeatureList *vampGetRemainingFeatures(VampPluginHandle handle);
cannam@76 98
cannam@76 99 static void vampReleaseFeatureSet(VampFeatureList *fs);
cannam@76 100
cannam@268 101 void checkOutputMap(Plugin *plugin);
cannam@268 102 void markOutputsChanged(Plugin *plugin);
cannam@268 103
cannam@76 104 void cleanup(Plugin *plugin);
cannam@76 105 unsigned int getOutputCount(Plugin *plugin);
cannam@76 106 VampOutputDescriptor *getOutputDescriptor(Plugin *plugin,
cannam@76 107 unsigned int i);
cannam@76 108 VampFeatureList *process(Plugin *plugin,
cannam@76 109 const float *const *inputBuffers,
cannam@76 110 int sec, int nsec);
cannam@76 111 VampFeatureList *getRemainingFeatures(Plugin *plugin);
cannam@76 112 VampFeatureList *convertFeatures(Plugin *plugin,
cannam@76 113 const Plugin::FeatureSet &features);
cannam@76 114
cannam@76 115 // maps both plugins and descriptors to adapters
cannam@76 116 typedef std::map<const void *, Impl *> AdapterMap;
cannam@76 117 static AdapterMap *m_adapterMap;
cannam@76 118 static Impl *lookupAdapter(VampPluginHandle);
cannam@76 119
cannam@76 120 bool m_populated;
cannam@76 121 VampPluginDescriptor m_descriptor;
cannam@76 122 Plugin::ParameterList m_parameters;
cannam@76 123 Plugin::ProgramList m_programs;
cannam@76 124
cannam@76 125 typedef std::map<Plugin *, Plugin::OutputList *> OutputMap;
cannam@76 126 OutputMap m_pluginOutputs;
cannam@76 127
cannam@76 128 std::map<Plugin *, VampFeatureList *> m_fs;
cannam@76 129 std::map<Plugin *, std::vector<size_t> > m_fsizes;
cannam@76 130 std::map<Plugin *, std::vector<std::vector<size_t> > > m_fvsizes;
cannam@76 131 void resizeFS(Plugin *plugin, int n);
cannam@76 132 void resizeFL(Plugin *plugin, int n, size_t sz);
cannam@76 133 void resizeFV(Plugin *plugin, int n, int j, size_t sz);
cannam@76 134 };
cannam@76 135
cannam@76 136 PluginAdapterBase::PluginAdapterBase()
cannam@76 137 {
cannam@76 138 m_impl = new Impl(this);
cannam@76 139 }
cannam@76 140
cannam@76 141 PluginAdapterBase::~PluginAdapterBase()
cannam@76 142 {
cannam@76 143 delete m_impl;
cannam@3 144 }
cannam@3 145
cannam@3 146 const VampPluginDescriptor *
cannam@3 147 PluginAdapterBase::getDescriptor()
cannam@3 148 {
cannam@76 149 return m_impl->getDescriptor();
cannam@76 150 }
cannam@76 151
cannam@76 152 PluginAdapterBase::Impl::Impl(PluginAdapterBase *base) :
cannam@76 153 m_base(base),
cannam@76 154 m_populated(false)
cannam@76 155 {
cannam@22 156 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 157 std::cerr << "PluginAdapterBase::Impl[" << this << "]::Impl" << std::endl;
cannam@76 158 #endif
cannam@76 159 }
cannam@76 160
cannam@76 161 const VampPluginDescriptor *
cannam@76 162 PluginAdapterBase::Impl::getDescriptor()
cannam@76 163 {
cannam@76 164 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 165 std::cerr << "PluginAdapterBase::Impl[" << this << "]::getDescriptor" << std::endl;
cannam@22 166 #endif
cannam@22 167
cannam@3 168 if (m_populated) return &m_descriptor;
cannam@3 169
cannam@76 170 Plugin *plugin = m_base->createPlugin(48000);
cannam@3 171
cannam@50 172 if (plugin->getVampApiVersion() != VAMP_API_VERSION) {
cannam@76 173 std::cerr << "Vamp::PluginAdapterBase::Impl::getDescriptor: ERROR: "
cannam@194 174 << "API version " << plugin->getVampApiVersion()
cannam@194 175 << " for\nplugin \"" << plugin->getIdentifier() << "\" "
cannam@194 176 << "differs from version "
cannam@194 177 << VAMP_API_VERSION << " for adapter.\n"
cannam@194 178 << "This plugin is probably linked against a different version of the Vamp SDK\n"
cannam@194 179 << "from the version it was compiled with. It will need to be re-linked correctly\n"
cannam@194 180 << "before it can be used." << std::endl;
cannam@50 181 delete plugin;
cannam@50 182 return 0;
cannam@50 183 }
cannam@50 184
cannam@3 185 m_parameters = plugin->getParameterDescriptors();
cannam@3 186 m_programs = plugin->getPrograms();
cannam@50 187
cannam@50 188 m_descriptor.vampApiVersion = plugin->getVampApiVersion();
cannam@49 189 m_descriptor.identifier = strdup(plugin->getIdentifier().c_str());
cannam@3 190 m_descriptor.name = strdup(plugin->getName().c_str());
cannam@3 191 m_descriptor.description = strdup(plugin->getDescription().c_str());
cannam@3 192 m_descriptor.maker = strdup(plugin->getMaker().c_str());
cannam@3 193 m_descriptor.pluginVersion = plugin->getPluginVersion();
cannam@3 194 m_descriptor.copyright = strdup(plugin->getCopyright().c_str());
cannam@3 195
cannam@3 196 m_descriptor.parameterCount = m_parameters.size();
cannam@3 197 m_descriptor.parameters = (const VampParameterDescriptor **)
cannam@3 198 malloc(m_parameters.size() * sizeof(VampParameterDescriptor));
cannam@7 199
cannam@7 200 unsigned int i;
cannam@3 201
cannam@7 202 for (i = 0; i < m_parameters.size(); ++i) {
cannam@3 203 VampParameterDescriptor *desc = (VampParameterDescriptor *)
cannam@3 204 malloc(sizeof(VampParameterDescriptor));
cannam@49 205 desc->identifier = strdup(m_parameters[i].identifier.c_str());
cannam@3 206 desc->name = strdup(m_parameters[i].name.c_str());
cannam@3 207 desc->description = strdup(m_parameters[i].description.c_str());
cannam@3 208 desc->unit = strdup(m_parameters[i].unit.c_str());
cannam@3 209 desc->minValue = m_parameters[i].minValue;
cannam@3 210 desc->maxValue = m_parameters[i].maxValue;
cannam@3 211 desc->defaultValue = m_parameters[i].defaultValue;
cannam@3 212 desc->isQuantized = m_parameters[i].isQuantized;
cannam@3 213 desc->quantizeStep = m_parameters[i].quantizeStep;
cannam@9 214 desc->valueNames = 0;
cannam@9 215 if (desc->isQuantized && !m_parameters[i].valueNames.empty()) {
cannam@9 216 desc->valueNames = (const char **)
cannam@9 217 malloc((m_parameters[i].valueNames.size()+1) * sizeof(char *));
cannam@9 218 for (unsigned int j = 0; j < m_parameters[i].valueNames.size(); ++j) {
cannam@9 219 desc->valueNames[j] = strdup(m_parameters[i].valueNames[j].c_str());
cannam@9 220 }
cannam@9 221 desc->valueNames[m_parameters[i].valueNames.size()] = 0;
cannam@9 222 }
cannam@3 223 m_descriptor.parameters[i] = desc;
cannam@3 224 }
cannam@3 225
cannam@3 226 m_descriptor.programCount = m_programs.size();
cannam@3 227 m_descriptor.programs = (const char **)
cannam@3 228 malloc(m_programs.size() * sizeof(const char *));
cannam@3 229
cannam@7 230 for (i = 0; i < m_programs.size(); ++i) {
cannam@3 231 m_descriptor.programs[i] = strdup(m_programs[i].c_str());
cannam@3 232 }
cannam@3 233
cannam@3 234 if (plugin->getInputDomain() == Plugin::FrequencyDomain) {
cannam@3 235 m_descriptor.inputDomain = vampFrequencyDomain;
cannam@3 236 } else {
cannam@3 237 m_descriptor.inputDomain = vampTimeDomain;
cannam@3 238 }
cannam@3 239
cannam@3 240 m_descriptor.instantiate = vampInstantiate;
cannam@3 241 m_descriptor.cleanup = vampCleanup;
cannam@3 242 m_descriptor.initialise = vampInitialise;
cannam@3 243 m_descriptor.reset = vampReset;
cannam@3 244 m_descriptor.getParameter = vampGetParameter;
cannam@3 245 m_descriptor.setParameter = vampSetParameter;
cannam@3 246 m_descriptor.getCurrentProgram = vampGetCurrentProgram;
cannam@3 247 m_descriptor.selectProgram = vampSelectProgram;
cannam@3 248 m_descriptor.getPreferredStepSize = vampGetPreferredStepSize;
cannam@3 249 m_descriptor.getPreferredBlockSize = vampGetPreferredBlockSize;
cannam@3 250 m_descriptor.getMinChannelCount = vampGetMinChannelCount;
cannam@3 251 m_descriptor.getMaxChannelCount = vampGetMaxChannelCount;
cannam@3 252 m_descriptor.getOutputCount = vampGetOutputCount;
cannam@3 253 m_descriptor.getOutputDescriptor = vampGetOutputDescriptor;
cannam@3 254 m_descriptor.releaseOutputDescriptor = vampReleaseOutputDescriptor;
cannam@3 255 m_descriptor.process = vampProcess;
cannam@3 256 m_descriptor.getRemainingFeatures = vampGetRemainingFeatures;
cannam@3 257 m_descriptor.releaseFeatureSet = vampReleaseFeatureSet;
cannam@3 258
cannam@13 259 if (!m_adapterMap) {
cannam@13 260 m_adapterMap = new AdapterMap;
cannam@13 261 }
cannam@15 262 (*m_adapterMap)[&m_descriptor] = this;
cannam@3 263
cannam@3 264 delete plugin;
cannam@3 265
cannam@3 266 m_populated = true;
cannam@3 267 return &m_descriptor;
cannam@3 268 }
cannam@3 269
cannam@76 270 PluginAdapterBase::Impl::~Impl()
cannam@3 271 {
cannam@22 272 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 273 std::cerr << "PluginAdapterBase::Impl[" << this << "]::~Impl" << std::endl;
cannam@22 274 #endif
cannam@22 275
cannam@3 276 if (!m_populated) return;
cannam@3 277
cannam@49 278 free((void *)m_descriptor.identifier);
cannam@3 279 free((void *)m_descriptor.name);
cannam@3 280 free((void *)m_descriptor.description);
cannam@3 281 free((void *)m_descriptor.maker);
cannam@3 282 free((void *)m_descriptor.copyright);
cannam@3 283
cannam@3 284 for (unsigned int i = 0; i < m_descriptor.parameterCount; ++i) {
cannam@3 285 const VampParameterDescriptor *desc = m_descriptor.parameters[i];
cannam@49 286 free((void *)desc->identifier);
cannam@3 287 free((void *)desc->name);
cannam@3 288 free((void *)desc->description);
cannam@3 289 free((void *)desc->unit);
cannam@9 290 if (desc->valueNames) {
cannam@9 291 for (unsigned int j = 0; desc->valueNames[j]; ++j) {
cannam@9 292 free((void *)desc->valueNames[j]);
cannam@9 293 }
cannam@9 294 free((void *)desc->valueNames);
cannam@9 295 }
cannam@3 296 }
cannam@3 297 free((void *)m_descriptor.parameters);
cannam@3 298
cannam@3 299 for (unsigned int i = 0; i < m_descriptor.programCount; ++i) {
cannam@3 300 free((void *)m_descriptor.programs[i]);
cannam@3 301 }
cannam@3 302 free((void *)m_descriptor.programs);
cannam@3 303
cannam@13 304 if (m_adapterMap) {
cannam@13 305
cannam@13 306 m_adapterMap->erase(&m_descriptor);
cannam@13 307
cannam@13 308 if (m_adapterMap->empty()) {
cannam@13 309 delete m_adapterMap;
cannam@13 310 m_adapterMap = 0;
cannam@13 311 }
cannam@13 312 }
cannam@3 313 }
cannam@3 314
cannam@76 315 PluginAdapterBase::Impl *
cannam@76 316 PluginAdapterBase::Impl::lookupAdapter(VampPluginHandle handle)
cannam@3 317 {
cannam@22 318 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 319 std::cerr << "PluginAdapterBase::Impl::lookupAdapter(" << handle << ")" << std::endl;
cannam@22 320 #endif
cannam@22 321
cannam@13 322 if (!m_adapterMap) return 0;
cannam@13 323 AdapterMap::const_iterator i = m_adapterMap->find(handle);
cannam@13 324 if (i == m_adapterMap->end()) return 0;
cannam@3 325 return i->second;
cannam@3 326 }
cannam@3 327
cannam@3 328 VampPluginHandle
cannam@76 329 PluginAdapterBase::Impl::vampInstantiate(const VampPluginDescriptor *desc,
cannam@268 330 float inputSampleRate)
cannam@3 331 {
cannam@22 332 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 333 std::cerr << "PluginAdapterBase::Impl::vampInstantiate(" << desc << ")" << std::endl;
cannam@22 334 #endif
cannam@22 335
cannam@15 336 if (!m_adapterMap) {
cannam@15 337 m_adapterMap = new AdapterMap();
cannam@15 338 }
cannam@15 339
cannam@15 340 if (m_adapterMap->find(desc) == m_adapterMap->end()) {
cannam@76 341 std::cerr << "WARNING: PluginAdapterBase::Impl::vampInstantiate: Descriptor " << desc << " not in adapter map" << std::endl;
cannam@15 342 return 0;
cannam@15 343 }
cannam@15 344
cannam@76 345 Impl *adapter = (*m_adapterMap)[desc];
cannam@3 346 if (desc != &adapter->m_descriptor) return 0;
cannam@3 347
cannam@76 348 Plugin *plugin = adapter->m_base->createPlugin(inputSampleRate);
cannam@3 349 if (plugin) {
cannam@13 350 (*m_adapterMap)[plugin] = adapter;
cannam@3 351 }
cannam@3 352
cannam@22 353 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 354 std::cerr << "PluginAdapterBase::Impl::vampInstantiate(" << desc << "): returning handle " << plugin << std::endl;
cannam@22 355 #endif
cannam@22 356
cannam@3 357 return plugin;
cannam@3 358 }
cannam@3 359
cannam@3 360 void
cannam@76 361 PluginAdapterBase::Impl::vampCleanup(VampPluginHandle handle)
cannam@3 362 {
cannam@22 363 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 364 std::cerr << "PluginAdapterBase::Impl::vampCleanup(" << handle << ")" << std::endl;
cannam@22 365 #endif
cannam@22 366
cannam@76 367 Impl *adapter = lookupAdapter(handle);
cannam@3 368 if (!adapter) {
cannam@3 369 delete ((Plugin *)handle);
cannam@3 370 return;
cannam@3 371 }
cannam@3 372 adapter->cleanup(((Plugin *)handle));
cannam@3 373 }
cannam@3 374
cannam@3 375 int
cannam@76 376 PluginAdapterBase::Impl::vampInitialise(VampPluginHandle handle,
cannam@268 377 unsigned int channels,
cannam@268 378 unsigned int stepSize,
cannam@268 379 unsigned int blockSize)
cannam@3 380 {
cannam@22 381 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 382 std::cerr << "PluginAdapterBase::Impl::vampInitialise(" << handle << ", " << channels << ", " << stepSize << ", " << blockSize << ")" << std::endl;
cannam@22 383 #endif
cannam@22 384
cannam@268 385 Impl *adapter = lookupAdapter(handle);
cannam@268 386 if (!adapter) return 0;
cannam@268 387 bool result = ((Plugin *)handle)->initialise(channels, stepSize, blockSize);
cannam@268 388 adapter->markOutputsChanged((Plugin *)handle);
cannam@3 389 return result ? 1 : 0;
cannam@3 390 }
cannam@3 391
cannam@3 392 void
cannam@76 393 PluginAdapterBase::Impl::vampReset(VampPluginHandle handle)
cannam@3 394 {
cannam@22 395 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 396 std::cerr << "PluginAdapterBase::Impl::vampReset(" << handle << ")" << std::endl;
cannam@22 397 #endif
cannam@22 398
cannam@3 399 ((Plugin *)handle)->reset();
cannam@3 400 }
cannam@3 401
cannam@3 402 float
cannam@76 403 PluginAdapterBase::Impl::vampGetParameter(VampPluginHandle handle,
cannam@3 404 int param)
cannam@3 405 {
cannam@22 406 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 407 std::cerr << "PluginAdapterBase::Impl::vampGetParameter(" << handle << ", " << param << ")" << std::endl;
cannam@22 408 #endif
cannam@22 409
cannam@76 410 Impl *adapter = lookupAdapter(handle);
cannam@3 411 if (!adapter) return 0.0;
cannam@3 412 Plugin::ParameterList &list = adapter->m_parameters;
cannam@49 413 return ((Plugin *)handle)->getParameter(list[param].identifier);
cannam@3 414 }
cannam@3 415
cannam@3 416 void
cannam@76 417 PluginAdapterBase::Impl::vampSetParameter(VampPluginHandle handle,
cannam@3 418 int param, float value)
cannam@3 419 {
cannam@22 420 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 421 std::cerr << "PluginAdapterBase::Impl::vampSetParameter(" << handle << ", " << param << ", " << value << ")" << std::endl;
cannam@22 422 #endif
cannam@22 423
cannam@76 424 Impl *adapter = lookupAdapter(handle);
cannam@3 425 if (!adapter) return;
cannam@3 426 Plugin::ParameterList &list = adapter->m_parameters;
cannam@49 427 ((Plugin *)handle)->setParameter(list[param].identifier, value);
cannam@268 428 adapter->markOutputsChanged((Plugin *)handle);
cannam@3 429 }
cannam@3 430
cannam@3 431 unsigned int
cannam@76 432 PluginAdapterBase::Impl::vampGetCurrentProgram(VampPluginHandle handle)
cannam@3 433 {
cannam@22 434 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 435 std::cerr << "PluginAdapterBase::Impl::vampGetCurrentProgram(" << handle << ")" << std::endl;
cannam@22 436 #endif
cannam@22 437
cannam@76 438 Impl *adapter = lookupAdapter(handle);
cannam@3 439 if (!adapter) return 0;
cannam@3 440 Plugin::ProgramList &list = adapter->m_programs;
cannam@3 441 std::string program = ((Plugin *)handle)->getCurrentProgram();
cannam@3 442 for (unsigned int i = 0; i < list.size(); ++i) {
cannam@3 443 if (list[i] == program) return i;
cannam@3 444 }
cannam@3 445 return 0;
cannam@3 446 }
cannam@3 447
cannam@3 448 void
cannam@76 449 PluginAdapterBase::Impl::vampSelectProgram(VampPluginHandle handle,
cannam@268 450 unsigned int program)
cannam@3 451 {
cannam@22 452 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 453 std::cerr << "PluginAdapterBase::Impl::vampSelectProgram(" << handle << ", " << program << ")" << std::endl;
cannam@22 454 #endif
cannam@22 455
cannam@76 456 Impl *adapter = lookupAdapter(handle);
cannam@3 457 if (!adapter) return;
cannam@268 458
cannam@3 459 Plugin::ProgramList &list = adapter->m_programs;
cannam@3 460 ((Plugin *)handle)->selectProgram(list[program]);
cannam@268 461
cannam@268 462 adapter->markOutputsChanged((Plugin *)handle);
cannam@3 463 }
cannam@3 464
cannam@3 465 unsigned int
cannam@76 466 PluginAdapterBase::Impl::vampGetPreferredStepSize(VampPluginHandle handle)
cannam@3 467 {
cannam@22 468 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 469 std::cerr << "PluginAdapterBase::Impl::vampGetPreferredStepSize(" << handle << ")" << std::endl;
cannam@22 470 #endif
cannam@22 471
cannam@3 472 return ((Plugin *)handle)->getPreferredStepSize();
cannam@3 473 }
cannam@3 474
cannam@3 475 unsigned int
cannam@76 476 PluginAdapterBase::Impl::vampGetPreferredBlockSize(VampPluginHandle handle)
cannam@3 477 {
cannam@22 478 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 479 std::cerr << "PluginAdapterBase::Impl::vampGetPreferredBlockSize(" << handle << ")" << std::endl;
cannam@22 480 #endif
cannam@22 481
cannam@3 482 return ((Plugin *)handle)->getPreferredBlockSize();
cannam@3 483 }
cannam@3 484
cannam@3 485 unsigned int
cannam@76 486 PluginAdapterBase::Impl::vampGetMinChannelCount(VampPluginHandle handle)
cannam@3 487 {
cannam@22 488 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 489 std::cerr << "PluginAdapterBase::Impl::vampGetMinChannelCount(" << handle << ")" << std::endl;
cannam@22 490 #endif
cannam@22 491
cannam@3 492 return ((Plugin *)handle)->getMinChannelCount();
cannam@3 493 }
cannam@3 494
cannam@3 495 unsigned int
cannam@76 496 PluginAdapterBase::Impl::vampGetMaxChannelCount(VampPluginHandle handle)
cannam@3 497 {
cannam@22 498 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 499 std::cerr << "PluginAdapterBase::Impl::vampGetMaxChannelCount(" << handle << ")" << std::endl;
cannam@22 500 #endif
cannam@22 501
cannam@3 502 return ((Plugin *)handle)->getMaxChannelCount();
cannam@3 503 }
cannam@3 504
cannam@3 505 unsigned int
cannam@76 506 PluginAdapterBase::Impl::vampGetOutputCount(VampPluginHandle handle)
cannam@3 507 {
cannam@22 508 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 509 std::cerr << "PluginAdapterBase::Impl::vampGetOutputCount(" << handle << ")" << std::endl;
cannam@22 510 #endif
cannam@22 511
cannam@76 512 Impl *adapter = lookupAdapter(handle);
cannam@15 513
cannam@15 514 // std::cerr << "vampGetOutputCount: handle " << handle << " -> adapter "<< adapter << std::endl;
cannam@15 515
cannam@3 516 if (!adapter) return 0;
cannam@3 517 return adapter->getOutputCount((Plugin *)handle);
cannam@3 518 }
cannam@3 519
cannam@3 520 VampOutputDescriptor *
cannam@76 521 PluginAdapterBase::Impl::vampGetOutputDescriptor(VampPluginHandle handle,
cannam@268 522 unsigned int i)
cannam@3 523 {
cannam@22 524 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 525 std::cerr << "PluginAdapterBase::Impl::vampGetOutputDescriptor(" << handle << ", " << i << ")" << std::endl;
cannam@22 526 #endif
cannam@22 527
cannam@76 528 Impl *adapter = lookupAdapter(handle);
cannam@15 529
cannam@15 530 // std::cerr << "vampGetOutputDescriptor: handle " << handle << " -> adapter "<< adapter << std::endl;
cannam@15 531
cannam@3 532 if (!adapter) return 0;
cannam@3 533 return adapter->getOutputDescriptor((Plugin *)handle, i);
cannam@3 534 }
cannam@3 535
cannam@3 536 void
cannam@76 537 PluginAdapterBase::Impl::vampReleaseOutputDescriptor(VampOutputDescriptor *desc)
cannam@3 538 {
cannam@22 539 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 540 std::cerr << "PluginAdapterBase::Impl::vampReleaseOutputDescriptor(" << desc << ")" << std::endl;
cannam@22 541 #endif
cannam@22 542
cannam@49 543 if (desc->identifier) free((void *)desc->identifier);
cannam@3 544 if (desc->name) free((void *)desc->name);
cannam@3 545 if (desc->description) free((void *)desc->description);
cannam@3 546 if (desc->unit) free((void *)desc->unit);
cannam@40 547 if (desc->hasFixedBinCount && desc->binNames) {
cannam@40 548 for (unsigned int i = 0; i < desc->binCount; ++i) {
cannam@40 549 if (desc->binNames[i]) {
cannam@40 550 free((void *)desc->binNames[i]);
cannam@40 551 }
cannam@40 552 }
cannam@3 553 }
cannam@9 554 if (desc->binNames) free((void *)desc->binNames);
cannam@3 555 free((void *)desc);
cannam@3 556 }
cannam@3 557
cannam@12 558 VampFeatureList *
cannam@76 559 PluginAdapterBase::Impl::vampProcess(VampPluginHandle handle,
cannam@108 560 const float *const *inputBuffers,
cannam@108 561 int sec,
cannam@108 562 int nsec)
cannam@3 563 {
cannam@22 564 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 565 std::cerr << "PluginAdapterBase::Impl::vampProcess(" << handle << ", " << sec << ", " << nsec << ")" << std::endl;
cannam@22 566 #endif
cannam@22 567
cannam@76 568 Impl *adapter = lookupAdapter(handle);
cannam@3 569 if (!adapter) return 0;
cannam@268 570 return adapter->process((Plugin *)handle, inputBuffers, sec, nsec);
cannam@3 571 }
cannam@3 572
cannam@12 573 VampFeatureList *
cannam@76 574 PluginAdapterBase::Impl::vampGetRemainingFeatures(VampPluginHandle handle)
cannam@3 575 {
cannam@22 576 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 577 std::cerr << "PluginAdapterBase::Impl::vampGetRemainingFeatures(" << handle << ")" << std::endl;
cannam@22 578 #endif
cannam@22 579
cannam@76 580 Impl *adapter = lookupAdapter(handle);
cannam@3 581 if (!adapter) return 0;
cannam@3 582 return adapter->getRemainingFeatures((Plugin *)handle);
cannam@3 583 }
cannam@3 584
cannam@3 585 void
cannam@76 586 PluginAdapterBase::Impl::vampReleaseFeatureSet(VampFeatureList *fs)
cannam@3 587 {
cannam@22 588 #ifdef DEBUG_PLUGIN_ADAPTER
cannam@76 589 std::cerr << "PluginAdapterBase::Impl::vampReleaseFeatureSet" << std::endl;
cannam@22 590 #endif
cannam@3 591 }
cannam@3 592
cannam@3 593 void
cannam@76 594 PluginAdapterBase::Impl::cleanup(Plugin *plugin)
cannam@3 595 {
cannam@12 596 if (m_fs.find(plugin) != m_fs.end()) {
cannam@12 597 size_t outputCount = 0;
cannam@12 598 if (m_pluginOutputs[plugin]) {
cannam@12 599 outputCount = m_pluginOutputs[plugin]->size();
cannam@12 600 }
cannam@12 601 VampFeatureList *list = m_fs[plugin];
cannam@12 602 for (unsigned int i = 0; i < outputCount; ++i) {
cannam@12 603 for (unsigned int j = 0; j < m_fsizes[plugin][i]; ++j) {
cannam@168 604 if (list[i].features[j].v1.label) {
cannam@168 605 free(list[i].features[j].v1.label);
cannam@12 606 }
cannam@168 607 if (list[i].features[j].v1.values) {
cannam@168 608 free(list[i].features[j].v1.values);
cannam@12 609 }
cannam@12 610 }
cannam@12 611 if (list[i].features) free(list[i].features);
cannam@12 612 }
cannam@12 613 m_fs.erase(plugin);
cannam@12 614 m_fsizes.erase(plugin);
cannam@12 615 m_fvsizes.erase(plugin);
cannam@12 616 }
cannam@12 617
cannam@3 618 if (m_pluginOutputs.find(plugin) != m_pluginOutputs.end()) {
cannam@3 619 delete m_pluginOutputs[plugin];
cannam@3 620 m_pluginOutputs.erase(plugin);
cannam@3 621 }
cannam@13 622
cannam@13 623 if (m_adapterMap) {
cannam@13 624 m_adapterMap->erase(plugin);
cannam@13 625
cannam@13 626 if (m_adapterMap->empty()) {
cannam@13 627 delete m_adapterMap;
cannam@13 628 m_adapterMap = 0;
cannam@13 629 }
cannam@13 630 }
cannam@13 631
cannam@3 632 delete ((Plugin *)plugin);
cannam@3 633 }
cannam@3 634
cannam@3 635 void
cannam@76 636 PluginAdapterBase::Impl::checkOutputMap(Plugin *plugin)
cannam@3 637 {
cannam@268 638 OutputMap::iterator i = m_pluginOutputs.find(plugin);
cannam@268 639
cannam@268 640 if (i == m_pluginOutputs.end() || !i->second) {
cannam@268 641
cannam@3 642 m_pluginOutputs[plugin] = new Plugin::OutputList
cannam@3 643 (plugin->getOutputDescriptors());
cannam@268 644
cannam@76 645 // std::cerr << "PluginAdapterBase::Impl::checkOutputMap: Have " << m_pluginOutputs[plugin]->size() << " outputs for plugin " << plugin->getIdentifier() << std::endl;
cannam@3 646 }
cannam@3 647 }
cannam@3 648
cannam@268 649 void
cannam@268 650 PluginAdapterBase::Impl::markOutputsChanged(Plugin *plugin)
cannam@268 651 {
cannam@268 652 OutputMap::iterator i = m_pluginOutputs.find(plugin);
cannam@268 653
cannam@268 654 // std::cerr << "PluginAdapterBase::Impl::markOutputsChanged" << std::endl;
cannam@268 655
cannam@268 656 if (i != m_pluginOutputs.end()) {
cannam@268 657
cannam@268 658 Plugin::OutputList *list = i->second;
cannam@268 659 m_pluginOutputs.erase(i);
cannam@268 660 delete list;
cannam@268 661 }
cannam@268 662 }
cannam@268 663
cannam@3 664 unsigned int
cannam@76 665 PluginAdapterBase::Impl::getOutputCount(Plugin *plugin)
cannam@3 666 {
cannam@3 667 checkOutputMap(plugin);
cannam@268 668
cannam@3 669 return m_pluginOutputs[plugin]->size();
cannam@3 670 }
cannam@3 671
cannam@3 672 VampOutputDescriptor *
cannam@76 673 PluginAdapterBase::Impl::getOutputDescriptor(Plugin *plugin,
cannam@268 674 unsigned int i)
cannam@3 675 {
cannam@3 676 checkOutputMap(plugin);
cannam@268 677
cannam@3 678 Plugin::OutputDescriptor &od =
cannam@3 679 (*m_pluginOutputs[plugin])[i];
cannam@3 680
cannam@3 681 VampOutputDescriptor *desc = (VampOutputDescriptor *)
cannam@3 682 malloc(sizeof(VampOutputDescriptor));
cannam@3 683
cannam@49 684 desc->identifier = strdup(od.identifier.c_str());
cannam@3 685 desc->name = strdup(od.name.c_str());
cannam@3 686 desc->description = strdup(od.description.c_str());
cannam@3 687 desc->unit = strdup(od.unit.c_str());
cannam@9 688 desc->hasFixedBinCount = od.hasFixedBinCount;
cannam@9 689 desc->binCount = od.binCount;
cannam@3 690
cannam@240 691 if (od.hasFixedBinCount && od.binCount > 0
cannam@240 692 // We would like to do "&& !od.binNames.empty()" here -- but we
cannam@240 693 // can't, because it will crash older versions of the host adapter
cannam@240 694 // which try to copy the names across whenever the bin count is
cannam@240 695 // non-zero, regardless of whether they exist or not
cannam@240 696 ) {
cannam@9 697 desc->binNames = (const char **)
cannam@9 698 malloc(od.binCount * sizeof(const char *));
cannam@3 699
cannam@9 700 for (unsigned int i = 0; i < od.binCount; ++i) {
cannam@9 701 if (i < od.binNames.size()) {
cannam@9 702 desc->binNames[i] = strdup(od.binNames[i].c_str());
cannam@7 703 } else {
cannam@9 704 desc->binNames[i] = 0;
cannam@7 705 }
cannam@3 706 }
cannam@7 707 } else {
cannam@9 708 desc->binNames = 0;
cannam@3 709 }
cannam@3 710
cannam@3 711 desc->hasKnownExtents = od.hasKnownExtents;
cannam@3 712 desc->minValue = od.minValue;
cannam@3 713 desc->maxValue = od.maxValue;
cannam@3 714 desc->isQuantized = od.isQuantized;
cannam@3 715 desc->quantizeStep = od.quantizeStep;
cannam@3 716
cannam@3 717 switch (od.sampleType) {
cannam@3 718 case Plugin::OutputDescriptor::OneSamplePerStep:
cannam@3 719 desc->sampleType = vampOneSamplePerStep; break;
cannam@3 720 case Plugin::OutputDescriptor::FixedSampleRate:
cannam@3 721 desc->sampleType = vampFixedSampleRate; break;
cannam@3 722 case Plugin::OutputDescriptor::VariableSampleRate:
cannam@3 723 desc->sampleType = vampVariableSampleRate; break;
cannam@3 724 }
cannam@3 725
cannam@3 726 desc->sampleRate = od.sampleRate;
cannam@192 727 desc->hasDuration = od.hasDuration;
cannam@3 728
cannam@3 729 return desc;
cannam@3 730 }
cannam@3 731
cannam@12 732 VampFeatureList *
cannam@76 733 PluginAdapterBase::Impl::process(Plugin *plugin,
cannam@108 734 const float *const *inputBuffers,
cannam@108 735 int sec, int nsec)
cannam@3 736 {
cannam@76 737 // std::cerr << "PluginAdapterBase::Impl::process" << std::endl;
cannam@3 738 RealTime rt(sec, nsec);
cannam@12 739 checkOutputMap(plugin);
cannam@12 740 return convertFeatures(plugin, plugin->process(inputBuffers, rt));
cannam@3 741 }
cannam@3 742
cannam@12 743 VampFeatureList *
cannam@76 744 PluginAdapterBase::Impl::getRemainingFeatures(Plugin *plugin)
cannam@3 745 {
cannam@76 746 // std::cerr << "PluginAdapterBase::Impl::getRemainingFeatures" << std::endl;
cannam@12 747 checkOutputMap(plugin);
cannam@12 748 return convertFeatures(plugin, plugin->getRemainingFeatures());
cannam@3 749 }
cannam@3 750
cannam@12 751 VampFeatureList *
cannam@76 752 PluginAdapterBase::Impl::convertFeatures(Plugin *plugin,
cannam@167 753 const Plugin::FeatureSet &features)
cannam@3 754 {
cannam@12 755 int lastN = -1;
cannam@3 756
cannam@12 757 int outputCount = 0;
cannam@12 758 if (m_pluginOutputs[plugin]) outputCount = m_pluginOutputs[plugin]->size();
cannam@12 759
cannam@12 760 resizeFS(plugin, outputCount);
cannam@12 761 VampFeatureList *fs = m_fs[plugin];
cannam@3 762
cannam@168 763 // std::cerr << "PluginAdapter(v2)::convertFeatures: NOTE: sizeof(Feature) == " << sizeof(Plugin::Feature) << ", sizeof(VampFeature) == " << sizeof(VampFeature) << ", sizeof(VampFeatureList) == " << sizeof(VampFeatureList) << std::endl;
cannam@168 764
cannam@12 765 for (Plugin::FeatureSet::const_iterator fi = features.begin();
cannam@12 766 fi != features.end(); ++fi) {
cannam@3 767
cannam@12 768 int n = fi->first;
cannam@12 769
cannam@76 770 // std::cerr << "PluginAdapterBase::Impl::convertFeatures: n = " << n << std::endl;
cannam@7 771
cannam@12 772 if (n >= int(outputCount)) {
cannam@76 773 std::cerr << "WARNING: PluginAdapterBase::Impl::convertFeatures: Too many outputs from plugin (" << n+1 << ", only should be " << outputCount << ")" << std::endl;
cannam@7 774 continue;
cannam@7 775 }
cannam@7 776
cannam@12 777 if (n > lastN + 1) {
cannam@12 778 for (int i = lastN + 1; i < n; ++i) {
cannam@12 779 fs[i].featureCount = 0;
cannam@12 780 }
cannam@12 781 }
cannam@7 782
cannam@7 783 const Plugin::FeatureList &fl = fi->second;
cannam@7 784
cannam@12 785 size_t sz = fl.size();
cannam@12 786 if (sz > m_fsizes[plugin][n]) resizeFL(plugin, n, sz);
cannam@12 787 fs[n].featureCount = sz;
cannam@12 788
cannam@12 789 for (size_t j = 0; j < sz; ++j) {
cannam@7 790
cannam@76 791 // std::cerr << "PluginAdapterBase::Impl::convertFeatures: j = " << j << std::endl;
cannam@7 792
cannam@168 793 VampFeature *feature = &fs[n].features[j].v1;
cannam@7 794
cannam@7 795 feature->hasTimestamp = fl[j].hasTimestamp;
cannam@7 796 feature->sec = fl[j].timestamp.sec;
cannam@7 797 feature->nsec = fl[j].timestamp.nsec;
cannam@7 798 feature->valueCount = fl[j].values.size();
cannam@7 799
cannam@168 800 VampFeatureV2 *v2 = &fs[n].features[j + sz].v2;
cannam@167 801
cannam@167 802 v2->hasDuration = fl[j].hasDuration;
cannam@167 803 v2->durationSec = fl[j].duration.sec;
cannam@167 804 v2->durationNsec = fl[j].duration.nsec;
cannam@167 805
cannam@12 806 if (feature->label) free(feature->label);
cannam@12 807
cannam@12 808 if (fl[j].label.empty()) {
cannam@12 809 feature->label = 0;
cannam@12 810 } else {
cannam@12 811 feature->label = strdup(fl[j].label.c_str());
cannam@7 812 }
cannam@7 813
cannam@12 814 if (feature->valueCount > m_fvsizes[plugin][n][j]) {
cannam@12 815 resizeFV(plugin, n, j, feature->valueCount);
cannam@12 816 }
cannam@7 817
cannam@7 818 for (unsigned int k = 0; k < feature->valueCount; ++k) {
cannam@76 819 // std::cerr << "PluginAdapterBase::Impl::convertFeatures: k = " << k << std::endl;
cannam@7 820 feature->values[k] = fl[j].values[k];
cannam@3 821 }
cannam@3 822 }
cannam@12 823
cannam@12 824 lastN = n;
cannam@3 825 }
cannam@3 826
cannam@12 827 if (lastN == -1) return 0;
cannam@12 828
cannam@12 829 if (int(outputCount) > lastN + 1) {
cannam@12 830 for (int i = lastN + 1; i < int(outputCount); ++i) {
cannam@12 831 fs[i].featureCount = 0;
cannam@12 832 }
cannam@12 833 }
cannam@3 834
cannam@168 835 // std::cerr << "PluginAdapter(v2)::convertFeatures: NOTE: have " << outputCount << " outputs" << std::endl;
cannam@168 836 // for (int i = 0; i < outputCount; ++i) {
cannam@168 837 // std::cerr << "PluginAdapter(v2)::convertFeatures: NOTE: output " << i << " has " << fs[i].featureCount << " features" << std::endl;
cannam@168 838 // }
cannam@168 839
cannam@168 840
cannam@3 841 return fs;
cannam@3 842 }
cannam@3 843
cannam@12 844 void
cannam@76 845 PluginAdapterBase::Impl::resizeFS(Plugin *plugin, int n)
cannam@12 846 {
cannam@76 847 // std::cerr << "PluginAdapterBase::Impl::resizeFS(" << plugin << ", " << n << ")" << std::endl;
cannam@12 848
cannam@12 849 int i = m_fsizes[plugin].size();
cannam@12 850 if (i >= n) return;
cannam@12 851
cannam@16 852 // std::cerr << "resizing from " << i << std::endl;
cannam@12 853
cannam@12 854 m_fs[plugin] = (VampFeatureList *)realloc
cannam@12 855 (m_fs[plugin], n * sizeof(VampFeatureList));
cannam@12 856
cannam@12 857 while (i < n) {
cannam@12 858 m_fs[plugin][i].featureCount = 0;
cannam@12 859 m_fs[plugin][i].features = 0;
cannam@12 860 m_fsizes[plugin].push_back(0);
cannam@12 861 m_fvsizes[plugin].push_back(std::vector<size_t>());
cannam@12 862 i++;
cannam@12 863 }
cannam@12 864 }
cannam@12 865
cannam@12 866 void
cannam@76 867 PluginAdapterBase::Impl::resizeFL(Plugin *plugin, int n, size_t sz)
cannam@12 868 {
cannam@76 869 // std::cerr << "PluginAdapterBase::Impl::resizeFL(" << plugin << ", " << n << ", "
cannam@16 870 // << sz << ")" << std::endl;
cannam@12 871
cannam@12 872 size_t i = m_fsizes[plugin][n];
cannam@12 873 if (i >= sz) return;
cannam@12 874
cannam@16 875 // std::cerr << "resizing from " << i << std::endl;
cannam@12 876
cannam@168 877 m_fs[plugin][n].features = (VampFeatureUnion *)realloc
cannam@168 878 (m_fs[plugin][n].features, 2 * sz * sizeof(VampFeatureUnion));
cannam@167 879
cannam@12 880 while (m_fsizes[plugin][n] < sz) {
cannam@168 881 m_fs[plugin][n].features[m_fsizes[plugin][n]].v1.hasTimestamp = 0;
cannam@168 882 m_fs[plugin][n].features[m_fsizes[plugin][n]].v1.valueCount = 0;
cannam@168 883 m_fs[plugin][n].features[m_fsizes[plugin][n]].v1.values = 0;
cannam@168 884 m_fs[plugin][n].features[m_fsizes[plugin][n]].v1.label = 0;
cannam@189 885 m_fs[plugin][n].features[m_fsizes[plugin][n] + sz].v2.hasDuration = 0;
cannam@12 886 m_fvsizes[plugin][n].push_back(0);
cannam@12 887 m_fsizes[plugin][n]++;
cannam@12 888 }
cannam@12 889 }
cannam@12 890
cannam@12 891 void
cannam@76 892 PluginAdapterBase::Impl::resizeFV(Plugin *plugin, int n, int j, size_t sz)
cannam@12 893 {
cannam@76 894 // std::cerr << "PluginAdapterBase::Impl::resizeFV(" << plugin << ", " << n << ", "
cannam@16 895 // << j << ", " << sz << ")" << std::endl;
cannam@12 896
cannam@12 897 size_t i = m_fvsizes[plugin][n][j];
cannam@12 898 if (i >= sz) return;
cannam@12 899
cannam@16 900 // std::cerr << "resizing from " << i << std::endl;
cannam@12 901
cannam@168 902 m_fs[plugin][n].features[j].v1.values = (float *)realloc
cannam@168 903 (m_fs[plugin][n].features[j].v1.values, sz * sizeof(float));
cannam@12 904
cannam@12 905 m_fvsizes[plugin][n][j] = sz;
cannam@12 906 }
cannam@12 907
cannam@76 908 PluginAdapterBase::Impl::AdapterMap *
cannam@76 909 PluginAdapterBase::Impl::m_adapterMap = 0;
cannam@3 910
cannam@3 911 }
cannam@3 912
cannam@233 913 _VAMP_SDK_PLUGSPACE_END(PluginAdapter.cpp)
cannam@230 914