Mercurial > hg > svcore
changeset 114:8cd01027502f
* Reorder plugin output querying so as to cope with plugins whose number of
values per output varies depending on the initialise parameters
* Make the colour 3D plot layer tolerably efficient with very dense models
* Allow export of colour 3D plot layers
author | Chris Cannam |
---|---|
date | Wed, 10 May 2006 16:34:03 +0000 |
parents | 534373d65f39 |
children | 90ade4fa63be |
files | transform/FeatureExtractionPluginTransform.cpp |
diffstat | 1 files changed, 27 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/transform/FeatureExtractionPluginTransform.cpp Wed May 10 11:43:52 2006 +0000 +++ b/transform/FeatureExtractionPluginTransform.cpp Wed May 10 16:34:03 2006 +0000 @@ -73,6 +73,28 @@ if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise + DenseTimeValueModel *input = getInput(); + if (!input) return; + + size_t channelCount = input->getChannelCount(); + if (m_plugin->getMaxChannelCount() < channelCount) { + channelCount = 1; + } + if (m_plugin->getMinChannelCount() > channelCount) { + std::cerr << "FeatureExtractionPluginTransform:: " + << "Can't provide enough channels to plugin (plugin min " + << m_plugin->getMinChannelCount() << ", max " + << m_plugin->getMaxChannelCount() << ", input model has " + << input->getChannelCount() << ")" << std::endl; + return; + } + + if (!m_plugin->initialise(channelCount, m_stepSize, m_blockSize)) { + std::cerr << "FeatureExtractionPluginTransform: Plugin " + << m_plugin->getName() << " failed to initialise!" << std::endl; + return; + } + //!!! cope with plugins that request non-power-of-2 block sizes in // the frequency domain! @@ -110,6 +132,9 @@ binCount = m_descriptor->binCount; } + std::cerr << "FeatureExtractionPluginTransform: output bin count " + << binCount << std::endl; + if (binCount > 0 && m_descriptor->hasKnownExtents) { minValue = m_descriptor->minValue; maxValue = m_descriptor->maxValue; @@ -193,26 +218,12 @@ if (!m_output) return; + size_t sampleRate = m_input->getSampleRate(); + size_t channelCount = input->getChannelCount(); if (m_plugin->getMaxChannelCount() < channelCount) { channelCount = 1; } - if (m_plugin->getMinChannelCount() > channelCount) { - std::cerr << "FeatureExtractionPluginTransform::run: " - << "Can't provide enough channels to plugin (plugin min " - << m_plugin->getMinChannelCount() << ", max " - << m_plugin->getMaxChannelCount() << ", input model has " - << input->getChannelCount() << ")" << std::endl; - return; - } - - size_t sampleRate = m_input->getSampleRate(); - - if (!m_plugin->initialise(channelCount, m_stepSize, m_blockSize)) { - std::cerr << "FeatureExtractionPluginTransform::run: Plugin " - << m_plugin->getName() << " failed to initialise!" << std::endl; - return; - } float **buffers = new float*[channelCount]; for (size_t ch = 0; ch < channelCount; ++ch) {