Mercurial > hg > svcore
diff 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 |
line wrap: on
line diff
--- a/transform/FeatureExtractionPluginTransform.cpp Thu Apr 06 17:24:13 2006 +0000 +++ b/transform/FeatureExtractionPluginTransform.cpp Fri Apr 07 17:50:33 2006 +0000 @@ -73,8 +73,10 @@ if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise - Vamp::Plugin::OutputList outputs = - m_plugin->getOutputDescriptors(); + //!!! cope with plugins that request non-power-of-2 block sizes in + // the frequency domain! + + Vamp::Plugin::OutputList outputs = m_plugin->getOutputDescriptors(); if (outputs.empty()) { std::cerr << "FeatureExtractionPluginTransform: Plugin \"" @@ -344,6 +346,15 @@ buffer[offset + got] = 0.0; ++got; } + + if (m_channel == -1 && channelCount == 1 && + getInput()->getChannelCount() > 1) { + // use mean instead of sum, as plugin input + int cc = getInput()->getChannelCount(); + for (long i = 0; i < size; ++i) { + buffer[i] /= cc; + } + } } void