Mercurial > hg > svcore
comparison transform/FeatureExtractionPluginTransform.cpp @ 74:47fd14e29813
* Fix long-standing off-by-1 bug in WaveFileModel that was getting us the wrong
values for almost all audio data when merging channels (channel == -1)
* Implement cut, copy and paste
* Make draw mode work properly in time value layer
* Minor fixes to CSV import
author | Chris Cannam |
---|---|
date | Fri, 07 Apr 2006 17:50:33 +0000 |
parents | e9b8b51f6326 |
children | 8cd01027502f |
comparison
equal
deleted
inserted
replaced
73:e9b8b51f6326 | 74:47fd14e29813 |
---|---|
71 m_stepSize = m_plugin->getPreferredStepSize(); | 71 m_stepSize = m_plugin->getPreferredStepSize(); |
72 | 72 |
73 if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user | 73 if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user |
74 if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise | 74 if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise |
75 | 75 |
76 Vamp::Plugin::OutputList outputs = | 76 //!!! cope with plugins that request non-power-of-2 block sizes in |
77 m_plugin->getOutputDescriptors(); | 77 // the frequency domain! |
78 | |
79 Vamp::Plugin::OutputList outputs = m_plugin->getOutputDescriptors(); | |
78 | 80 |
79 if (outputs.empty()) { | 81 if (outputs.empty()) { |
80 std::cerr << "FeatureExtractionPluginTransform: Plugin \"" | 82 std::cerr << "FeatureExtractionPluginTransform: Plugin \"" |
81 << pluginId.toStdString() << "\" has no outputs" << std::endl; | 83 << pluginId.toStdString() << "\" has no outputs" << std::endl; |
82 return; | 84 return; |
342 | 344 |
343 while (got < size) { | 345 while (got < size) { |
344 buffer[offset + got] = 0.0; | 346 buffer[offset + got] = 0.0; |
345 ++got; | 347 ++got; |
346 } | 348 } |
349 | |
350 if (m_channel == -1 && channelCount == 1 && | |
351 getInput()->getChannelCount() > 1) { | |
352 // use mean instead of sum, as plugin input | |
353 int cc = getInput()->getChannelCount(); | |
354 for (long i = 0; i < size; ++i) { | |
355 buffer[i] /= cc; | |
356 } | |
357 } | |
347 } | 358 } |
348 | 359 |
349 void | 360 void |
350 FeatureExtractionPluginTransform::addFeature(size_t blockFrame, | 361 FeatureExtractionPluginTransform::addFeature(size_t blockFrame, |
351 const Vamp::Plugin::Feature &feature) | 362 const Vamp::Plugin::Feature &feature) |