diff TestDefaults.cpp @ 52:4bd0cd3c60f3

Fix erroneous timestamp printing in verbose feature output (it was printing (none) if there was a timestamp instead of if there wasn't); print only diffs; update SDK subrepo
author Chris Cannam
date Fri, 12 Sep 2014 18:05:52 +0100
parents f1e8e14e9c96
children fa66ee7dcf08
line wrap: on
line diff
--- a/TestDefaults.cpp	Thu Sep 04 09:58:18 2014 +0100
+++ b/TestDefaults.cpp	Fri Sep 12 18:05:52 2014 +0100
@@ -103,7 +103,7 @@
         Result res;
         if (options & NonDeterministic) res = note(message);
         else res = error(message);
-        if (options & Verbose) dump(res, f[0], f[1]);
+        if (options & Verbose) dumpDiff(res, f[0], f[1]);
         r.push_back(res);
     } else {
         r.push_back(success());
@@ -163,7 +163,7 @@
         Result res;
         if (options & NonDeterministic) res = note(message);
         else res = error(message);
-        if (options & Verbose) dump(res, f[0], f[1]);
+        if (options & Verbose) dumpDiff(res, f[0], f[1]);
         r.push_back(res);
     } else {
         r.push_back(success());
@@ -224,7 +224,30 @@
             p->setParameter(pl[i].identifier, value);
         }
 
-        if (!initAdapted(p.get(), channels, _step, _step, r)) return r;
+        if (!initAdapted(p.get(), channels, _step, _step, r)) {
+
+            // OK, plugin didn't like that. Let's try a different tack
+            // -- set everything to min except those parameters whose
+            // default is min, and set those to half way instead
+            
+            for (int i = 0; i < (int)pl.size(); ++i) {
+                float value = pl[i].minValue;
+                if (value == pl[i].defaultValue) {
+                    value = (pl[i].maxValue + pl[i].minValue) / 2;
+                    value = ceil(value / pl[i].quantizeStep) * pl[i].quantizeStep;
+                    if (value > pl[i].maxValue) {
+                        value = pl[i].maxValue;
+                    }
+                }
+                p->setParameter(pl[i].identifier, value);
+            }
+
+            r = Results();
+            if (!initAdapted(p.get(), channels, _step, _step, r)) {
+                // Still didn't work, give up
+                return r;
+            }
+        }
 
         //  First run: construct, set params, init, process
         // Second run: construct, set params, init, reset, process
@@ -254,7 +277,7 @@
         Result res;
         if (options & NonDeterministic) res = note(message);
         else res = error(message);
-        if (options & Verbose) dump(res, f[0], f[1]);
+        if (options & Verbose) dumpDiff(res, f[0], f[1]);
         r.push_back(res);
     } else {
         r.push_back(success());