svcore  1.9
RangeSummarisableTimeValueModel.h
Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006-2007 Chris Cannam and QMUL.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #ifndef _RANGE_SUMMARISABLE_TIME_VALUE_MODEL_H_
00017 #define _RANGE_SUMMARISABLE_TIME_VALUE_MODEL_H_
00018 
00019 #include <QObject>
00020 
00021 #include "DenseTimeValueModel.h"
00022 #include "base/ZoomConstraint.h"
00023 
00024 #include <stdint.h>
00025 
00033 class RangeSummarisableTimeValueModel : public DenseTimeValueModel
00034 {
00035     Q_OBJECT
00036 
00037 public:
00038     RangeSummarisableTimeValueModel() { }
00039 
00040     class Range
00041     {
00042     public:
00043         Range() : 
00044             m_min(0.f), m_max(0.f), m_absmean(0.f) { }
00045         Range(const Range &r) : 
00046             m_min(r.m_min), m_max(r.m_max), m_absmean(r.m_absmean) { }
00047         Range(float min, float max, float absmean) :
00048             m_min(min), m_max(max), m_absmean(absmean) { }
00049 
00050         float min() const { return m_min; }
00051         float max() const { return m_max; }
00052         float absmean() const { return m_absmean; }
00053 
00054         void setMin(float min) { m_min = min; }
00055         void setMax(float max) { m_max = max; }
00056         void setAbsmean(float absmean) { m_absmean = absmean; }
00057 
00058     private:
00059         float m_min;
00060         float m_max;
00061         float m_absmean;
00062     };
00063 
00064     typedef std::vector<Range> RangeBlock;
00065 
00077     virtual void getSummaries(int channel, int start, int count,
00078                               RangeBlock &ranges,
00079                               int &blockSize) const = 0;
00080 
00086     virtual Range getSummary(int channel, int start, int count) const = 0;
00087 
00088     virtual int getSummaryBlockSize(int desired) const = 0;
00089 
00090     QString getTypeName() const { return tr("Range-Summarisable Time-Value"); }
00091 };
00092 
00093 #endif
00094