diff src/Analyser.cpp @ 273:29005aa146e2

fixed candidates exceeding the frequency-constrained selection horizontally (vertically still to come)
author matthiasm
date Thu, 10 Apr 2014 17:55:43 +0100
parents 8eb167e817e7
children 2a2fd6eb8fa8
line wrap: on
line diff
--- a/src/Analyser.cpp	Thu Apr 03 09:39:16 2014 +0100
+++ b/src/Analyser.cpp	Thu Apr 10 17:55:43 2014 +0100
@@ -381,11 +381,17 @@
         t.setBlockSize(4096);
     }
 
-    RealTime start = RealTime::frame2RealTime
-        (round(sel.getStartFrame()*1.0/256) * 256 - 4*256, m_fileModel->getSampleRate()); // 4*256 is for 4 frames offset due to timestamp shift
-
-    RealTime end = RealTime::frame2RealTime
-        (round(sel.getEndFrame()*1.0/256) * 256 - 4*256, m_fileModel->getSampleRate());
+    // get time stamps that align with the 256-sample grid of the original extraction
+    int startSample = ceil(sel.getStartFrame()*1.0/256) * 256;
+    int endSample   = ceil(sel.getEndFrame()*1.0/256) * 256;
+    if (!range.isConstrained()) {
+        startSample -= 4*256; // 4*256 is for 4 frames offset due to timestamp shift
+        endSample   -= 4*256;
+    } else {
+        endSample   -= 9*256; // MM says: not sure what the CHP plugin does there
+    }
+    RealTime start = RealTime::frame2RealTime(startSample, m_fileModel->getSampleRate()); 
+    RealTime end = RealTime::frame2RealTime(endSample, m_fileModel->getSampleRate());
 
     RealTime duration;