annotate layer/SpectrumLayer.h @ 282:d9319859a4cf tip

(none)
author benoitrigolleau
date Fri, 31 Oct 2008 11:00:24 +0000
parents fc9323a41f5a
children
rev   line source
lbajardsilogic@0 1
lbajardsilogic@0 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
lbajardsilogic@0 3
lbajardsilogic@0 4 /*
lbajardsilogic@0 5 Sonic Visualiser
lbajardsilogic@0 6 An audio file viewer and annotation editor.
lbajardsilogic@0 7 Centre for Digital Music, Queen Mary, University of London.
lbajardsilogic@0 8 This file copyright 2006 QMUL.
lbajardsilogic@0 9
lbajardsilogic@0 10 This program is free software; you can redistribute it and/or
lbajardsilogic@0 11 modify it under the terms of the GNU General Public License as
lbajardsilogic@0 12 published by the Free Software Foundation; either version 2 of the
lbajardsilogic@0 13 License, or (at your option) any later version. See the file
lbajardsilogic@0 14 COPYING included with this distribution for more information.
lbajardsilogic@0 15 */
lbajardsilogic@0 16
lbajardsilogic@0 17 #ifndef _SPECTRUM_LAYER_H_
lbajardsilogic@0 18 #define _SPECTRUM_LAYER_H_
lbajardsilogic@0 19
lbajardsilogic@0 20 #include "SliceLayer.h"
lbajardsilogic@0 21
lbajardsilogic@0 22 #include "base/Window.h"
lbajardsilogic@0 23
lbajardsilogic@0 24 #include "data/model/DenseTimeValueModel.h"
lbajardsilogic@0 25
lbajardsilogic@0 26 #include <QColor>
lbajardsilogic@0 27
lbajardsilogic@0 28 class FFTModel;
lbajardsilogic@0 29
lbajardsilogic@0 30 class SpectrumLayer : public SliceLayer
lbajardsilogic@0 31 {
lbajardsilogic@0 32 Q_OBJECT
lbajardsilogic@0 33
lbajardsilogic@0 34 public:
lbajardsilogic@0 35 SpectrumLayer();
lbajardsilogic@0 36 ~SpectrumLayer();
lbajardsilogic@0 37
lbajardsilogic@0 38 void setModel(DenseTimeValueModel *model);
lbajardsilogic@0 39 virtual const Model *getModel() const { return m_originModel; }
lbajardsilogic@0 40
lbajardsilogic@0 41 virtual QString getFeatureDescription(View *v, QPoint &) const;
lbajardsilogic@0 42
lbajardsilogic@0 43 virtual PropertyList getProperties() const;
lbajardsilogic@0 44 virtual QString getPropertyLabel(const PropertyName &) const;
lbajardsilogic@0 45 virtual PropertyType getPropertyType(const PropertyName &) const;
lbajardsilogic@0 46 virtual QString getPropertyGroupName(const PropertyName &) const;
lbajardsilogic@0 47 virtual int getPropertyRangeAndValue(const PropertyName &,
lbajardsilogic@0 48 int *min, int *max, int *deflt) const;
lbajardsilogic@0 49 virtual QString getPropertyValueLabel(const PropertyName &,
lbajardsilogic@0 50 int value) const;
lbajardsilogic@0 51 virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
lbajardsilogic@0 52 virtual void setProperty(const PropertyName &, int value);
lbajardsilogic@0 53 virtual void setProperties(const QXmlAttributes &);
lbajardsilogic@0 54
lbajardsilogic@0 55 virtual bool getValueExtents(float &min, float &max,
lbajardsilogic@0 56 bool &logarithmic, QString &unit) const;
lbajardsilogic@0 57
lbajardsilogic@0 58 virtual bool isLayerScrollable(const View *) const { return false; }
lbajardsilogic@0 59
lbajardsilogic@0 60 void setChannel(int);
lbajardsilogic@0 61 int getChannel() const { return m_channel; }
lbajardsilogic@0 62
lbajardsilogic@0 63 void setWindowSize(size_t);
lbajardsilogic@0 64 size_t getWindowSize() const { return m_windowSize; }
lbajardsilogic@0 65
lbajardsilogic@0 66 void setWindowHopLevel(size_t level);
lbajardsilogic@0 67 size_t getWindowHopLevel() const { return m_windowHopLevel; }
lbajardsilogic@0 68
lbajardsilogic@0 69 void setWindowType(WindowType type);
lbajardsilogic@0 70 WindowType getWindowType() const { return m_windowType; }
lbajardsilogic@0 71
lbajardsilogic@0 72 virtual QString toXmlString(QString indent = "",
lbajardsilogic@0 73 QString extraAttributes = "") const;
lbajardsilogic@0 74
lbajardsilogic@0 75 protected slots:
lbajardsilogic@0 76 void preferenceChanged(PropertyContainer::PropertyName name);
lbajardsilogic@0 77
lbajardsilogic@0 78 protected:
lbajardsilogic@0 79 // make this SliceLayer method unavailable to the general public
lbajardsilogic@0 80 // virtual void setModel(DenseThreeDimensionalModel *model) {
lbajardsilogic@0 81 // SliceLayer::setModel(model);
lbajardsilogic@0 82 // }
lbajardsilogic@0 83
lbajardsilogic@0 84 DenseTimeValueModel *m_originModel;
lbajardsilogic@0 85 int m_channel;
lbajardsilogic@0 86 bool m_channelSet;
lbajardsilogic@0 87 size_t m_windowSize;
lbajardsilogic@0 88 WindowType m_windowType;
lbajardsilogic@0 89 size_t m_windowHopLevel;
lbajardsilogic@0 90
lbajardsilogic@0 91 void setupFFT();
lbajardsilogic@0 92
lbajardsilogic@0 93 size_t getWindowIncrement() const {
lbajardsilogic@0 94 if (m_windowHopLevel == 0) return m_windowSize;
lbajardsilogic@0 95 else if (m_windowHopLevel == 1) return (m_windowSize * 3) / 4;
lbajardsilogic@0 96 else return m_windowSize / (1 << (m_windowHopLevel - 1));
lbajardsilogic@0 97 }
lbajardsilogic@0 98 };
lbajardsilogic@0 99
lbajardsilogic@0 100 #endif