Mercurial > hg > svcore
comparison data/model/FFTModel.h @ 182:f75f8a1cd7b1
* Some dull work to continue unifying the fft model and editable dense 3d model
interfaces
author | Chris Cannam |
---|---|
date | Mon, 09 Oct 2006 10:49:46 +0000 |
parents | ae9be6b6b522 |
children | fb8ddd00f440 |
comparison
equal
deleted
inserted
replaced
181:9c652f2c39b1 | 182:f75f8a1cd7b1 |
---|---|
30 size_t fftSize, | 30 size_t fftSize, |
31 bool polar, | 31 bool polar, |
32 size_t fillFromColumn = 0); | 32 size_t fillFromColumn = 0); |
33 ~FFTModel(); | 33 ~FFTModel(); |
34 | 34 |
35 size_t getWidth() const { | |
36 return m_server->getWidth() >> m_xshift; | |
37 } | |
38 size_t getHeight() const { | |
39 return m_server->getHeight() >> m_yshift; | |
40 } | |
41 float getMagnitudeAt(size_t x, size_t y) { | 35 float getMagnitudeAt(size_t x, size_t y) { |
42 return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift); | 36 return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift); |
43 } | 37 } |
44 float getNormalizedMagnitudeAt(size_t x, size_t y) { | 38 float getNormalizedMagnitudeAt(size_t x, size_t y) { |
45 return m_server->getNormalizedMagnitudeAt(x << m_xshift, y << m_yshift); | 39 return m_server->getNormalizedMagnitudeAt(x << m_xshift, y << m_yshift); |
51 return m_server->getPhaseAt(x << m_xshift, y << m_yshift); | 45 return m_server->getPhaseAt(x << m_xshift, y << m_yshift); |
52 } | 46 } |
53 void getValuesAt(size_t x, size_t y, float &real, float &imaginary) { | 47 void getValuesAt(size_t x, size_t y, float &real, float &imaginary) { |
54 m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary); | 48 m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary); |
55 } | 49 } |
56 bool isColumnReady(size_t x) { | 50 bool isColumnAvailable(size_t x) const { |
57 return m_server->isColumnReady(x << m_xshift); | 51 return m_server->isColumnReady(x << m_xshift); |
58 } | |
59 bool isLocalPeak(size_t x, size_t y) { | |
60 float mag = getMagnitudeAt(x, y); | |
61 if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false; | |
62 if (y < getHeight() - 1 && mag < getMagnitudeAt(x, y + 1)) return false; | |
63 return true; | |
64 } | |
65 bool isOverThreshold(size_t x, size_t y, float threshold) { | |
66 return getMagnitudeAt(x, y) > threshold; | |
67 } | 52 } |
68 | 53 |
69 size_t getFillExtent() const { return m_server->getFillExtent(); } | 54 size_t getFillExtent() const { return m_server->getFillExtent(); } |
70 | 55 |
71 // DenseThreeDimensionalModel and Model methods: | 56 // DenseThreeDimensionalModel and Model methods: |
72 // | 57 // |
58 virtual size_t getWidth() const { | |
59 return m_server->getWidth() >> m_xshift; | |
60 } | |
61 virtual size_t getHeight() const { | |
62 return m_server->getHeight() >> m_yshift; | |
63 } | |
64 virtual float getValueAt(size_t x, size_t y) const { | |
65 return const_cast<FFTModel *>(this)->getMagnitudeAt(x, y); | |
66 } | |
73 virtual bool isOK() const { | 67 virtual bool isOK() const { |
74 return m_server && m_server->getModel(); | 68 return m_server && m_server->getModel(); |
75 } | 69 } |
76 virtual size_t getStartFrame() const { | 70 virtual size_t getStartFrame() const { |
77 return 0; | 71 return 0; |
90 return 0.f; // Can't provide | 84 return 0.f; // Can't provide |
91 } | 85 } |
92 virtual float getMaximumLevel() const { | 86 virtual float getMaximumLevel() const { |
93 return 1.f; // Can't provide | 87 return 1.f; // Can't provide |
94 } | 88 } |
95 virtual void getBinValues(long windowStartFrame, BinValueSet &result) const; | 89 virtual void getColumn(size_t x, Column &result) const; |
96 virtual float getBinValue(long windowStartFrame, size_t n) const; | |
97 virtual QString getBinName(size_t n) const; | 90 virtual QString getBinName(size_t n) const; |
98 | 91 |
99 virtual int getCompletion() const { return m_server->getFillCompletion(); } | 92 virtual int getCompletion() const { return m_server->getFillCompletion(); } |
100 | 93 |
101 virtual Model *clone() const; | 94 virtual Model *clone() const; |