diff runner/FeatureExtractionManager.cpp @ 51:c30b9720bde0

Add proper support and tests for window type parameter (requires latest update to Vamp host SDK)
author Chris Cannam
date Tue, 21 Jun 2011 15:41:52 +0100
parents 91d20795a109
children 513230b19248
line wrap: on
line diff
--- a/runner/FeatureExtractionManager.cpp	Wed Jun 15 15:39:08 2011 +0100
+++ b/runner/FeatureExtractionManager.cpp	Tue Jun 21 15:41:52 2011 +0100
@@ -116,6 +116,30 @@
     return true;
 }
 
+static PluginInputDomainAdapter::WindowType
+convertWindowType(WindowType t)
+{
+    switch (t) {
+    case RectangularWindow:
+        return PluginInputDomainAdapter::RectangularWindow;
+    case BartlettWindow:
+        return PluginInputDomainAdapter::BartlettWindow;
+    case HammingWindow:
+        return PluginInputDomainAdapter::HammingWindow;
+    case HanningWindow:
+        return PluginInputDomainAdapter::HanningWindow;
+    case BlackmanWindow:
+        return PluginInputDomainAdapter::BlackmanWindow;
+    case NuttallWindow:
+        return PluginInputDomainAdapter::NuttallWindow;
+    case BlackmanHarrisWindow:
+        return PluginInputDomainAdapter::BlackmanHarrisWindow;
+    default:
+        cerr << "ERROR: Unknown or unsupported window type \"" << t << "\", using Hann (\"" << HanningWindow << "\")" << endl;
+        return PluginInputDomainAdapter::HanningWindow;
+    }
+}
+
 bool FeatureExtractionManager::addFeatureExtractor
 (Transform transform, const vector<FeatureWriter*> &writers)
 {
@@ -210,8 +234,13 @@
 
             // adapt the plugin for buffering, channels, etc.
             if (plugin->getInputDomain() == Plugin::FrequencyDomain) {
+
                 pida = new PluginInputDomainAdapter(plugin);
                 pida->setProcessTimestampMethod(PluginInputDomainAdapter::ShiftData);
+
+                PluginInputDomainAdapter::WindowType wtype =
+                    convertWindowType(transform.getWindowType());
+                pida->setWindowType(wtype);
                 plugin = pida;
             }