# HG changeset patch # User Chris Cannam # Date 1147278843 0 # Node ID 8cd01027502f91657ca6cb934aef7dac5dc04ce9 # Parent 534373d65f397b11177fcb2db21d9f13e81c7c7b * 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 diff -r 534373d65f39 -r 8cd01027502f transform/FeatureExtractionPluginTransform.cpp --- 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) {