changeset 491:c74e511a3c96

* Fix overall mag range management in normalise-visible-area mode
author Chris Cannam
date Mon, 09 Feb 2009 12:56:16 +0000
parents aa477ddcadb5
children f60b6204856e
files layer/SpectrogramLayer.cpp layer/SpectrogramLayer.h
diffstat 2 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Fri Feb 06 15:06:23 2009 +0000
+++ b/layer/SpectrogramLayer.cpp	Mon Feb 09 12:56:16 2009 +0000
@@ -2302,14 +2302,16 @@
             }
         }
 
-        paintDrawBuffer(v, bufwid, h, binforx, binfory, usePeaksCache);
+        paintDrawBuffer(v, bufwid, h, binforx, binfory, usePeaksCache,
+                        overallMag, overallMagChanged);
 
     } else {
 
         paintDrawBufferPeakFrequencies(v, bufwid, h, binforx,
                                        minbin, maxbin,
                                        displayMinFreq, displayMaxFreq,
-                                       logarithmic);
+                                       logarithmic,
+                                       overallMag, overallMagChanged);
     }
 
 /*
@@ -2482,7 +2484,9 @@
                                                  int maxbin,
                                                  float displayMinFreq,
                                                  float displayMaxFreq,
-                                                 bool logarithmic) const
+                                                 bool logarithmic,
+                                                 MagnitudeRange &overallMag,
+                                                 bool &overallMagChanged) const
 {
     Profiler profiler("SpectrogramLayer::paintDrawBufferPeakFrequencies");
 
@@ -2577,6 +2581,7 @@
                               << std::endl;
                 } else {
                     m_columnMags[sx].sample(mag);
+                    if (overallMag.sample(mag)) overallMagChanged = true;
                 }
             }
         }
@@ -2591,7 +2596,9 @@
                                   int h,
                                   int *binforx,
                                   float *binfory,
-                                  bool usePeaksCache) const
+                                  bool usePeaksCache,
+                                  MagnitudeRange &overallMag,
+                                  bool &overallMagChanged) const
 {
     Profiler profiler("SpectrogramLayer::paintDrawBuffer");
 
@@ -2774,6 +2781,7 @@
                               << std::endl;
                 } else {
                     m_columnMags[sx].sample(mag);
+                    if (overallMag.sample(mag)) overallMagChanged = true;
                 }
             }
         }
--- a/layer/SpectrogramLayer.h	Fri Feb 06 15:06:23 2009 +0000
+++ b/layer/SpectrogramLayer.h	Mon Feb 09 12:56:16 2009 +0000
@@ -426,21 +426,18 @@
     bool updateViewMagnitudes(View *v) const;
     bool paintDrawBuffer(View *v, int w, int h,
                          int *binforx, float *binfory,
-                         bool usePeaksCache) const;
+                         bool usePeaksCache,
+                         MagnitudeRange &overallMag,
+                         bool &overallMagChanged) const;
     bool paintDrawBufferPeakFrequencies(View *v, int w, int h,
                                         int *binforx,
                                         int minbin,
                                         int maxbin,
                                         float displayMinFreq,
                                         float displayMaxFreq,
-                                        bool logarithmic) const;
-    //!!! phasing this one out:
-    bool paintColumnValues(View *v, FFTModel *fft, int x0, int x,
-                           int minbin, int maxbin,
-                           float displayMinFreq, float displayMaxFreq,
-                           float xPixelRatio,
-                           const int h,
-                           const float *yforbin) const;
+                                        bool logarithmic,
+                                        MagnitudeRange &overallMag,
+                                        bool &overallMagChanged) const;
 
     virtual void updateMeasureRectYCoords(View *v, const MeasureRect &r) const;
     virtual void setMeasureRectYCoord(View *v, MeasureRect &r, bool start, int y) const;