annotate data/fft/FFTCache.h @ 230:2854dc429310

...
author Chris Cannam
date Mon, 12 Feb 2007 13:25:12 +0000
parents e5879045d22b
children 02d2ad95ea52
rev   line source
Chris@152 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@152 2
Chris@152 3 /*
Chris@152 4 Sonic Visualiser
Chris@152 5 An audio file viewer and annotation editor.
Chris@152 6 Centre for Digital Music, Queen Mary, University of London.
Chris@152 7 This file copyright 2006 Chris Cannam.
Chris@152 8
Chris@152 9 This program is free software; you can redistribute it and/or
Chris@152 10 modify it under the terms of the GNU General Public License as
Chris@152 11 published by the Free Software Foundation; either version 2 of the
Chris@152 12 License, or (at your option) any later version. See the file
Chris@152 13 COPYING included with this distribution for more information.
Chris@152 14 */
Chris@152 15
Chris@152 16 #ifndef _FFT_CACHE_H_
Chris@152 17 #define _FFT_CACHE_H_
Chris@152 18
Chris@152 19 #include <cstdlib>
Chris@152 20 #include <cmath>
Chris@152 21
Chris@152 22 #include <stdint.h>
Chris@152 23
Chris@152 24 class FFTCache
Chris@152 25 {
Chris@152 26 public:
Chris@152 27 virtual ~FFTCache() { }
Chris@152 28
Chris@152 29 virtual size_t getWidth() const = 0;
Chris@152 30 virtual size_t getHeight() const = 0;
Chris@152 31
Chris@152 32 virtual void resize(size_t width, size_t height) = 0;
Chris@152 33 virtual void reset() = 0; // zero-fill or 1-fill as appropriate without changing size
Chris@152 34
Chris@152 35 virtual float getMagnitudeAt(size_t x, size_t y) const = 0;
Chris@152 36 virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const = 0;
Chris@152 37 virtual float getMaximumMagnitudeAt(size_t x) const = 0;
Chris@152 38 virtual float getPhaseAt(size_t x, size_t y) const = 0;
Chris@152 39
Chris@152 40 virtual void getValuesAt(size_t x, size_t y, float &real, float &imaginary) const = 0;
Chris@152 41
Chris@152 42 virtual bool haveSetColumnAt(size_t x) const = 0;
Chris@152 43
Chris@152 44 // may modify argument arrays
Chris@152 45 virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) = 0;
Chris@152 46
Chris@152 47 // may modify argument arrays
Chris@152 48 virtual void setColumnAt(size_t x, float *reals, float *imags) = 0;
Chris@152 49
Chris@152 50 virtual void suspend() { }
Chris@152 51
Chris@152 52 protected:
Chris@152 53 FFTCache() { }
Chris@152 54 };
Chris@152 55
Chris@152 56
Chris@152 57 #endif