Mercurial > hg > svcore
comparison data/fileio/FFTFuzzyAdapter.h @ 148:1a42221a1522
* Reorganising code base. This revision will not compile.
author | Chris Cannam |
---|---|
date | Mon, 31 Jul 2006 11:49:58 +0000 |
parents | |
children | 59e7fe1b1003 |
comparison
equal
deleted
inserted
replaced
147:3a13b0d4934e | 148:1a42221a1522 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006 Chris Cannam. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #ifndef _FFT_FUZZY_ADAPTER_H_ | |
17 #define _FFT_FUZZY_ADAPTER_H_ | |
18 | |
19 #include "FFTDataServer.h" | |
20 | |
21 class FFTFuzzyAdapter | |
22 { | |
23 public: | |
24 FFTFuzzyAdapter(const DenseTimeValueModel *model, | |
25 int channel, | |
26 WindowType windowType, | |
27 size_t windowSize, | |
28 size_t windowIncrement, | |
29 size_t fftSize, | |
30 bool polar, | |
31 size_t fillFromColumn = 0); | |
32 ~FFTFuzzyAdapter(); | |
33 | |
34 size_t getWidth() const { | |
35 return m_server->getWidth() >> m_xshift; | |
36 } | |
37 size_t getHeight() const { | |
38 return m_server->getHeight() >> m_yshift; | |
39 } | |
40 float getMagnitudeAt(size_t x, size_t y) { | |
41 return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift); | |
42 } | |
43 float getNormalizedMagnitudeAt(size_t x, size_t y) { | |
44 return m_server->getNormalizedMagnitudeAt(x << m_xshift, y << m_yshift); | |
45 } | |
46 float getMaximumMagnitudeAt(size_t x) { | |
47 return m_server->getMaximumMagnitudeAt(x << m_xshift); | |
48 } | |
49 float getPhaseAt(size_t x, size_t y) { | |
50 return m_server->getPhaseAt(x << m_xshift, y << m_yshift); | |
51 } | |
52 void getValuesAt(size_t x, size_t y, float &real, float &imaginary) { | |
53 m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary); | |
54 } | |
55 bool isColumnReady(size_t x) { | |
56 return m_server->isColumnReady(x << m_xshift); | |
57 } | |
58 bool isLocalPeak(size_t x, size_t y) { | |
59 float mag = getMagnitudeAt(x, y); | |
60 if (y > 0 && mag < getMagnitudeAt(x, y - 1)) return false; | |
61 if (y < getHeight() - 1 && mag < getMagnitudeAt(x, y + 1)) return false; | |
62 return true; | |
63 } | |
64 bool isOverThreshold(size_t x, size_t y, float threshold) { | |
65 return getMagnitudeAt(x, y) > threshold; | |
66 } | |
67 | |
68 size_t getFillCompletion() const { return m_server->getFillCompletion(); } | |
69 size_t getFillExtent() const { return m_server->getFillExtent(); } | |
70 | |
71 private: | |
72 FFTFuzzyAdapter(const FFTFuzzyAdapter &); // not implemented | |
73 FFTFuzzyAdapter &operator=(const FFTFuzzyAdapter &); // not implemented | |
74 | |
75 FFTDataServer *m_server; | |
76 int m_xshift; | |
77 int m_yshift; | |
78 }; | |
79 | |
80 #endif |