Mercurial > hg > vamp-plugin-sdk
comparison src/vamp-hostsdk/PluginBufferingAdapter.cpp @ 267:93c81a6c917a
* Ensure PluginBufferingAdapter returns fresh output descriptors after
a call to initialise, setParameter or selectProgram
* Fix RDF document base prefix
author | cannam |
---|---|
date | Tue, 25 Nov 2008 12:34:45 +0000 |
parents | 4454843ff384 |
children | 6579e441f2fe |
comparison
equal
deleted
inserted
replaced
266:53b0e7557c52 | 267:93c81a6c917a |
---|---|
61 bool initialise(size_t channels, size_t stepSize, size_t blockSize); | 61 bool initialise(size_t channels, size_t stepSize, size_t blockSize); |
62 | 62 |
63 void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize); | 63 void getActualStepAndBlockSizes(size_t &stepSize, size_t &blockSize); |
64 | 64 |
65 OutputList getOutputDescriptors() const; | 65 OutputList getOutputDescriptors() const; |
66 | |
67 void setParameter(std::string, float); | |
68 void selectProgram(std::string); | |
66 | 69 |
67 void reset(); | 70 void reset(); |
68 | 71 |
69 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); | 72 FeatureSet process(const float *const *inputBuffers, RealTime timestamp); |
70 | 73 |
309 { | 312 { |
310 return m_impl->getOutputDescriptors(); | 313 return m_impl->getOutputDescriptors(); |
311 } | 314 } |
312 | 315 |
313 void | 316 void |
317 PluginBufferingAdapter::setParameter(std::string name, float value) | |
318 { | |
319 m_impl->setParameter(name, value); | |
320 } | |
321 | |
322 void | |
323 PluginBufferingAdapter::selectProgram(std::string name) | |
324 { | |
325 m_impl->selectProgram(name); | |
326 } | |
327 | |
328 void | |
314 PluginBufferingAdapter::reset() | 329 PluginBufferingAdapter::reset() |
315 { | 330 { |
316 m_impl->reset(); | 331 m_impl->reset(); |
317 } | 332 } |
318 | 333 |
456 for (size_t i = 0; i < m_channels; ++i) { | 471 for (size_t i = 0; i < m_channels; ++i) { |
457 m_queue.push_back(new RingBuffer(m_blockSize + m_inputBlockSize)); | 472 m_queue.push_back(new RingBuffer(m_blockSize + m_inputBlockSize)); |
458 m_buffers[i] = new float[m_blockSize]; | 473 m_buffers[i] = new float[m_blockSize]; |
459 } | 474 } |
460 | 475 |
461 return m_plugin->initialise(m_channels, m_stepSize, m_blockSize); | 476 bool success = m_plugin->initialise(m_channels, m_stepSize, m_blockSize); |
477 | |
478 if (success) { | |
479 // Re-query outputs; properties such as bin count may have | |
480 // changed on initialise | |
481 m_outputs.clear(); | |
482 (void)getOutputDescriptors(); | |
483 } | |
484 | |
485 return success; | |
462 } | 486 } |
463 | 487 |
464 PluginBufferingAdapter::OutputList | 488 PluginBufferingAdapter::OutputList |
465 PluginBufferingAdapter::Impl::getOutputDescriptors() const | 489 PluginBufferingAdapter::Impl::getOutputDescriptors() const |
466 { | 490 { |
499 | 523 |
500 return outs; | 524 return outs; |
501 } | 525 } |
502 | 526 |
503 void | 527 void |
528 PluginBufferingAdapter::Impl::setParameter(std::string name, float value) | |
529 { | |
530 m_plugin->setParameter(name, value); | |
531 | |
532 // Re-query outputs; properties such as bin count may have changed | |
533 m_outputs.clear(); | |
534 (void)getOutputDescriptors(); | |
535 } | |
536 | |
537 void | |
538 PluginBufferingAdapter::Impl::selectProgram(std::string name) | |
539 { | |
540 m_plugin->selectProgram(name); | |
541 | |
542 // Re-query outputs; properties such as bin count may have changed | |
543 m_outputs.clear(); | |
544 (void)getOutputDescriptors(); | |
545 } | |
546 | |
547 void | |
504 PluginBufferingAdapter::Impl::reset() | 548 PluginBufferingAdapter::Impl::reset() |
505 { | 549 { |
506 m_frame = 0; | 550 m_frame = 0; |
507 m_unrun = true; | 551 m_unrun = true; |
508 | 552 |