changeset 64:02efb2bbdaf7

Default step and block size should be actual default values, not 0
author Chris Cannam
date Fri, 11 Nov 2016 16:52:17 +0000
parents ca8a541aa83f
children 4a5295555574
files src/PiperAdapter.h
diffstat 1 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/PiperAdapter.h	Fri Nov 11 11:08:10 2016 +0000
+++ b/src/PiperAdapter.h	Fri Nov 11 16:52:17 2016 +0000
@@ -114,12 +114,27 @@
 	if (p->getMinChannelCount() == p->getMaxChannelCount()) {
 	    defaultChannels = p->getMinChannelCount();
 	}
-    
-	response.defaultConfiguration = piper_vamp::PluginConfiguration::fromPlugin
+
+        int defaultBlockSize = p->getPreferredBlockSize();
+        int defaultStepSize = p->getPreferredStepSize();
+
+        if (defaultBlockSize == 0) {
+            defaultBlockSize = 1024;
+        }
+        if (defaultStepSize == 0) {
+            if (p->getInputDomain() == Vamp::Plugin::FrequencyDomain) {
+                defaultStepSize = defaultBlockSize / 2;
+            } else {
+                defaultStepSize = defaultBlockSize;
+            }
+        }
+        
+	response.defaultConfiguration =
+            piper_vamp::PluginConfiguration::fromPlugin
 	    (p,
 	     defaultChannels,
-	     p->getPreferredStepSize(),
-	     p->getPreferredBlockSize());
+	     defaultStepSize,
+             defaultBlockSize);
     
 	return response;
     }