Chris@152: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@152: Chris@152: /* Chris@152: Sonic Visualiser Chris@152: An audio file viewer and annotation editor. Chris@152: Centre for Digital Music, Queen Mary, University of London. Chris@152: This file copyright 2006 Chris Cannam. Chris@152: Chris@152: This program is free software; you can redistribute it and/or Chris@152: modify it under the terms of the GNU General Public License as Chris@152: published by the Free Software Foundation; either version 2 of the Chris@152: License, or (at your option) any later version. See the file Chris@152: COPYING included with this distribution for more information. Chris@152: */ Chris@152: Chris@152: #ifndef _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_ Chris@152: #define _EDITABLE_DENSE_THREE_DIMENSIONAL_MODEL_H_ Chris@152: Chris@152: #include "DenseThreeDimensionalModel.h" Chris@152: Chris@152: class EditableDenseThreeDimensionalModel : public DenseThreeDimensionalModel Chris@152: { Chris@152: Q_OBJECT Chris@152: Chris@152: public: Chris@152: EditableDenseThreeDimensionalModel(size_t sampleRate, Chris@152: size_t resolution, Chris@152: size_t yBinCount, Chris@152: bool notifyOnAdd = true); Chris@152: Chris@152: virtual bool isOK() const; Chris@152: Chris@152: virtual size_t getSampleRate() const; Chris@152: virtual size_t getStartFrame() const; Chris@152: virtual size_t getEndFrame() const; Chris@152: Chris@152: virtual Model *clone() const; Chris@152: Chris@152: Chris@152: /** Chris@152: * Return the number of sample frames covered by each set of bins. Chris@152: */ Chris@152: virtual size_t getResolution() const; Chris@152: Chris@152: /** Chris@152: * Set the number of sample frames covered by each set of bins. Chris@152: */ Chris@152: virtual void setResolution(size_t sz); Chris@152: Chris@152: /** Chris@152: * Return the number of bins in each set of bins. Chris@152: */ Chris@152: virtual size_t getYBinCount() const; Chris@152: Chris@152: /** Chris@152: * Set the number of bins in each set of bins. Chris@152: */ Chris@152: virtual void setYBinCount(size_t sz); Chris@152: Chris@152: /** Chris@152: * Return the minimum value of the value in each bin. Chris@152: */ Chris@152: virtual float getMinimumLevel() const; Chris@152: Chris@152: /** Chris@152: * Set the minimum value of the value in a bin. Chris@152: */ Chris@152: virtual void setMinimumLevel(float sz); Chris@152: Chris@152: /** Chris@152: * Return the maximum value of the value in each bin. Chris@152: */ Chris@152: virtual float getMaximumLevel() const; Chris@152: Chris@152: /** Chris@152: * Set the maximum value of the value in a bin. Chris@152: */ Chris@152: virtual void setMaximumLevel(float sz); Chris@152: Chris@152: typedef std::vector BinValueSet; Chris@152: Chris@152: /** Chris@152: * Get the set of bin values at the given sample frame (i.e. the Chris@152: * windowStartFrame/getResolution()'th set of bins). Chris@152: */ Chris@152: virtual void getBinValues(long windowStartFrame, BinValueSet &result) const; Chris@152: Chris@152: /** Chris@152: * Get a single value, the one at the n'th bin of the set of bins Chris@152: * starting at the given sample frame. Chris@152: */ Chris@152: virtual float getBinValue(long windowStartFrame, size_t n) const; Chris@152: Chris@152: /** Chris@152: * Set the entire set of bin values at the given sample frame. Chris@152: */ Chris@152: virtual void setBinValues(long windowStartFrame, const BinValueSet &values); Chris@152: Chris@152: virtual QString getBinName(size_t n) const; Chris@152: virtual void setBinName(size_t n, QString); Chris@152: virtual void setBinNames(std::vector names); Chris@152: Chris@152: virtual void setCompletion(int completion); Chris@152: virtual int getCompletion() const { return m_completion; } Chris@152: Chris@152: virtual void toXml(QTextStream &out, Chris@152: QString indent = "", Chris@152: QString extraAttributes = "") const; Chris@152: Chris@152: virtual QString toXmlString(QString indent = "", Chris@152: QString extraAttributes = "") const; Chris@152: Chris@152: protected: Chris@152: typedef std::vector ValueMatrix; Chris@152: ValueMatrix m_data; Chris@152: Chris@152: std::vector m_binNames; Chris@152: Chris@152: size_t m_sampleRate; Chris@152: size_t m_resolution; Chris@152: size_t m_yBinCount; Chris@152: float m_minimum; Chris@152: float m_maximum; Chris@152: bool m_notifyOnAdd; Chris@152: long m_sinceLastNotifyMin; Chris@152: long m_sinceLastNotifyMax; Chris@152: int m_completion; Chris@152: Chris@152: mutable QMutex m_mutex; Chris@152: }; Chris@152: Chris@152: #endif