# HG changeset patch # User Chris Cannam # Date 1234184176 0 # Node ID c74e511a3c9639580e903f17dc71813521d8a9a2 # Parent aa477ddcadb578f089651e1e7f9c07b39c4f5f23 * Fix overall mag range management in normalise-visible-area mode diff -r aa477ddcadb5 -r c74e511a3c96 layer/SpectrogramLayer.cpp --- 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; } } } diff -r aa477ddcadb5 -r c74e511a3c96 layer/SpectrogramLayer.h --- 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;