Chris@152: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@152: Chris@152: /* Chris@152: Sonic Visualiser Chris@152: An audio file viewer and annotation editor. Chris@152: Centre for Digital Music, Queen Mary, University of London. Chris@152: This file copyright 2006 Chris Cannam. Chris@152: Chris@152: This program is free software; you can redistribute it and/or Chris@152: modify it under the terms of the GNU General Public License as Chris@152: published by the Free Software Foundation; either version 2 of the Chris@152: License, or (at your option) any later version. See the file Chris@152: COPYING included with this distribution for more information. Chris@152: */ Chris@152: Chris@152: #ifndef _FFT_CACHE_H_ Chris@152: #define _FFT_CACHE_H_ Chris@152: Chris@152: #include Chris@152: #include Chris@152: Chris@152: #include Chris@152: Chris@152: class FFTCache Chris@152: { Chris@152: public: Chris@152: virtual ~FFTCache() { } Chris@152: Chris@152: virtual size_t getWidth() const = 0; Chris@152: virtual size_t getHeight() const = 0; Chris@152: Chris@152: virtual void resize(size_t width, size_t height) = 0; Chris@152: virtual void reset() = 0; // zero-fill or 1-fill as appropriate without changing size Chris@152: Chris@152: virtual float getMagnitudeAt(size_t x, size_t y) const = 0; Chris@152: virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const = 0; Chris@152: virtual float getMaximumMagnitudeAt(size_t x) const = 0; Chris@152: virtual float getPhaseAt(size_t x, size_t y) const = 0; Chris@152: Chris@152: virtual void getValuesAt(size_t x, size_t y, float &real, float &imaginary) const = 0; Chris@152: Chris@152: virtual bool haveSetColumnAt(size_t x) const = 0; Chris@152: Chris@152: // may modify argument arrays Chris@152: virtual void setColumnAt(size_t x, float *mags, float *phases, float factor) = 0; Chris@152: Chris@152: // may modify argument arrays Chris@152: virtual void setColumnAt(size_t x, float *reals, float *imags) = 0; Chris@152: Chris@152: virtual void suspend() { } Chris@152: Chris@335: enum Type { MemoryCache, FileCache }; Chris@335: virtual Type getType() = 0; Chris@335: Chris@152: protected: Chris@152: FFTCache() { } Chris@152: }; Chris@152: Chris@152: Chris@152: #endif