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