changeset 32:37c0b59fd514

Expose smooth parameter through plugin
author Chris Cannam
date Fri, 31 Oct 2014 16:36:19 +0000
parents 1ff9ae1dcb50
children 333832a6ee5e
files MatchVampPlugin.cpp MatchVampPlugin.h
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MatchVampPlugin.cpp	Fri Oct 31 15:54:15 2014 +0000
+++ b/MatchVampPlugin.cpp	Fri Oct 31 16:36:19 2014 +0000
@@ -55,6 +55,7 @@
     m_serialise(false),
     m_begin(true),
     m_locked(false),
+    m_smooth(true),
     m_params(inputSampleRate, defaultStepTime, m_blockSize),
     m_defaultParams(inputSampleRate, defaultStepTime, m_blockSize)
 {
@@ -222,6 +223,17 @@
     desc.unit = "s";
     list.push_back(desc);
 
+    desc.identifier = "smooth";
+    desc.name = "Smooth Path";
+    desc.description = "Smooth the path by replacing steps with diagonals";
+    desc.minValue = 0;
+    desc.maxValue = 1;
+    desc.defaultValue = 1;
+    desc.isQuantized = true;
+    desc.quantizeStep = 1;
+    desc.unit = "";
+    list.push_back(desc);
+
     return list;
 }
 
@@ -242,6 +254,8 @@
         return m_params.maxRunCount;
     } else if (name == "zonewidth") {
         return m_params.blockTime;
+    } else if (name == "smooth") {
+        return m_smooth ? 1.0 : 0.0;
     }
     
     return 0.0;
@@ -264,6 +278,8 @@
         m_params.maxRunCount = int(value + 0.1);
     } else if (name == "zonewidth") {
         m_params.blockTime = value;
+    } else if (name == "smooth") {
+        m_smooth = (value > 0.5);
     }
 }
 
@@ -487,7 +503,7 @@
     Finder *finder = feeder->getFinder();
     std::vector<int> pathx;
     std::vector<int> pathy;
-    int len = finder->retrievePath(true, pathx, pathy);
+    int len = finder->retrievePath(m_smooth, pathx, pathy);
     
     FeatureSet returnFeatures;
 
--- a/MatchVampPlugin.h	Fri Oct 31 15:54:15 2014 +0000
+++ b/MatchVampPlugin.h	Fri Oct 31 16:36:19 2014 +0000
@@ -78,6 +78,7 @@
     bool m_serialise;
     bool m_begin;
     bool m_locked;
+    bool m_smooth;
 
     Matcher::Parameters m_params;
     Matcher::Parameters m_defaultParams;