Mercurial > hg > svgui
comparison layer/SpectrogramLayer.h @ 37:21d061e66177
* Make the frequency estimation mode in the spectrogram layer actually useful,
and make sure it gets mostly the right results... Still some tidying to do
in here.
author | Chris Cannam |
---|---|
date | Wed, 22 Feb 2006 17:45:18 +0000 |
parents | c28ebb4ba4de |
children | beb801473743 |
comparison
equal
deleted
inserted
replaced
36:c28ebb4ba4de | 37:21d061e66177 |
---|---|
37 public PowerOfSqrtTwoZoomConstraint | 37 public PowerOfSqrtTwoZoomConstraint |
38 { | 38 { |
39 Q_OBJECT | 39 Q_OBJECT |
40 | 40 |
41 public: | 41 public: |
42 enum Configuration { FullRangeDb, MelodicRange }; | 42 enum Configuration { FullRangeDb, MelodicRange, MelodicPeaks }; |
43 | 43 |
44 SpectrogramLayer(View *w, Configuration = FullRangeDb); | 44 SpectrogramLayer(View *w, Configuration = FullRangeDb); |
45 ~SpectrogramLayer(); | 45 ~SpectrogramLayer(); |
46 | 46 |
47 virtual const ZoomConstraint *getZoomConstraint() const { return this; } | 47 virtual const ZoomConstraint *getZoomConstraint() const { return this; } |
92 * The default is 1.0. | 92 * The default is 1.0. |
93 */ | 93 */ |
94 void setGain(float gain); | 94 void setGain(float gain); |
95 float getGain() const; | 95 float getGain() const; |
96 | 96 |
97 /** | |
98 * Set the threshold for sample values to be shown in the FFT, | |
99 * in voltage units. | |
100 * | |
101 * The default is 0.0. | |
102 */ | |
103 void setThreshold(float threshold); | |
104 float getThreshold() const; | |
105 | |
106 void setMinFrequency(size_t); | |
107 size_t getMinFrequency() const; | |
108 | |
97 void setMaxFrequency(size_t); // 0 -> no maximum | 109 void setMaxFrequency(size_t); // 0 -> no maximum |
98 size_t getMaxFrequency() const; | 110 size_t getMaxFrequency() const; |
99 | 111 |
100 enum ColourScale { LinearColourScale, MeterColourScale, dBColourScale, | 112 enum ColourScale { |
101 PhaseColourScale }; | 113 LinearColourScale, |
114 MeterColourScale, | |
115 dBColourScale, | |
116 PhaseColourScale | |
117 }; | |
102 | 118 |
103 /** | 119 /** |
104 * Specify the scale for sample levels. See WaveformLayer for | 120 * Specify the scale for sample levels. See WaveformLayer for |
105 * details of meter and dB scaling. The default is dBColourScale. | 121 * details of meter and dB scaling. The default is dBColourScale. |
106 */ | 122 */ |
116 * Specify the scale for the y axis. | 132 * Specify the scale for the y axis. |
117 */ | 133 */ |
118 void setFrequencyScale(FrequencyScale); | 134 void setFrequencyScale(FrequencyScale); |
119 FrequencyScale getFrequencyScale() const; | 135 FrequencyScale getFrequencyScale() const; |
120 | 136 |
121 enum FrequencyAdjustment { | 137 enum BinDisplay { |
122 RawFrequency, | 138 AllBins, |
123 PhaseAdjustedFrequency, | 139 PeakBins, |
124 PhaseAdjustedPeaks | 140 PeakFrequencies |
125 }; | 141 }; |
126 | 142 |
127 /** | 143 /** |
128 * Specify the processing of frequency bins for the y axis. | 144 * Specify the processing of frequency bins for the y axis. |
129 */ | 145 */ |
130 void setFrequencyAdjustment(FrequencyAdjustment); | 146 void setBinDisplay(BinDisplay); |
131 FrequencyAdjustment getFrequencyAdjustment() const; | 147 BinDisplay getBinDisplay() const; |
132 | 148 |
133 void setNormalizeColumns(bool n); | 149 void setNormalizeColumns(bool n); |
134 bool getNormalizeColumns() const; | 150 bool getNormalizeColumns() const; |
135 | 151 |
136 enum ColourScheme { DefaultColours, WhiteOnBlack, BlackOnWhite, | 152 enum ColourScheme { DefaultColours, WhiteOnBlack, BlackOnWhite, |
172 int m_channel; | 188 int m_channel; |
173 size_t m_windowSize; | 189 size_t m_windowSize; |
174 WindowType m_windowType; | 190 WindowType m_windowType; |
175 size_t m_windowOverlap; | 191 size_t m_windowOverlap; |
176 float m_gain; | 192 float m_gain; |
193 float m_threshold; | |
177 int m_colourRotation; | 194 int m_colourRotation; |
195 size_t m_minFrequency; | |
178 size_t m_maxFrequency; | 196 size_t m_maxFrequency; |
179 ColourScale m_colourScale; | 197 ColourScale m_colourScale; |
180 ColourScheme m_colourScheme; | 198 ColourScheme m_colourScheme; |
181 FrequencyScale m_frequencyScale; | 199 FrequencyScale m_frequencyScale; |
182 FrequencyAdjustment m_frequencyAdjustment; | 200 BinDisplay m_binDisplay; |
183 bool m_normalizeColumns; | 201 bool m_normalizeColumns; |
184 | 202 |
203 enum { NO_VALUE = 0 }; | |
204 | |
185 // A QImage would do just as well here, and we originally used | 205 // A QImage would do just as well here, and we originally used |
186 // one: the problem is that we want to munlock() the memory it | 206 // one: the problem is that we want to munlock() the memory it |
187 // uses, and it's much easier to do that if we control it. This | 207 // uses, and it's much easier to do that if we control it. This |
188 // cache is hardwired to an effective 8-bit colour mapped layout. | 208 // cache is hardwired to an effective 8-bit colour mapped layout. |
189 class Cache { | 209 class Cache { |