Mercurial > hg > svgui
comparison layer/SpectrumLayer.h @ 1395:32bbb86094c3
Merge from branch spectrogramparam
author | Chris Cannam |
---|---|
date | Wed, 14 Nov 2018 14:23:17 +0000 |
parents | 900bed394f5a |
children | 10e768adaee5 |
comparison
equal
deleted
inserted
replaced
1380:78eecb19e688 | 1395:32bbb86094c3 |
---|---|
26 #include "HorizontalScaleProvider.h" | 26 #include "HorizontalScaleProvider.h" |
27 | 27 |
28 #include <QColor> | 28 #include <QColor> |
29 #include <QMutex> | 29 #include <QMutex> |
30 | 30 |
31 class FFTModel; | |
32 | |
33 class SpectrumLayer : public SliceLayer, | 31 class SpectrumLayer : public SliceLayer, |
34 public HorizontalScaleProvider | 32 public HorizontalScaleProvider |
35 { | 33 { |
36 Q_OBJECT | 34 Q_OBJECT |
37 | 35 |
44 | 42 |
45 virtual bool getCrosshairExtents(LayerGeometryProvider *, QPainter &, QPoint cursorPos, | 43 virtual bool getCrosshairExtents(LayerGeometryProvider *, QPainter &, QPoint cursorPos, |
46 std::vector<QRect> &extents) const override; | 44 std::vector<QRect> &extents) const override; |
47 virtual void paintCrosshairs(LayerGeometryProvider *, QPainter &, QPoint) const override; | 45 virtual void paintCrosshairs(LayerGeometryProvider *, QPainter &, QPoint) const override; |
48 | 46 |
49 virtual int getHorizontalScaleHeight(LayerGeometryProvider *, QPainter &) const; | 47 virtual int getHorizontalScaleHeight(LayerGeometryProvider *, QPainter &) const override; |
50 virtual void paintHorizontalScale(LayerGeometryProvider *, QPainter &, int xorigin) const; | 48 virtual void paintHorizontalScale(LayerGeometryProvider *, QPainter &, int xorigin) const; |
51 | 49 |
52 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const override; | 50 virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const override; |
53 | 51 |
54 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override; | 52 virtual void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override; |
88 int getWindowSize() const { return m_windowSize; } | 86 int getWindowSize() const { return m_windowSize; } |
89 | 87 |
90 void setWindowHopLevel(int level); | 88 void setWindowHopLevel(int level); |
91 int getWindowHopLevel() const { return m_windowHopLevel; } | 89 int getWindowHopLevel() const { return m_windowHopLevel; } |
92 | 90 |
91 void setOversampling(int oversampling); | |
92 int getOversampling() const; | |
93 | |
94 int getFFTSize() const { return getWindowSize() * getOversampling(); } | |
95 | |
93 void setWindowType(WindowType type); | 96 void setWindowType(WindowType type); |
94 WindowType getWindowType() const { return m_windowType; } | 97 WindowType getWindowType() const { return m_windowType; } |
95 | 98 |
96 void setShowPeaks(bool); | 99 void setShowPeaks(bool); |
97 bool getShowPeaks() const { return m_showPeaks; } | 100 bool getShowPeaks() const { return m_showPeaks; } |
101 | |
102 virtual bool needsTextLabelHeight() const { return true; } | |
98 | 103 |
99 virtual void toXml(QTextStream &stream, QString indent = "", | 104 virtual void toXml(QTextStream &stream, QString indent = "", |
100 QString extraAttributes = "") const override; | 105 QString extraAttributes = "") const override; |
101 | 106 |
102 virtual double getFrequencyForX(const LayerGeometryProvider *, double x) | 107 virtual double getFrequencyForX(const LayerGeometryProvider *, double x) |
112 int m_channel; | 117 int m_channel; |
113 bool m_channelSet; | 118 bool m_channelSet; |
114 int m_windowSize; | 119 int m_windowSize; |
115 WindowType m_windowType; | 120 WindowType m_windowType; |
116 int m_windowHopLevel; | 121 int m_windowHopLevel; |
122 int m_oversampling; | |
117 bool m_showPeaks; | 123 bool m_showPeaks; |
118 mutable bool m_newFFTNeeded; | 124 mutable bool m_newFFTNeeded; |
119 | 125 |
120 mutable QMutex m_fftMutex; | 126 mutable QMutex m_fftMutex; |
121 | 127 |
122 void setupFFT(); | 128 void setupFFT(); |
129 | |
130 virtual double getBinForFrequency(double freq) const; | |
131 virtual double getFrequencyForBin(double bin) const; | |
132 | |
133 virtual double getXForBin(const LayerGeometryProvider *, double bin) | |
134 const override; | |
135 virtual double getBinForX(const LayerGeometryProvider *, double x) | |
136 const override; | |
123 | 137 |
124 virtual void getBiasCurve(BiasCurve &) const override; | 138 virtual void getBiasCurve(BiasCurve &) const override; |
125 BiasCurve m_biasCurve; | 139 BiasCurve m_biasCurve; |
126 | 140 |
127 int getWindowIncrement() const { | 141 int getWindowIncrement() const { |