changeset 75:dfdbf336bb37

* Remove dsp directory. This is now the qm-dsp library used by qm-vamp-plugins instead of being used in Sonic Visualiser directly. * Remove plugins that have now become part of qm-vamp-plugins. * Move time stretcher from dsp to audioio (this is the one DSP thing we do need in SV)
author Chris Cannam
date Thu, 06 Apr 2006 12:12:41 +0000
parents 195ad6178ef8
children 45ba0b381c5d
files layer/SpectrogramLayer.cpp
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Wed Apr 05 16:52:30 2006 +0000
+++ b/layer/SpectrogramLayer.cpp	Thu Apr 06 12:12:41 2006 +0000
@@ -21,8 +21,6 @@
 #include "base/Window.h"
 #include "base/Pitch.h"
 
-#include "dsp/maths/MathUtilities.h"
-
 #include <QPainter>
 #include <QImage>
 #include <QPixmap>
@@ -36,6 +34,18 @@
 
 //#define DEBUG_SPECTROGRAM_REPAINT 1
 
+static double mod(double x, double y)
+{
+    double a = floor(x / y);
+    double b = x - (y * a);
+    return b;
+}
+
+static double princarg(double ang)
+{
+    return mod(ang + M_PI, -2 * M_PI) + M_PI;
+}
+
 
 SpectrogramLayer::SpectrogramLayer(Configuration config) :
     Layer(),
@@ -1028,7 +1038,7 @@
     float expectedPhase =
 	oldPhase + (2.0 * M_PI * bin * windowIncrement) / windowSize;
 
-    float phaseError = MathUtilities::princarg(newPhase - expectedPhase);
+    float phaseError = princarg(newPhase - expectedPhase);
 	    
     if (fabs(phaseError) < (1.1 * (windowIncrement * M_PI) / windowSize)) {
 
@@ -1115,7 +1125,7 @@
 	if (mag > factor) factor = mag;
 
 	double phase = atan2(output[i][1], output[i][0]);
-	phase = MathUtilities::princarg(phase);
+	phase = princarg(phase);
 
 	output[i][0] = mag;
 	m_cache->setPhaseAt(column, i, phase);