comparison layer/SpectrogramLayer.h @ 193:57c2350a8c40

* Add slice layers (so you can display a slice of a colour 3d plot as if it were a spectrum) * Make spectrum layer a subclass of slice layer
author Chris Cannam
date Fri, 26 Jan 2007 16:59:57 +0000
parents e7cf6044c2a0
children 22c99c8aa1e0
comparison
equal deleted inserted replaced
192:fcc043f75c41 193:57c2350a8c40
14 */ 14 */
15 15
16 #ifndef _SPECTROGRAM_LAYER_H_ 16 #ifndef _SPECTROGRAM_LAYER_H_
17 #define _SPECTROGRAM_LAYER_H_ 17 #define _SPECTROGRAM_LAYER_H_
18 18
19 #include "Layer.h" 19 #include "SliceableLayer.h"
20 #include "base/Window.h" 20 #include "base/Window.h"
21 #include "base/RealTime.h" 21 #include "base/RealTime.h"
22 #include "base/Thread.h" 22 #include "base/Thread.h"
23 #include "base/PropertyContainer.h" 23 #include "base/PropertyContainer.h"
24 #include "data/model/PowerOfSqrtTwoZoomConstraint.h" 24 #include "data/model/PowerOfSqrtTwoZoomConstraint.h"
41 /** 41 /**
42 * SpectrogramLayer represents waveform data (obtained from a 42 * SpectrogramLayer represents waveform data (obtained from a
43 * DenseTimeValueModel) in spectrogram form. 43 * DenseTimeValueModel) in spectrogram form.
44 */ 44 */
45 45
46 class SpectrogramLayer : public Layer, 46 class SpectrogramLayer : public SliceableLayer,
47 public PowerOfSqrtTwoZoomConstraint 47 public PowerOfSqrtTwoZoomConstraint
48 { 48 {
49 Q_OBJECT 49 Q_OBJECT
50 50
51 public: 51 public:
212 212
213 virtual int getVerticalZoomSteps(int &defaultStep) const; 213 virtual int getVerticalZoomSteps(int &defaultStep) const;
214 virtual int getCurrentVerticalZoomStep() const; 214 virtual int getCurrentVerticalZoomStep() const;
215 virtual void setVerticalZoomStep(int); 215 virtual void setVerticalZoomStep(int);
216 virtual RangeMapper *getNewVerticalZoomRangeMapper() const; 216 virtual RangeMapper *getNewVerticalZoomRangeMapper() const;
217
218 virtual const Model *getSliceableModel() const;
217 219
218 protected slots: 220 protected slots:
219 void cacheInvalid(); 221 void cacheInvalid();
220 void cacheInvalid(size_t startFrame, size_t endFrame); 222 void cacheInvalid(size_t startFrame, size_t endFrame);
221 223
335 337
336 typedef std::pair<FFTModel *, int> FFTFillPair; // model, last fill 338 typedef std::pair<FFTModel *, int> FFTFillPair; // model, last fill
337 typedef std::map<const View *, FFTFillPair> ViewFFTMap; 339 typedef std::map<const View *, FFTFillPair> ViewFFTMap;
338 typedef std::vector<float> FloatVector; 340 typedef std::vector<float> FloatVector;
339 mutable ViewFFTMap m_fftModels; 341 mutable ViewFFTMap m_fftModels;
342 mutable Model *m_sliceableModel;
340 343
341 class MagnitudeRange { 344 class MagnitudeRange {
342 public: 345 public:
343 MagnitudeRange() : m_min(0), m_max(0) { } 346 MagnitudeRange() : m_min(0), m_max(0) { }
344 bool operator==(const MagnitudeRange &r) { 347 bool operator==(const MagnitudeRange &r) {