comparison 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
comparison
equal deleted inserted replaced
96:095916d7ed4d 97:a0e7edf9703a
18 18
19 #include "base/Layer.h" 19 #include "base/Layer.h"
20 #include "base/Window.h" 20 #include "base/Window.h"
21 #include "base/RealTime.h" 21 #include "base/RealTime.h"
22 #include "base/Thread.h" 22 #include "base/Thread.h"
23 #include "base/ResizeableBitmap.h"
24 #include "model/PowerOfSqrtTwoZoomConstraint.h" 23 #include "model/PowerOfSqrtTwoZoomConstraint.h"
25 #include "model/DenseTimeValueModel.h" 24 #include "model/DenseTimeValueModel.h"
26 25
27 #include <QMutex> 26 #include <QMutex>
28 #include <QWaitCondition> 27 #include <QWaitCondition>
92 int getChannel() const; 91 int getChannel() const;
93 92
94 void setWindowSize(size_t); 93 void setWindowSize(size_t);
95 size_t getWindowSize() const; 94 size_t getWindowSize() const;
96 95
97 void setWindowOverlap(size_t percent); 96 void setWindowHopLevel(size_t percent);
98 size_t getWindowOverlap() const; 97 size_t getWindowHopLevel() const;
99 98
100 void setWindowType(WindowType type); 99 void setWindowType(WindowType type);
101 WindowType getWindowType() const; 100 WindowType getWindowType() const;
102 101
103 /** 102 /**
208 const DenseTimeValueModel *m_model; // I do not own this 207 const DenseTimeValueModel *m_model; // I do not own this
209 208
210 int m_channel; 209 int m_channel;
211 size_t m_windowSize; 210 size_t m_windowSize;
212 WindowType m_windowType; 211 WindowType m_windowType;
213 size_t m_windowOverlap; 212 size_t m_windowHopLevel;
214 float m_gain; 213 float m_gain;
215 float m_threshold; 214 float m_threshold;
216 int m_colourRotation; 215 int m_colourRotation;
217 size_t m_minFrequency; 216 size_t m_minFrequency;
218 size_t m_maxFrequency; 217 size_t m_maxFrequency;
330 bool getXBinSourceRange(View *v, int x, RealTime &timeMin, RealTime &timeMax) const; 329 bool getXBinSourceRange(View *v, int x, RealTime &timeMin, RealTime &timeMax) const;
331 bool getXYBinSourceRange(View *v, int x, int y, float &min, float &max, 330 bool getXYBinSourceRange(View *v, int x, int y, float &min, float &max,
332 float &phaseMin, float &phaseMax) const; 331 float &phaseMin, float &phaseMax) const;
333 332
334 size_t getWindowIncrement() const { 333 size_t getWindowIncrement() const {
335 return m_windowSize - m_windowSize * m_windowOverlap / 100; 334 if (m_windowHopLevel == 0) return m_windowSize;
335 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4;
336 else return m_windowSize / (1 << (m_windowHopLevel - 1));
336 } 337 }
337 }; 338 };
338 339
339 #endif 340 #endif