svcore  1.9
RangeSummarisableTimeValueModel.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 2006-2007 Chris Cannam and 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 _RANGE_SUMMARISABLE_TIME_VALUE_MODEL_H_
17 #define _RANGE_SUMMARISABLE_TIME_VALUE_MODEL_H_
18 
19 #include <QObject>
20 
21 #include "DenseTimeValueModel.h"
22 #include "base/ZoomConstraint.h"
23 
24 #include <stdint.h>
25 
34 {
35  Q_OBJECT
36 
37 public:
39 
40  class Range
41  {
42  public:
43  Range() :
44  m_min(0.f), m_max(0.f), m_absmean(0.f) { }
45  Range(const Range &r) :
46  m_min(r.m_min), m_max(r.m_max), m_absmean(r.m_absmean) { }
47  Range(float min, float max, float absmean) :
49 
50  float min() const { return m_min; }
51  float max() const { return m_max; }
52  float absmean() const { return m_absmean; }
53 
54  void setMin(float min) { m_min = min; }
55  void setMax(float max) { m_max = max; }
56  void setAbsmean(float absmean) { m_absmean = absmean; }
57 
58  private:
59  float m_min;
60  float m_max;
61  float m_absmean;
62  };
63 
64  typedef std::vector<Range> RangeBlock;
65 
77  virtual void getSummaries(int channel, int start, int count,
78  RangeBlock &ranges,
79  int &blockSize) const = 0;
80 
86  virtual Range getSummary(int channel, int start, int count) const = 0;
87 
88  virtual int getSummaryBlockSize(int desired) const = 0;
89 
90  QString getTypeName() const { return tr("Range-Summarisable Time-Value"); }
91 };
92 
93 #endif
94 
virtual int getSummaryBlockSize(int desired) const =0
Range(float min, float max, float absmean)
QString getTypeName() const
Return the type of the model.
virtual void getSummaries(int channel, int start, int count, RangeBlock &ranges, int &blockSize) const =0
Return ranges from the given start frame, corresponding to the given number of underlying sample fram...
Base class for models containing dense two-dimensional data (value against time).
virtual Range getSummary(int channel, int start, int count) const =0
Return the range from the given start frame, corresponding to the given number of underlying sample f...
Base class for models containing dense two-dimensional data (value against time) that may be meaningf...