svcore  1.9
FFTFuzzyAdapter.h
Go to the documentation of this file.
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 
22 {
23 public:
25  int channel,
26  WindowType windowType,
27  int windowSize,
28  int windowIncrement,
29  int fftSize,
30  bool polar,
31  int fillFromColumn = 0);
33 
34  int getWidth() const {
35  return m_server->getWidth() >> m_xshift;
36  }
37  int getHeight() const {
38  return m_server->getHeight() >> m_yshift;
39  }
40  float getMagnitudeAt(int x, int y) {
41  return m_server->getMagnitudeAt(x << m_xshift, y << m_yshift);
42  }
43  float getNormalizedMagnitudeAt(int x, int y) {
45  }
46  float getMaximumMagnitudeAt(int x) {
48  }
49  float getPhaseAt(int x, int y) {
50  return m_server->getPhaseAt(x << m_xshift, y << m_yshift);
51  }
52  void getValuesAt(int x, int y, float &real, float &imaginary) {
53  m_server->getValuesAt(x << m_xshift, y << m_yshift, real, imaginary);
54  }
55  bool isColumnReady(int x) {
56  return m_server->isColumnReady(x << m_xshift);
57  }
58  bool isLocalPeak(int x, int 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(int x, int y, float threshold) {
65  return getMagnitudeAt(x, y) > threshold;
66  }
67 
68  int getFillCompletion() const { return m_server->getFillCompletion(); }
69  int getFillExtent() const { return m_server->getFillExtent(); }
70 
71 private:
72  FFTFuzzyAdapter(const FFTFuzzyAdapter &); // not implemented
73  FFTFuzzyAdapter &operator=(const FFTFuzzyAdapter &); // not implemented
74 
76  int m_xshift;
77  int m_yshift;
78 };
79 
80 #endif
int getFillCompletion() const
float getPhaseAt(int x, int y)
bool isLocalPeak(int x, int y)
bool isOverThreshold(int x, int y, float threshold)
FFTDataServer * m_server
int getWidth() const
float getMaximumMagnitudeAt(int x)
float getMagnitudeAt(int x, int y)
WindowType
Definition: Window.h:27
float getMaximumMagnitudeAt(int x)
float getMagnitudeAt(int x, int y)
int getFillExtent() const
float getPhaseAt(int x, int y)
int getHeight() const
Definition: FFTDataServer.h:79
FFTFuzzyAdapter & operator=(const FFTFuzzyAdapter &)
bool isColumnReady(int x)
int getFillCompletion() const
void getValuesAt(int x, int y, float &real, float &imaginary)
Base class for models containing dense two-dimensional data (value against time).
FFTFuzzyAdapter(const DenseTimeValueModel *model, int channel, WindowType windowType, int windowSize, int windowIncrement, int fftSize, bool polar, int fillFromColumn=0)
float getNormalizedMagnitudeAt(int x, int y)
bool isColumnReady(int x)
int getHeight() const
int getWidth() const
Definition: FFTDataServer.h:78
int getFillExtent() const
float getNormalizedMagnitudeAt(int x, int y)
void getValuesAt(int x, int y, float &real, float &imaginary)