annotate data/fft/FFTCache.h @ 524:12608139f6bc

* minor output tweaks
author Chris Cannam
date Fri, 12 Dec 2008 16:13:19 +0000
parents 6066bde1c126
children
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@509 41 virtual void getMagnitudesAt(size_t x, float *values, size_t minbin, size_t count, size_t step) const = 0;
Chris@152 42
Chris@152 43 virtual bool haveSetColumnAt(size_t x) const = 0;
Chris@152 44
Chris@152 45 // may modify argument arrays
Chris@152 46 virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) = 0;
Chris@152 47
Chris@152 48 // may modify argument arrays
Chris@152 49 virtual void setColumnAt(size_t x, float *reals, float *imags) = 0;
Chris@152 50
Chris@152 51 virtual void suspend() { }
Chris@152 52
Chris@408 53 enum StorageType {
Chris@408 54 Compact, // 16 bits normalized polar
Chris@408 55 Rectangular, // floating point real+imag
Chris@408 56 Polar // floating point mag+phase
Chris@408 57 };
Chris@408 58 virtual StorageType getStorageType() = 0;
Chris@408 59
Chris@359 60 enum Type { MemoryCache, FileCache };
Chris@359 61 virtual Type getType() = 0;
Chris@359 62
Chris@152 63 protected:
Chris@152 64 FFTCache() { }
Chris@152 65 };
Chris@152 66
Chris@152 67
Chris@152 68 #endif