annotate data/model/EditableDenseThreeDimensionalModel.h @ 155:ae9be6b6b522

* Add Thumbwheel widget for all our zooming needs * Use QSettings to save/restore window size and position -- precursor to switching our preferences to QSettings as well -- wish I'd noticed it sooner * Only suspend writes (not reads from the underlying cache objects) from the fft caches when repainting the spectrogram -- performance should now be significantly better
author Chris Cannam
date Thu, 03 Aug 2006 15:40:11 +0000
parents 21792a550ec9
children f75f8a1cd7b1
rev   line source
Chris@152 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@152 2
Chris@152 3 /*
Chris@152 4 Sonic Visualiser
Chris@152 5 An audio file viewer and annotation editor.
Chris@152 6 Centre for Digital Music, Queen Mary, University of London.
Chris@152 7 This file copyright 2006 Chris Cannam.
Chris@152 8
Chris@152 9 This program is free software; you can redistribute it and/or
Chris@152 10 modify it under the terms of the GNU General Public License as
Chris@152 11 published by the Free Software Foundation; either version 2 of the
Chris@152 12 License, or (at your option) any later version. See the file
Chris@152 13 COPYING included with this distribution for more information.
Chris@152 14 */
Chris@152 15
Chris@152 16 #ifndef _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_
Chris@152 17 #define _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_
Chris@152 18
Chris@152 19 #include "DenseThreeDimensionalModel.h"
Chris@152 20
Chris@152 21 class EditableDenseThreeDimensionalModel : public DenseThreeDimensionalModel
Chris@152 22 {
Chris@152 23 Q_OBJECT
Chris@152 24
Chris@152 25 public:
Chris@152 26 EditableDenseThreeDimensionalModel(size_t sampleRate,
Chris@152 27 size_t resolution,
Chris@152 28 size_t yBinCount,
Chris@152 29 bool notifyOnAdd = true);
Chris@152 30
Chris@152 31 virtual bool isOK() const;
Chris@152 32
Chris@152 33 virtual size_t getSampleRate() const;
Chris@152 34 virtual size_t getStartFrame() const;
Chris@152 35 virtual size_t getEndFrame() const;
Chris@152 36
Chris@152 37 virtual Model *clone() const;
Chris@152 38
Chris@152 39
Chris@152 40 /**
Chris@152 41 * Return the number of sample frames covered by each set of bins.
Chris@152 42 */
Chris@152 43 virtual size_t getResolution() const;
Chris@152 44
Chris@152 45 /**
Chris@152 46 * Set the number of sample frames covered by each set of bins.
Chris@152 47 */
Chris@152 48 virtual void setResolution(size_t sz);
Chris@152 49
Chris@152 50 /**
Chris@152 51 * Return the number of bins in each set of bins.
Chris@152 52 */
Chris@152 53 virtual size_t getYBinCount() const;
Chris@152 54
Chris@152 55 /**
Chris@152 56 * Set the number of bins in each set of bins.
Chris@152 57 */
Chris@152 58 virtual void setYBinCount(size_t sz);
Chris@152 59
Chris@152 60 /**
Chris@152 61 * Return the minimum value of the value in each bin.
Chris@152 62 */
Chris@152 63 virtual float getMinimumLevel() const;
Chris@152 64
Chris@152 65 /**
Chris@152 66 * Set the minimum value of the value in a bin.
Chris@152 67 */
Chris@152 68 virtual void setMinimumLevel(float sz);
Chris@152 69
Chris@152 70 /**
Chris@152 71 * Return the maximum value of the value in each bin.
Chris@152 72 */
Chris@152 73 virtual float getMaximumLevel() const;
Chris@152 74
Chris@152 75 /**
Chris@152 76 * Set the maximum value of the value in a bin.
Chris@152 77 */
Chris@152 78 virtual void setMaximumLevel(float sz);
Chris@152 79
Chris@152 80 typedef std::vector<float> BinValueSet;
Chris@152 81
Chris@152 82 /**
Chris@152 83 * Get the set of bin values at the given sample frame (i.e. the
Chris@152 84 * windowStartFrame/getResolution()'th set of bins).
Chris@152 85 */
Chris@152 86 virtual void getBinValues(long windowStartFrame, BinValueSet &result) const;
Chris@152 87
Chris@152 88 /**
Chris@152 89 * Get a single value, the one at the n'th bin of the set of bins
Chris@152 90 * starting at the given sample frame.
Chris@152 91 */
Chris@152 92 virtual float getBinValue(long windowStartFrame, size_t n) const;
Chris@152 93
Chris@152 94 /**
Chris@152 95 * Set the entire set of bin values at the given sample frame.
Chris@152 96 */
Chris@152 97 virtual void setBinValues(long windowStartFrame, const BinValueSet &values);
Chris@152 98
Chris@152 99 virtual QString getBinName(size_t n) const;
Chris@152 100 virtual void setBinName(size_t n, QString);
Chris@152 101 virtual void setBinNames(std::vector<QString> names);
Chris@152 102
Chris@152 103 virtual void setCompletion(int completion);
Chris@152 104 virtual int getCompletion() const { return m_completion; }
Chris@152 105
Chris@152 106 virtual void toXml(QTextStream &out,
Chris@152 107 QString indent = "",
Chris@152 108 QString extraAttributes = "") const;
Chris@152 109
Chris@152 110 virtual QString toXmlString(QString indent = "",
Chris@152 111 QString extraAttributes = "") const;
Chris@152 112
Chris@152 113 protected:
Chris@152 114 typedef std::vector<BinValueSet> ValueMatrix;
Chris@152 115 ValueMatrix m_data;
Chris@152 116
Chris@152 117 std::vector<QString> m_binNames;
Chris@152 118
Chris@152 119 size_t m_sampleRate;
Chris@152 120 size_t m_resolution;
Chris@152 121 size_t m_yBinCount;
Chris@152 122 float m_minimum;
Chris@152 123 float m_maximum;
Chris@152 124 bool m_notifyOnAdd;
Chris@152 125 long m_sinceLastNotifyMin;
Chris@152 126 long m_sinceLastNotifyMax;
Chris@152 127 int m_completion;
Chris@152 128
Chris@152 129 mutable QMutex m_mutex;
Chris@152 130 };
Chris@152 131
Chris@152 132 #endif