# HG changeset patch # User Chris Cannam # Date 1144325561 0 # Node ID dfdbf336bb376aa2b56bc67eaf182ec3d21d5bc2 # Parent 195ad6178ef8091184b1a7adb5bd305110e9f458 * 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) diff -r 195ad6178ef8 -r dfdbf336bb37 layer/SpectrogramLayer.cpp --- 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 #include #include @@ -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);