diff layer/SpectrogramLayer.h @ 35:10ba9276a315

* Add TextModel and TextLayer types * Make View refresh work better when editing a model (previously edits might not be refreshed if their visible changed area extended beyond the strict frame range that was being modified in the model) * Add phase-adjusted instantaneous frequency display to spectrogram layer (still a work in progress) * Pull maths aliases out into a separate header in dsp/maths so MathUtilities can be included without introducing them
author Chris Cannam
date Mon, 20 Feb 2006 13:33:36 +0000
parents 651e4e868bcc
children c28ebb4ba4de
line wrap: on
line diff
--- a/layer/SpectrogramLayer.h	Fri Feb 17 18:11:08 2006 +0000
+++ b/layer/SpectrogramLayer.h	Mon Feb 20 13:33:36 2006 +0000
@@ -107,7 +107,10 @@
     void setColourScale(ColourScale);
     ColourScale getColourScale() const;
 
-    enum FrequencyScale { LinearFrequencyScale, LogFrequencyScale };
+    enum FrequencyScale {
+	LinearFrequencyScale,
+	LogFrequencyScale
+    };
     
     /**
      * Specify the scale for the y axis.
@@ -115,6 +118,18 @@
     void setFrequencyScale(FrequencyScale);
     FrequencyScale getFrequencyScale() const;
 
+    enum FrequencyAdjustment {
+	RawFrequency,
+	PhaseAdjustedFrequency,
+	PhaseAdjustedPeaks
+    };
+    
+    /**
+     * Specify the processing of frequency bins for the y axis.
+     */
+    void setFrequencyAdjustment(FrequencyAdjustment);
+    FrequencyAdjustment getFrequencyAdjustment() const;
+
     enum ColourScheme { DefaultColours, WhiteOnBlack, BlackOnWhite,
 			RedOnBlue, YellowOnBlack, RedOnBlack };
 
@@ -151,16 +166,17 @@
 protected:
     const DenseTimeValueModel *m_model; // I do not own this
     
-    int            m_channel;
-    size_t         m_windowSize;
-    WindowType     m_windowType;
-    size_t         m_windowOverlap;
-    float          m_gain;
-    int            m_colourRotation;
-    size_t         m_maxFrequency;
-    ColourScale    m_colourScale;
-    ColourScheme   m_colourScheme;
-    FrequencyScale m_frequencyScale;
+    int                 m_channel;
+    size_t              m_windowSize;
+    WindowType          m_windowType;
+    size_t              m_windowOverlap;
+    float               m_gain;
+    int                 m_colourRotation;
+    size_t              m_maxFrequency;
+    ColourScale         m_colourScale;
+    ColourScheme        m_colourScheme;
+    FrequencyScale      m_frequencyScale;
+    FrequencyAdjustment m_frequencyAdjustment;
 
     // A QImage would do just as well here, and we originally used
     // one: the problem is that we want to munlock() the memory it
@@ -173,6 +189,8 @@
 
 	size_t getWidth() const;
 	size_t getHeight() const;
+
+	void resize(size_t width, size_t height);
 	
 	unsigned char getValueAt(size_t x, size_t y) const;
 	void setValueAt(size_t x, size_t y, unsigned char value);
@@ -190,6 +208,7 @@
     };
     
     Cache *m_cache;
+    Cache *m_phaseAdjustCache;
     bool m_cacheInvalid;
 
     class CacheFillThread : public QThread
@@ -234,7 +253,7 @@
 			 size_t windowSize,
 			 size_t windowIncrement,
 			 const Window<double> &windower,
-			 bool lock)
+			 bool resetStoredPhase)
 	const;
 
     bool getYBinRange(int y, float &freqBinMin, float &freqBinMax) const;
@@ -248,6 +267,9 @@
     bool getXBinRange(int x, float &windowMin, float &windowMax) const;
 
     bool getYBinSourceRange(int y, float &freqMin, float &freqMax) const;
+    bool getAdjustedYBinSourceRange(int x, int y,
+				    float &freqMin, float &freqMax,
+				    float &adjFreqMin, float &adjFreqMax) const;
     bool getXBinSourceRange(int x, RealTime &timeMin, RealTime &timeMax) const;
     bool getXYBinSourceRange(int x, int y, float &dbMin, float &dbMax) const;