diff host/vamp-simple-host.cpp @ 91:200a663bace1

* more fine tuning of handling of block and step sizes
author cannam
date Thu, 01 Nov 2007 10:25:35 +0000
parents d17b9ca3b8c9
children c94c066a4897
line wrap: on
line diff
--- a/host/vamp-simple-host.cpp	Fri Oct 19 12:49:56 2007 +0000
+++ b/host/vamp-simple-host.cpp	Thu Nov 01 10:25:35 2007 +0000
@@ -245,13 +245,23 @@
     int blockSize = plugin->getPreferredBlockSize();
     int stepSize = plugin->getPreferredStepSize();
 
-    if (blockSize == 0) blockSize = 1024;
+    if (blockSize == 0) {
+        blockSize = 1024;
+    }
     if (stepSize == 0) {
         if (plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain) {
             stepSize = blockSize/2;
         } else {
             stepSize = blockSize;
         }
+    } else if (stepSize > blockSize) {
+        cerr << "WARNING: stepSize " << stepSize << " > blockSize " << blockSize << ", resetting blockSize to ";
+        if (plugin->getInputDomain() == Vamp::Plugin::FrequencyDomain) {
+            blockSize = stepSize * 2;
+        } else {
+            blockSize = stepSize;
+        }
+        cerr << blockSize << endl;
     }
 
     int channels = sfinfo.channels;