Mercurial > hg > svgui
comparison layer/SpectrogramLayer.h @ 113:7a23edd831cb
* Various fft server improvements, including the ability to pick out data from
an existing fft cache at a smaller increment or larger fft size rather than
recalculating it (if appropriate)
author | Chris Cannam |
---|---|
date | Thu, 29 Jun 2006 16:16:49 +0000 |
parents | f262aa8973e3 |
children | 991de8783cf5 |
comparison
equal
deleted
inserted
replaced
112:43b1ca9647e1 | 113:7a23edd831cb |
---|---|
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 "model/PowerOfSqrtTwoZoomConstraint.h" | 23 #include "model/PowerOfSqrtTwoZoomConstraint.h" |
24 #include "model/DenseTimeValueModel.h" | 24 #include "model/DenseTimeValueModel.h" |
25 #include "fileio/FFTDataServer.h" | |
25 | 26 |
26 #include <QMutex> | 27 #include <QMutex> |
27 #include <QWaitCondition> | 28 #include <QWaitCondition> |
28 #include <QImage> | 29 #include <QImage> |
29 #include <QPixmap> | 30 #include <QPixmap> |
31 class View; | 32 class View; |
32 class QPainter; | 33 class QPainter; |
33 class QImage; | 34 class QImage; |
34 class QPixmap; | 35 class QPixmap; |
35 class QTimer; | 36 class QTimer; |
36 class FFTDataServer; | |
37 | 37 |
38 /** | 38 /** |
39 * SpectrogramLayer represents waveform data (obtained from a | 39 * SpectrogramLayer represents waveform data (obtained from a |
40 * DenseTimeValueModel) in spectrogram form. | 40 * DenseTimeValueModel) in spectrogram form. |
41 */ | 41 */ |
306 size_t getWindowIncrement() const { | 306 size_t getWindowIncrement() const { |
307 if (m_windowHopLevel == 0) return m_windowSize; | 307 if (m_windowHopLevel == 0) return m_windowSize; |
308 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; | 308 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4; |
309 else return m_windowSize / (1 << (m_windowHopLevel - 1)); | 309 else return m_windowSize / (1 << (m_windowHopLevel - 1)); |
310 } | 310 } |
311 | |
312 size_t getFFTWidth() const { | |
313 return m_fftServer->getWidth(getWindowIncrement(), m_fftSize); | |
314 } | |
315 size_t getFFTHeight() const { | |
316 return m_fftServer->getHeight(getWindowIncrement(), m_fftSize); | |
317 } | |
318 float getFFTMagnitudeAt(size_t x, size_t y) const { | |
319 return m_fftServer->getMagnitudeAt(getWindowIncrement(), m_fftSize, | |
320 x, y); | |
321 } | |
322 float getFFTNormalizedMagnitudeAt(size_t x, size_t y) const { | |
323 return m_fftServer->getNormalizedMagnitudeAt(getWindowIncrement(), m_fftSize, | |
324 x, y); | |
325 } | |
326 float getFFTPhaseAt(size_t x, size_t y) const { | |
327 return m_fftServer->getPhaseAt(getWindowIncrement(), m_fftSize, | |
328 x, y); | |
329 } | |
330 void getFFTValuesAt(size_t x, size_t y, float &real, float &imag) const { | |
331 m_fftServer->getValuesAt(getWindowIncrement(), m_fftSize, | |
332 x, y, real, imag); | |
333 } | |
334 bool isFFTLocalPeak(size_t x, size_t y) const { | |
335 return m_fftServer->isLocalPeak(getWindowIncrement(), m_fftSize, | |
336 x, y); | |
337 } | |
338 bool isFFTOverThreshold(size_t x, size_t y, float threshold) const { | |
339 return m_fftServer->isOverThreshold(getWindowIncrement(), m_fftSize, | |
340 x, y, threshold); | |
341 } | |
342 bool isFFTColumnReady(size_t x) const { | |
343 return m_fftServer->isColumnReady(getWindowIncrement(), m_fftSize, x); | |
344 } | |
311 }; | 345 }; |
312 | 346 |
313 #endif | 347 #endif |