diff transform/FeatureExtractionPluginTransform.cpp @ 26:d88d117e0c34

* Add mono timestretch toggle button; some more work on getting blocksize etc parameters through to plugins
author Chris Cannam
date Mon, 18 Sep 2006 16:43:17 +0000
parents e764bbf2b090
children 61259228d029
line wrap: on
line diff
--- a/transform/FeatureExtractionPluginTransform.cpp	Fri Sep 15 15:35:06 2006 +0000
+++ b/transform/FeatureExtractionPluginTransform.cpp	Mon Sep 18 16:43:17 2006 +0000
@@ -36,12 +36,16 @@
 								   QString pluginId,
                                                                    int channel,
                                                                    QString configurationXml,
-								   QString outputName) :
+								   QString outputName,
+                                                                   size_t stepSize,
+                                                                   size_t blockSize,
+                                                                   WindowType windowType) :
     Transform(inputModel),
     m_plugin(0),
     m_channel(channel),
     m_stepSize(0),
     m_blockSize(0),
+    m_windowType(windowType),
     m_descriptor(0),
     m_outputFeatureNo(0)
 {
@@ -68,11 +72,17 @@
         PluginXml(m_plugin).setParametersFromXml(configurationXml);
     }
 
-    m_blockSize = m_plugin->getPreferredBlockSize();
-    m_stepSize = m_plugin->getPreferredStepSize();
+    if (m_blockSize == 0) m_blockSize = m_plugin->getPreferredBlockSize();
+    if (m_stepSize == 0) m_stepSize = m_plugin->getPreferredStepSize();
 
-    if (m_blockSize == 0) m_blockSize = 1024; //!!! todo: ask user
-    if (m_stepSize == 0) m_stepSize = m_blockSize; //!!! likewise
+    if (m_blockSize == 0) m_blockSize = 1024;
+    if (m_stepSize == 0) {
+        if (m_plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain) {
+            m_stepSize = m_blockSize / 2;
+        } else {
+            m_stepSize = m_blockSize;
+        }
+    }
 
     DenseTimeValueModel *input = getInput();
     if (!input) return;
@@ -250,7 +260,7 @@
             fftModels.push_back(new FFTModel
                                   (getInput(),
                                    channelCount == 1 ? m_channel : ch,
-                                   HanningWindow,
+                                   m_windowType,
                                    m_blockSize,
                                    m_stepSize,
                                    m_blockSize,