svcore  1.9
AggregateWaveModel.h
Go to the documentation of this file.
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 2007 QMUL.
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 _AGGREGATE_WAVE_MODEL_H_
17 #define _AGGREGATE_WAVE_MODEL_H_
18 
21 
22 #include <vector>
23 
25 {
26  Q_OBJECT
27 
28 public:
30  {
32  model(m), channel(c) { }
34  int channel;
35  };
36 
37  typedef std::vector<ModelChannelSpec> ChannelSpecList;
38 
39  AggregateWaveModel(ChannelSpecList channelSpecs);
41 
42  bool isOK() const;
43  bool isReady(int *) const;
44 
45  QString getTypeName() const { return tr("Aggregate Wave"); }
46 
47  int getComponentCount() const;
48  ModelChannelSpec getComponent(int c) const;
49 
51 
52  int getFrameCount() const;
53  int getChannelCount() const;
54  int getSampleRate() const;
55 
56  virtual Model *clone() const;
57 
58  float getValueMinimum() const { return -1.0f; }
59  float getValueMaximum() const { return 1.0f; }
60 
61  virtual int getStartFrame() const { return 0; }
62  virtual int getEndFrame() const { return getFrameCount(); }
63 
64  virtual int getData(int channel, int start, int count,
65  float *buffer) const;
66 
67  virtual int getData(int channel, int start, int count,
68  double *buffer) const;
69 
70  virtual int getData(int fromchannel, int tochannel,
71  int start, int count,
72  float **buffer) const;
73 
74  virtual int getSummaryBlockSize(int desired) const;
75 
76  virtual void getSummaries(int channel, int start, int count,
77  RangeBlock &ranges,
78  int &blockSize) const;
79 
80  virtual Range getSummary(int channel, int start, int count) const;
81 
82  virtual void toXml(QTextStream &out,
83  QString indent = "",
84  QString extraAttributes = "") const;
85 
86 signals:
87  void modelChanged();
88  void modelChangedWithin(int, int);
89  void completionChanged();
90 
91 protected slots:
92  void componentModelChanged();
93  void componentModelChangedWithin(int, int);
95 
96 protected:
99 };
100 
101 #endif
102 
virtual Model * clone() const
Return a copy of this model.
QString getTypeName() const
Return the type of the model.
void componentModelChangedWithin(int, int)
int getSampleRate() const
Return the frame rate in frames per second.
static PowerOfSqrtTwoZoomConstraint m_zoomConstraint
RangeSummarisableTimeValueModel * model
const ZoomConstraint * getZoomConstraint() const
If this model imposes a zoom constraint, i.e.
AggregateWaveModel(ChannelSpecList channelSpecs)
bool isOK() const
Return true if the model was constructed successfully.
int getChannelCount() const
Return the number of distinct channels for this model.
ModelChannelSpec getComponent(int c) const
virtual int getStartFrame() const
Return the first audio frame spanned by the model.
ChannelSpecList m_components
float getValueMinimum() const
Return the minimum possible value found in this model type.
virtual Range getSummary(int channel, int start, int count) const
Return the range from the given start frame, corresponding to the given number of underlying sample f...
virtual void getSummaries(int channel, int start, int count, RangeBlock &ranges, int &blockSize) const
Return ranges from the given start frame, corresponding to the given number of underlying sample fram...
float getValueMaximum() const
Return the minimum possible value found in this model type.
Model is the base class for all data models that represent any sort of data on a time scale based on ...
Definition: Model.h:35
std::vector< ModelChannelSpec > ChannelSpecList
virtual int getSummaryBlockSize(int desired) const
bool isReady(int *) const
Return true if the model has finished loading or calculating all its data, for a model that is capabl...
Base class for models containing dense two-dimensional data (value against time) that may be meaningf...
void modelChangedWithin(int, int)
ZoomConstraint is a simple interface that describes a limitation on the available zoom sizes for a vi...
ModelChannelSpec(RangeSummarisableTimeValueModel *m, int c)
virtual void toXml(QTextStream &out, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
virtual int getData(int channel, int start, int count, float *buffer) const
Get the specified set of samples from the given channel of the model in single-precision floating-poi...
virtual int getEndFrame() const
Return the last audio frame spanned by the model.