Mercurial > hg > svgui
diff layer/SpectrogramLayer.h @ 114:991de8783cf5
* Add fuzzy-adapter class to pick out subset data from FFT data server, instead
of having separate methods in data server class. Update spectrogram to use it.
* Give spectrogram layer one fft adapter per view, in case the views need
different zero-padding levels.
* Reduce ridiculous memory consumption of MatrixFile for tall matrices.
Still very much work in progress here.
author | Chris Cannam |
---|---|
date | Fri, 30 Jun 2006 11:26:10 +0000 |
parents | 7a23edd831cb |
children | 47cb32bb35ab |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h Thu Jun 29 16:16:49 2006 +0000 +++ b/layer/SpectrogramLayer.h Fri Jun 30 11:26:10 2006 +0000 @@ -22,7 +22,8 @@ #include "base/Thread.h" #include "model/PowerOfSqrtTwoZoomConstraint.h" #include "model/DenseTimeValueModel.h" -#include "fileio/FFTDataServer.h" + +#include "fileio/FFTFuzzyAdapter.h" #include <QMutex> #include <QWaitCondition> @@ -34,6 +35,8 @@ class QImage; class QPixmap; class QTimer; +class FFTFuzzyAdapter; + /** * SpectrogramLayer represents waveform data (obtained from a @@ -245,9 +248,6 @@ ColourMap m_colourMap; - FFTDataServer *m_fftServer; - void getFFTServer(); - struct PixmapCache { QPixmap pixmap; @@ -261,10 +261,10 @@ mutable ViewPixmapCache m_pixmapCaches; mutable QImage m_drawBuffer; - QTimer *m_updateTimer; + mutable QTimer *m_updateTimer; mutable size_t m_candidateFillStartFrame; - size_t m_lastFillExtent; + mutable size_t m_lastFillExtent; bool m_exiting; void setColourmap(); @@ -309,39 +309,12 @@ else return m_windowSize / (1 << (m_windowHopLevel - 1)); } - size_t getFFTWidth() const { - return m_fftServer->getWidth(getWindowIncrement(), m_fftSize); - } - size_t getFFTHeight() const { - return m_fftServer->getHeight(getWindowIncrement(), m_fftSize); - } - float getFFTMagnitudeAt(size_t x, size_t y) const { - return m_fftServer->getMagnitudeAt(getWindowIncrement(), m_fftSize, - x, y); - } - float getFFTNormalizedMagnitudeAt(size_t x, size_t y) const { - return m_fftServer->getNormalizedMagnitudeAt(getWindowIncrement(), m_fftSize, - x, y); - } - float getFFTPhaseAt(size_t x, size_t y) const { - return m_fftServer->getPhaseAt(getWindowIncrement(), m_fftSize, - x, y); - } - void getFFTValuesAt(size_t x, size_t y, float &real, float &imag) const { - m_fftServer->getValuesAt(getWindowIncrement(), m_fftSize, - x, y, real, imag); - } - bool isFFTLocalPeak(size_t x, size_t y) const { - return m_fftServer->isLocalPeak(getWindowIncrement(), m_fftSize, - x, y); - } - bool isFFTOverThreshold(size_t x, size_t y, float threshold) const { - return m_fftServer->isOverThreshold(getWindowIncrement(), m_fftSize, - x, y, threshold); - } - bool isFFTColumnReady(size_t x) const { - return m_fftServer->isColumnReady(getWindowIncrement(), m_fftSize, x); - } + size_t getZeroPadLevel(const View *v) const; + size_t getFFTSize(const View *v) const; + FFTFuzzyAdapter *getFFTAdapter(const View *v) const; + void invalidateFFTAdapters(); + typedef std::map<const View *, FFTFuzzyAdapter *> ViewFFTMap; + mutable ViewFFTMap m_fftAdapters; }; #endif