comparison data/model/RangeSummarisableTimeValueModel.h @ 319:3ff8f571da09

* Hoist alignment model set/query up to Model, so any models can be aligned * Add Model::aboutToDelete and aboutToBeDeleted for management of models that are contained by or referred to by other models instead of only the document
author Chris Cannam
date Wed, 24 Oct 2007 15:21:38 +0000
parents 5877d68815c7
children 700cd3350391 6f6ab834449d
comparison
equal deleted inserted replaced
318:7a4bd2c8585c 319:3ff8f571da09
19 #include <QObject> 19 #include <QObject>
20 20
21 #include "DenseTimeValueModel.h" 21 #include "DenseTimeValueModel.h"
22 #include "base/ZoomConstraint.h" 22 #include "base/ZoomConstraint.h"
23 23
24 class AlignmentModel;
25
26 /** 24 /**
27 * Base class for models containing dense two-dimensional data (value 25 * Base class for models containing dense two-dimensional data (value
28 * against time) that may be meaningfully represented in a zoomed view 26 * against time) that may be meaningfully represented in a zoomed view
29 * using min/max range summaries. Audio waveform data is an obvious 27 * using min/max range summaries. Audio waveform data is an obvious
30 * example: think "peaks and minima" for "ranges". 28 * example: think "peaks and minima" for "ranges".
33 class RangeSummarisableTimeValueModel : public DenseTimeValueModel 31 class RangeSummarisableTimeValueModel : public DenseTimeValueModel
34 { 32 {
35 Q_OBJECT 33 Q_OBJECT
36 34
37 public: 35 public:
38 RangeSummarisableTimeValueModel() : m_alignment(0) { } 36 RangeSummarisableTimeValueModel() { }
39 37
40 struct Range 38 struct Range
41 { 39 {
42 float min; 40 float min;
43 float max; 41 float max;
71 * Return the range from the given start frame, corresponding to 69 * Return the range from the given start frame, corresponding to
72 * the given number of underlying sample frames, summarised at a 70 * the given number of underlying sample frames, summarised at a
73 * block size equal to the distance between start and end frames. 71 * block size equal to the distance between start and end frames.
74 */ 72 */
75 virtual Range getSummary(size_t channel, size_t start, size_t count) const = 0; 73 virtual Range getSummary(size_t channel, size_t start, size_t count) const = 0;
76
77 virtual void setAlignment(AlignmentModel *alignment); // I take ownership
78 virtual const Model *getAlignmentReference() const;
79 virtual size_t alignToReference(size_t frame) const;
80 virtual size_t alignFromReference(size_t referenceFrame) const;
81 virtual int getAlignmentCompletion() const;
82
83 signals:
84 void alignmentCompletionChanged();
85
86 protected:
87 AlignmentModel *m_alignment;
88 }; 74 };
89 75
90 #endif 76 #endif
91 77