annotate data/fileio/FFTFuzzyAdapter.h @ 1067:24c48323c662 tonioni

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