Chris@88: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@88: Chris@88: /* Chris@88: Sonic Visualiser Chris@88: An audio file viewer and annotation editor. Chris@88: Centre for Digital Music, Queen Mary, University of London. Chris@88: This file copyright 2006 Chris Cannam. Chris@88: Chris@88: This program is free software; you can redistribute it and/or Chris@88: modify it under the terms of the GNU General Public License as Chris@88: published by the Free Software Foundation; either version 2 of the Chris@88: License, or (at your option) any later version. See the file Chris@88: COPYING included with this distribution for more information. Chris@88: */ Chris@88: Chris@88: #ifndef _FFT_FILE_CACHE_H_ Chris@88: #define _FFT_FILE_CACHE_H_ Chris@88: Chris@88: #include "FFTCache.h" Chris@88: Chris@88: class MatrixFileCache; Chris@88: Chris@88: class FFTFileCache : public FFTCacheBase Chris@88: { Chris@88: public: Chris@88: //!!! Chris@88: // Initially, make this take a string for the filename, Chris@88: // and make the spectrogram layer have two, one for the main Chris@88: // thread and one for the fill thread, one RO and one RW, both Chris@88: // using the same string based off spectrogram layer address Chris@88: // or export ID. Chris@88: // Subsequently factor out into reader and writer classes? Chris@88: // Make take arguments to ctor describing FFT parameters and Chris@88: // calculate its own string and eventually do its own FFT as Chris@88: // well. Intention is to make it able ultimately to write Chris@88: // its own cache so it can do it in the background while e.g. Chris@88: // plugins read from it -- need the reader thread to be able Chris@88: // to block waiting for the writer thread as appropriate. Chris@88: Chris@88: FFTFileCache(); Chris@88: virtual ~FFTFileCache(); Chris@88: Chris@88: virtual size_t getWidth() const; Chris@88: virtual size_t getHeight() const; Chris@88: Chris@88: virtual void resize(size_t width, size_t height); Chris@88: virtual void reset(); // zero-fill or 1-fill as appropriate without changing size Chris@88: Chris@88: virtual float getMagnitudeAt(size_t x, size_t y) const; Chris@88: virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const; Chris@88: virtual float getPhaseAt(size_t x, size_t y) const; Chris@88: Chris@88: virtual bool isLocalPeak(size_t x, size_t y) const; Chris@88: virtual bool isOverThreshold(size_t x, size_t y, float threshold) const; Chris@88: Chris@88: virtual void setNormalizationFactor(size_t x, float factor); Chris@88: virtual void setMagnitudeAt(size_t x, size_t y, float mag); Chris@88: virtual void setNormalizedMagnitudeAt(size_t x, size_t y, float norm); Chris@88: virtual void setPhaseAt(size_t x, size_t y, float phase); Chris@88: Chris@88: virtual QColor getColour(unsigned char index) const; Chris@88: virtual void setColour(unsigned char index, QColor colour); Chris@88: Chris@88: protected: Chris@88: size_t m_height; Chris@88: MatrixFileCache *m_mfc; Chris@88: }; Chris@88: Chris@88: #endif