comparison data/model/EditableDenseThreeDimensionalModel.h @ 152:21792a550ec9 last-cc-copyright

* Move the current DenseThreeDimensionalModel to EditableDenseThreeDimensionalModel (wow!), and make DTDM an abstract base * Move FFTFuzzyAdapter to FFTModel as a new subclass of DTDM
author Chris Cannam
date Mon, 31 Jul 2006 17:05:18 +0000
parents
children f75f8a1cd7b1
comparison
equal deleted inserted replaced
151:3c1d5ef43baa 152:21792a550ec9
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 _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_
17 #define _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_
18
19 #include "DenseThreeDimensionalModel.h"
20
21 class EditableDenseThreeDimensionalModel : public DenseThreeDimensionalModel
22 {
23 Q_OBJECT
24
25 public:
26 EditableDenseThreeDimensionalModel(size_t sampleRate,
27 size_t resolution,
28 size_t yBinCount,
29 bool notifyOnAdd = true);
30
31 virtual bool isOK() const;
32
33 virtual size_t getSampleRate() const;
34 virtual size_t getStartFrame() const;
35 virtual size_t getEndFrame() const;
36
37 virtual Model *clone() const;
38
39
40 /**
41 * Return the number of sample frames covered by each set of bins.
42 */
43 virtual size_t getResolution() const;
44
45 /**
46 * Set the number of sample frames covered by each set of bins.
47 */
48 virtual void setResolution(size_t sz);
49
50 /**
51 * Return the number of bins in each set of bins.
52 */
53 virtual size_t getYBinCount() const;
54
55 /**
56 * Set the number of bins in each set of bins.
57 */
58 virtual void setYBinCount(size_t sz);
59
60 /**
61 * Return the minimum value of the value in each bin.
62 */
63 virtual float getMinimumLevel() const;
64
65 /**
66 * Set the minimum value of the value in a bin.
67 */
68 virtual void setMinimumLevel(float sz);
69
70 /**
71 * Return the maximum value of the value in each bin.
72 */
73 virtual float getMaximumLevel() const;
74
75 /**
76 * Set the maximum value of the value in a bin.
77 */
78 virtual void setMaximumLevel(float sz);
79
80 typedef std::vector<float> BinValueSet;
81
82 /**
83 * Get the set of bin values at the given sample frame (i.e. the
84 * windowStartFrame/getResolution()'th set of bins).
85 */
86 virtual void getBinValues(long windowStartFrame, BinValueSet &result) const;
87
88 /**
89 * Get a single value, the one at the n'th bin of the set of bins
90 * starting at the given sample frame.
91 */
92 virtual float getBinValue(long windowStartFrame, size_t n) const;
93
94 /**
95 * Set the entire set of bin values at the given sample frame.
96 */
97 virtual void setBinValues(long windowStartFrame, const BinValueSet &values);
98
99 virtual QString getBinName(size_t n) const;
100 virtual void setBinName(size_t n, QString);
101 virtual void setBinNames(std::vector<QString> names);
102
103 virtual void setCompletion(int completion);
104 virtual int getCompletion() const { return m_completion; }
105
106 virtual void toXml(QTextStream &out,
107 QString indent = "",
108 QString extraAttributes = "") const;
109
110 virtual QString toXmlString(QString indent = "",
111 QString extraAttributes = "") const;
112
113 protected:
114 typedef std::vector<BinValueSet> ValueMatrix;
115 ValueMatrix m_data;
116
117 std::vector<QString> m_binNames;
118
119 size_t m_sampleRate;
120 size_t m_resolution;
121 size_t m_yBinCount;
122 float m_minimum;
123 float m_maximum;
124 bool m_notifyOnAdd;
125 long m_sinceLastNotifyMin;
126 long m_sinceLastNotifyMax;
127 int m_completion;
128
129 mutable QMutex m_mutex;
130 };
131
132 #endif