diff src/MatchVampPlugin.cpp @ 151:246de093f0f1 refactors

Make noise an option in the plugin: on by default, and therefore also switch on silence by default
author Chris Cannam
date Fri, 23 Jan 2015 09:20:04 +0000
parents 6914a6a01ffc
children fcf0dd0166b1 d6df9fe7b12f
line wrap: on
line diff
--- a/src/MatchVampPlugin.cpp	Thu Jan 22 17:25:24 2015 +0000
+++ b/src/MatchVampPlugin.cpp	Fri Jan 23 09:20:04 2015 +0000
@@ -214,6 +214,16 @@
     desc.defaultValue = m_defaultFcParams.silenceThreshold;
     desc.isQuantized = false;
     list.push_back(desc);
+
+    desc.identifier = "noise";
+    desc.name = "Mix in Noise";
+    desc.description = "Whether to mix in a small constant white noise term when calculating feature distance. This can improve alignment against sources containing cleanly synthesised audio.";
+    desc.minValue = 0;
+    desc.maxValue = 1;
+    desc.defaultValue = (int)m_defaultDParams.noise;
+    desc.isQuantized = true;
+    desc.quantizeStep = 1;
+    list.push_back(desc);
     
     desc.identifier = "gradientlimit";
     desc.name = "Gradient Limit";
@@ -283,6 +293,8 @@
         return m_smooth ? 1.0 : 0.0;
     } else if (name == "silencethreshold") {
         return m_fcParams.silenceThreshold;
+    } else if (name == "noise") {
+        return m_dParams.noise;
     }
     
     return 0.0;
@@ -311,6 +323,8 @@
         m_smooth = (value > 0.5);
     } else if (name == "silencethreshold") {
         m_fcParams.silenceThreshold = value;
+    } else if (name == "noise") {
+        m_dParams.noise = (DistanceMetric::NoiseAddition)(int(value + 0.1));
     }
 }