diff src/Analyser.cpp @ 192:431a95c9d14d

Calculate frequency constraint for region outlining (does not actually do the analysis correctly yet)
author Chris Cannam
date Wed, 05 Mar 2014 09:36:13 +0000
parents 800e65412473
children 34797795a76c
line wrap: on
line diff
--- a/src/Analyser.cpp	Tue Mar 04 16:45:54 2014 +0000
+++ b/src/Analyser.cpp	Wed Mar 05 09:36:13 2014 +0000
@@ -74,11 +74,6 @@
     m_paneStack = paneStack;
     m_pane = pane;
 
-    disconnect(m_pane, SIGNAL(regionOutlined(QRect)),
-               m_pane, SLOT(zoomToRegion(QRect)));
-    connect(m_pane, SIGNAL(regionOutlined(QRect)),
-            this, SLOT(regionOutlined(QRect)));
-
     m_reAnalysingSelection = Selection();
     m_reAnalysisCandidates.clear();
     m_currentCandidate = -1;
@@ -255,14 +250,8 @@
     return "";
 }
 
-void
-Analyser::regionOutlined(QRect r)
-{
-    cerr << "regionOutlined(" << r.x() << "," << r.y() << "," << r.width() << "," << r.height() << ")" << endl;
-}
-
 QString
-Analyser::reAnalyseSelection(Selection sel)
+Analyser::reAnalyseSelection(Selection sel, FrequencyRange range)
 {
     if (sel == m_reAnalysingSelection) return "";
 
@@ -276,6 +265,11 @@
     QString base = "vamp:pyin:localcandidatepyin:";
     QString out = "pitchtrackcandidates";
 
+    if (range.isConstrained()) {
+        base = "vamp:pyin:yinfc:";
+        out = "f0";
+    }
+
     Transforms transforms;
 
     QString notFound = tr("Transform \"%1\" not found. Unable to perform interactive analysis.<br><br>Is the %2 Vamp plugin correctly installed?");
@@ -288,6 +282,11 @@
     t.setStepSize(256);
     t.setBlockSize(2048);
 
+    if (range.isConstrained()) {
+        t.setParameter("minfreq", range.min);
+        t.setParameter("maxfreq", range.max);
+    }
+
     RealTime start = RealTime::frame2RealTime
         (round(sel.getStartFrame()*1.0/256) * 256 - 2*256, m_fileModel->getSampleRate());