# HG changeset patch # User Chris Cannam # Date 1465814571 -3600 # Node ID 5e5873c24142d72cc37253bc9a444848d06e396b # Parent 38a53c7b81f6364a90480c4aa486ad5ae4b5ae15 Make peak cache divisor a member diff -r 38a53c7b81f6 -r 5e5873c24142 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Thu May 26 11:21:55 2016 +0100 +++ b/layer/SpectrogramLayer.cpp Mon Jun 13 11:42:51 2016 +0100 @@ -78,6 +78,7 @@ m_synchronous(false), m_haveDetailedScale(false), m_exiting(false), + m_peakCacheDivisor(8), m_sliceableModel(0) { QString colourConfigName = "spectrogram-colour"; @@ -1521,7 +1522,8 @@ if (!m_peakCaches[view->getId()]) { FFTModel *f = getFFTModel(v); if (!f) return 0; - m_peakCaches[view->getId()] = new Dense3DModelPeakCache(f, 8); + m_peakCaches[view->getId()] = + new Dense3DModelPeakCache(f, m_peakCacheDivisor); } return m_peakCaches[view->getId()]; } @@ -1930,7 +1932,7 @@ if (m_drawBuffer.width() < bufwid || m_drawBuffer.height() != h) { m_drawBuffer = QImage(bufwid, h, QImage::Format_Indexed8); } - usePeaksCache = (increment * 8) < zoomLevel; + usePeaksCache = (increment * m_peakCacheDivisor) < zoomLevel; if (m_colourScale == PhaseColourScale) usePeaksCache = false; } @@ -2380,9 +2382,9 @@ #ifdef DEBUG_SPECTROGRAM_REPAINT cerr << "SpectrogramLayer::paintDrawBuffer: Note: bin display = " << m_binDisplay << ", w = " << w << ", binforx[" << w-1 << "] = " << binforx[w-1] << ", binforx[0] = " << binforx[0] << endl; #endif - if (usePeaksCache) { //!!! + if (usePeaksCache) { sourceModel = getPeakCache(v); - divisor = 8;//!!! + divisor = m_peakCacheDivisor; minbin = 0; maxbin = sourceModel->getHeight(); } else { diff -r 38a53c7b81f6 -r 5e5873c24142 layer/SpectrogramLayer.h --- a/layer/SpectrogramLayer.h Thu May 26 11:21:55 2016 +0100 +++ b/layer/SpectrogramLayer.h Mon Jun 13 11:42:51 2016 +0100 @@ -357,6 +357,7 @@ typedef std::map PeakCacheMap; // key is view id mutable ViewFFTMap m_fftModels; mutable PeakCacheMap m_peakCaches; + const int m_peakCacheDivisor; mutable Model *m_sliceableModel; class MagnitudeRange {