diff layer/SpectrogramLayer.h @ 1504:150d4e561b07

Only set maximum frequency on FFT model when in a special verticallyFixed mode
author Chris Cannam
date Thu, 12 Sep 2019 13:50:24 +0100
parents e540aa5d89cd
children 4eafe5a1b655
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Thu Sep 12 11:53:40 2019 +0100
+++ b/layer/SpectrogramLayer.h	Thu Sep 12 13:50:24 2019 +0100
@@ -55,10 +55,14 @@
 
 public:
     enum Configuration { FullRangeDb, MelodicRange, MelodicPeaks };
-    
+
+    /**
+     * Construct a SpectrogramLayer with default parameters
+     * appropriate for the given configuration.
+     */
     SpectrogramLayer(Configuration = FullRangeDb);
     ~SpectrogramLayer();
-
+    
     const ZoomConstraint *getZoomConstraint() const override { return this; }
     ModelId getModel() const override { return m_model; }
     void paint(LayerGeometryProvider *v, QPainter &paint, QRect rect) const override;
@@ -89,7 +93,7 @@
     PropertyType getPropertyType(const PropertyName &) const override;
     QString getPropertyGroupName(const PropertyName &) const override;
     int getPropertyRangeAndValue(const PropertyName &,
-                                         int *min, int *max, int *deflt) const override;
+                                 int *min, int *max, int *deflt) const override;
     QString getPropertyValueLabel(const PropertyName &,
                                           int value) const override;
     QString getPropertyValueIconName(const PropertyName &,
@@ -133,6 +137,20 @@
     void setThreshold(float threshold);
     float getThreshold() const;
 
+    /**
+     * Mark the spectrogram layer as having a fixed range in the
+     * vertical axis. This indicates that the visible frequency range
+     * is determined entirely by the configuration requested on
+     * construction, and that setMinFrequency, setMaxFrequency, and
+     * setDisplayExtents will never be called. This may allow some
+     * cache-size-related optimisations. It should be called
+     * immediately after construction, if at all.
+     *
+     * Note that this cannot be reversed on a given object (this call
+     * takes no argument and there is no inverse call).
+     */
+    void setVerticallyFixed();
+
     void setMinFrequency(int);
     int getMinFrequency() const;
 
@@ -259,6 +277,7 @@
     int                 m_minFrequency;
     int                 m_maxFrequency;
     int                 m_initialMaxFrequency;
+    bool                m_verticallyFixed;
     ColourScaleType     m_colourScale;
     double              m_colourScaleMultiple;
     int                 m_colourMap;