svcore  1.9
Dense3DModelPeakCache.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 2009 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 _DENSE_3D_MODEL_PEAK_CACHE_H_
17 #define _DENSE_3D_MODEL_PEAK_CACHE_H_
18 
21 #include "base/ResizeableBitset.h"
22 
24 {
25  Q_OBJECT
26 
27 public:
29  int columnsPerPeak);
31 
32  virtual bool isOK() const {
33  return m_source && m_source->isOK();
34  }
35 
36  virtual int getSampleRate() const {
37  return m_source->getSampleRate();
38  }
39 
40  virtual int getStartFrame() const {
41  return m_source->getStartFrame();
42  }
43 
44  virtual int getEndFrame() const {
45  return m_source->getEndFrame();
46  }
47 
48  virtual Model *clone() const {
50  }
51 
52  virtual int getResolution() const {
54  }
55 
56  virtual int getWidth() const {
57  return m_source->getWidth() / m_resolution + 1;
58  }
59 
60  virtual int getHeight() const {
61  return m_source->getHeight();
62  }
63 
64  virtual float getMinimumLevel() const {
65  return m_source->getMinimumLevel();
66  }
67 
68  virtual float getMaximumLevel() const {
69  return m_source->getMaximumLevel();
70  }
71 
72  virtual bool isColumnAvailable(int column) const;
73 
74  virtual Column getColumn(int column) const;
75 
76  virtual float getValueAt(int column, int n) const;
77 
78  virtual QString getBinName(int n) const {
79  return m_source->getBinName(n);
80  }
81 
82  virtual bool shouldUseLogValueScale() const {
84  }
85 
86  QString getTypeName() const { return tr("Dense 3-D Peak Cache"); }
87 
88  virtual int getCompletion() const {
89  return m_source->getCompletion();
90  }
91 
92 protected slots:
93  void sourceModelChanged();
95 
96 private:
101 
102  bool haveColumn(int column) const;
103  void fillColumn(int column) const;
104 };
105 
106 
107 #endif
virtual int getWidth() const =0
Return the number of columns of bins in the model.
virtual int getCompletion() const =0
virtual int getHeight() const
Return the number of bins in each column.
virtual int getCompletion() const
virtual float getValueAt(int column, int n) const
Get the single data point from the n'th bin of the given column.
virtual bool shouldUseLogValueScale() const =0
Estimate whether a logarithmic scale might be appropriate for the value scale.
DenseThreeDimensionalModel * m_source
virtual int getStartFrame() const =0
Return the first audio frame spanned by the model.
virtual bool shouldUseLogValueScale() const
Estimate whether a logarithmic scale might be appropriate for the value scale.
virtual float getMinimumLevel() const =0
Return the minimum permissible value in each bin.
virtual int getEndFrame() const
Return the last audio frame spanned by the model.
EditableDenseThreeDimensionalModel * m_cache
virtual QString getBinName(int n) const
Get the name of a given bin (i.e.
virtual int getSampleRate() const
Return the frame rate in frames per second.
virtual int getWidth() const
Return the number of columns of bins in the model.
virtual bool isOK() const
Return true if the model was constructed successfully.
virtual float getMinimumLevel() const
Return the minimum permissible value in each bin.
virtual int getResolution() const =0
Return the number of sample frames covered by each column of bins.
virtual bool isOK() const =0
Return true if the model was constructed successfully.
bool haveColumn(int column) const
virtual Model * clone() const
Return a copy of this model.
virtual int getStartFrame() const
Return the first audio frame spanned by the model.
QString getTypeName() const
Return the type of the model.
virtual int getSampleRate() const =0
Return the frame rate in frames per second.
virtual bool isColumnAvailable(int column) const
Return true if there are data available for the given column.
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
virtual QString getBinName(int n) const =0
Get the name of a given bin (i.e.
virtual int getEndFrame() const =0
Return the last audio frame spanned by the model.
virtual int getResolution() const
Return the number of sample frames covered by each column of bins.
virtual float getMaximumLevel() const
Return the maximum permissible value in each bin.
Dense3DModelPeakCache(DenseThreeDimensionalModel *source, int columnsPerPeak)
virtual float getMaximumLevel() const =0
Return the maximum permissible value in each bin.
virtual int getHeight() const =0
Return the number of bins in each column.
virtual Column getColumn(int column) const
Get data from the given column of bin values.
void fillColumn(int column) const