diff layer/SpectrogramLayer.cpp @ 1054:5e5873c24142 3.0-integration

Make peak cache divisor a member
author Chris Cannam
date Mon, 13 Jun 2016 11:42:51 +0100
parents 4e5c1c326794
children 00891cfaa4d3
line wrap: on
line diff
--- 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 {