diff layer/SpectrogramLayer.h @ 97:a0e7edf9703a

* Use fractional window overlaps in the spectrogram, instead of percentages (90% is kind of meaningless when none of your window sizes are divisible by 10!) * ResizeableBitmap -> ResizeableBitset and the odd other tidy up
author Chris Cannam
date Wed, 10 May 2006 11:43:52 +0000
parents 1b3996a86cfa
children 0f36cdf407a6
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Tue May 09 20:39:23 2006 +0000
+++ b/layer/SpectrogramLayer.h	Wed May 10 11:43:52 2006 +0000
@@ -20,7 +20,6 @@
 #include "base/Window.h"
 #include "base/RealTime.h"
 #include "base/Thread.h"
-#include "base/ResizeableBitmap.h"
 #include "model/PowerOfSqrtTwoZoomConstraint.h"
 #include "model/DenseTimeValueModel.h"
 
@@ -94,8 +93,8 @@
     void setWindowSize(size_t);
     size_t getWindowSize() const;
     
-    void setWindowOverlap(size_t percent);
-    size_t getWindowOverlap() const;
+    void setWindowHopLevel(size_t percent);
+    size_t getWindowHopLevel() const;
 
     void setWindowType(WindowType type);
     WindowType getWindowType() const;
@@ -210,7 +209,7 @@
     int                 m_channel;
     size_t              m_windowSize;
     WindowType          m_windowType;
-    size_t              m_windowOverlap;
+    size_t              m_windowHopLevel;
     float               m_gain;
     float               m_threshold;
     int                 m_colourRotation;
@@ -332,7 +331,9 @@
 			     float &phaseMin, float &phaseMax) const;
 
     size_t getWindowIncrement() const {
-	return m_windowSize - m_windowSize * m_windowOverlap / 100;
+        if (m_windowHopLevel == 0) return m_windowSize;
+        else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4;
+        else return m_windowSize / (1 << (m_windowHopLevel - 1));
     }
 };