comparison base/FFTFileCache.h @ 88:024d4a71f5bf

* Just skeleton bits of file-based FFT cache
author Chris Cannam
date Tue, 02 May 2006 19:44:14 +0000
parents
children c4e163f911dd
comparison
equal deleted inserted replaced
87:7de62a884810 88:024d4a71f5bf
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _FFT_FILE_CACHE_H_
17 #define _FFT_FILE_CACHE_H_
18
19 #include "FFTCache.h"
20
21 class MatrixFileCache;
22
23 class FFTFileCache : public FFTCacheBase
24 {
25 public:
26 //!!!
27 // Initially, make this take a string for the filename,
28 // and make the spectrogram layer have two, one for the main
29 // thread and one for the fill thread, one RO and one RW, both
30 // using the same string based off spectrogram layer address
31 // or export ID.
32 // Subsequently factor out into reader and writer classes?
33 // Make take arguments to ctor describing FFT parameters and
34 // calculate its own string and eventually do its own FFT as
35 // well. Intention is to make it able ultimately to write
36 // its own cache so it can do it in the background while e.g.
37 // plugins read from it -- need the reader thread to be able
38 // to block waiting for the writer thread as appropriate.
39
40 FFTFileCache();
41 virtual ~FFTFileCache();
42
43 virtual size_t getWidth() const;
44 virtual size_t getHeight() const;
45
46 virtual void resize(size_t width, size_t height);
47 virtual void reset(); // zero-fill or 1-fill as appropriate without changing size
48
49 virtual float getMagnitudeAt(size_t x, size_t y) const;
50 virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const;
51 virtual float getPhaseAt(size_t x, size_t y) const;
52
53 virtual bool isLocalPeak(size_t x, size_t y) const;
54 virtual bool isOverThreshold(size_t x, size_t y, float threshold) const;
55
56 virtual void setNormalizationFactor(size_t x, float factor);
57 virtual void setMagnitudeAt(size_t x, size_t y, float mag);
58 virtual void setNormalizedMagnitudeAt(size_t x, size_t y, float norm);
59 virtual void setPhaseAt(size_t x, size_t y, float phase);
60
61 virtual QColor getColour(unsigned char index) const;
62 virtual void setColour(unsigned char index, QColor colour);
63
64 protected:
65 size_t m_height;
66 MatrixFileCache *m_mfc;
67 };
68
69 #endif