00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _AGGREGATE_WAVE_MODEL_H_
00017 #define _AGGREGATE_WAVE_MODEL_H_
00018
00019 #include "RangeSummarisableTimeValueModel.h"
00020 #include "PowerOfSqrtTwoZoomConstraint.h"
00021
00022 #include <vector>
00023
00024 class AggregateWaveModel : public RangeSummarisableTimeValueModel
00025 {
00026 Q_OBJECT
00027
00028 public:
00029 struct ModelChannelSpec
00030 {
00031 ModelChannelSpec(RangeSummarisableTimeValueModel *m, int c) :
00032 model(m), channel(c) { }
00033 RangeSummarisableTimeValueModel *model;
00034 int channel;
00035 };
00036
00037 typedef std::vector<ModelChannelSpec> ChannelSpecList;
00038
00039 AggregateWaveModel(ChannelSpecList channelSpecs);
00040 ~AggregateWaveModel();
00041
00042 bool isOK() const;
00043 bool isReady(int *) const;
00044
00045 QString getTypeName() const { return tr("Aggregate Wave"); }
00046
00047 size_t getComponentCount() const;
00048 ModelChannelSpec getComponent(size_t c) const;
00049
00050 const ZoomConstraint *getZoomConstraint() const { return &m_zoomConstraint; }
00051
00052 size_t getFrameCount() const;
00053 size_t getChannelCount() const;
00054 size_t getSampleRate() const;
00055
00056 virtual Model *clone() const;
00057
00058 float getValueMinimum() const { return -1.0f; }
00059 float getValueMaximum() const { return 1.0f; }
00060
00061 virtual size_t getStartFrame() const { return 0; }
00062 virtual size_t getEndFrame() const { return getFrameCount(); }
00063
00064 virtual size_t getData(int channel, size_t start, size_t count,
00065 float *buffer) const;
00066
00067 virtual size_t getData(int channel, size_t start, size_t count,
00068 double *buffer) const;
00069
00070 virtual size_t getData(size_t fromchannel, size_t tochannel,
00071 size_t start, size_t count,
00072 float **buffer) const;
00073
00074 virtual size_t getSummaryBlockSize(size_t desired) const;
00075
00076 virtual void getSummaries(size_t channel, size_t start, size_t count,
00077 RangeBlock &ranges,
00078 size_t &blockSize) const;
00079
00080 virtual Range getSummary(size_t channel, size_t start, size_t count) const;
00081
00082 virtual void toXml(QTextStream &out,
00083 QString indent = "",
00084 QString extraAttributes = "") const;
00085
00086 signals:
00087 void modelChanged();
00088 void modelChanged(size_t, size_t);
00089 void completionChanged();
00090
00091 protected slots:
00092 void componentModelChanged();
00093 void componentModelChanged(size_t, size_t);
00094 void componentModelCompletionChanged();
00095
00096 protected:
00097 ChannelSpecList m_components;
00098 static PowerOfSqrtTwoZoomConstraint m_zoomConstraint;
00099 };
00100
00101 #endif
00102