diff layer/SpectrogramLayer.h @ 1324:13d9b422f7fe zoom

Merge from default branch
author Chris Cannam
date Mon, 17 Sep 2018 13:51:31 +0100
parents a34a2a25907c
children d79e21855aef
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Mon Dec 12 15:18:52 2016 +0000
+++ b/layer/SpectrogramLayer.h	Mon Sep 17 13:51:31 2018 +0100
@@ -49,7 +49,7 @@
  */
 
 class SpectrogramLayer : public VerticalBinLayer,
-			 public PowerOfSqrtTwoZoomConstraint
+                         public PowerOfSqrtTwoZoomConstraint
 {
     Q_OBJECT
 
@@ -74,8 +74,8 @@
     virtual QString getFeatureDescription(LayerGeometryProvider *v, QPoint &) const;
 
     virtual bool snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame,
-				    int &resolution,
-				    SnapType snap) const;
+                                    int &resolution,
+                                    SnapType snap) const;
 
     virtual void measureDoubleClick(LayerGeometryProvider *, QMouseEvent *);
 
@@ -91,7 +91,7 @@
     virtual int getPropertyRangeAndValue(const PropertyName &,
                                          int *min, int *max, int *deflt) const;
     virtual QString getPropertyValueLabel(const PropertyName &,
-					  int value) const;
+                                          int value) const;
     virtual QString getPropertyValueIconName(const PropertyName &,
                                              int value) const;
     virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const;
@@ -189,7 +189,7 @@
     int getColourRotation() const;
 
     virtual VerticalPosition getPreferredFrameCountPosition() const {
-	return PositionTop;
+        return PositionTop;
     }
 
     virtual bool isLayerOpaque() const { return true; }
@@ -224,7 +224,7 @@
 
     virtual void setLayerDormant(const LayerGeometryProvider *v, bool dormant);
 
-    virtual bool isLayerScrollable(const LayerGeometryProvider *) const { return false; }
+    virtual bool isLayerScrollable(const LayerGeometryProvider *) const;
 
     virtual int getVerticalZoomSteps(int &defaultStep) const;
     virtual int getCurrentVerticalZoomStep() const;
@@ -258,7 +258,7 @@
     ColourScaleType     m_colourScale;
     double              m_colourScaleMultiple;
     int                 m_colourMap;
-    QColor              m_crosshairColour;
+    mutable QColor      m_crosshairColour;
     BinScale            m_binScale;
     BinDisplay          m_binDisplay;
     ColumnNormalization m_normalization; // of individual columns
@@ -287,11 +287,11 @@
 
     bool getYBinSourceRange(LayerGeometryProvider *v, int y, double &freqMin, double &freqMax) const;
     bool getAdjustedYBinSourceRange(LayerGeometryProvider *v, int x, int y,
-				    double &freqMin, double &freqMax,
-				    double &adjFreqMin, double &adjFreqMax) const;
+                                    double &freqMin, double &freqMax,
+                                    double &adjFreqMin, double &adjFreqMax) const;
     bool getXBinSourceRange(LayerGeometryProvider *v, int x, RealTime &timeMin, RealTime &timeMax) const;
     bool getXYBinSourceRange(LayerGeometryProvider *v, int x, int y, double &min, double &max,
-			     double &phaseMin, double &phaseMax) const;
+                             double &phaseMin, double &phaseMax) const;
 
     int getWindowIncrement() const {
         if (m_windowHopLevel == 0) return m_windowSize;
@@ -302,9 +302,14 @@
     int getFFTOversampling() const;
     int getFFTSize() const; // m_windowSize * getFFTOversampling()
 
-    mutable FFTModel *m_fftModel; //!!! should not be mutable, see getFFTModel()?
-    mutable Dense3DModelPeakCache *m_peakCache;
+    FFTModel *m_fftModel;
+    FFTModel *getFFTModel() const { return m_fftModel; }
+    Dense3DModelPeakCache *m_wholeCache;
+    Dense3DModelPeakCache *m_peakCache;
+    Dense3DModelPeakCache *getPeakCache() const { return m_peakCache; }
     const int m_peakCacheDivisor;
+    bool canStoreWholeCache() const;
+    void recreateFFTModel();
 
     typedef std::map<int, MagnitudeRange> ViewMagMap; // key is view id
     mutable ViewMagMap m_viewMags;
@@ -315,11 +320,9 @@
     mutable ViewRendererMap m_renderers;
     Colour3DPlotRenderer *getRenderer(LayerGeometryProvider *) const;
     void invalidateRenderers();
+
+    void deleteDerivedModels();
     
-    FFTModel *getFFTModel() const;
-    Dense3DModelPeakCache *getPeakCache() const;
-    void invalidateFFTModel();
-
     void paintWithRenderer(LayerGeometryProvider *v, QPainter &paint, QRect rect) const;
 
     void paintDetailedScale(LayerGeometryProvider *v,