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