changeset 111:ab55c427e068

* Split large FFT caches up into several files. Ongoing.
author Chris Cannam
date Wed, 28 Jun 2006 13:41:12 +0000
parents f262aa8973e3
children 43b1ca9647e1
files layer/SpectrogramLayer.cpp
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Tue Jun 27 19:18:42 2006 +0000
+++ b/layer/SpectrogramLayer.cpp	Wed Jun 28 13:41:12 2006 +0000
@@ -166,7 +166,7 @@
     list.push_back("Min Frequency");
     list.push_back("Max Frequency");
     list.push_back("Frequency Scale");
-    list.push_back("Zero Padding");
+//    list.push_back("Zero Padding");
     return list;
 }
 
@@ -1631,7 +1631,7 @@
 	bins = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1);
 	if (bins > m_fftSize / 2) bins = m_fftSize / 2;
     }
-	
+
     size_t minbin = 1;
     if (m_minFrequency > 0) {
 	minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.1);
@@ -1639,6 +1639,19 @@
 	if (minbin >= bins) minbin = bins - 1;
     }
 
+    //!!! quite wrong and won't work for layers that may be in more than one view
+    if (v->height() > (bins - minbin) / (m_zeroPadLevel + 1)) {
+        if (m_zeroPadLevel != 3) {
+            ((SpectrogramLayer *)this)->setZeroPadLevel(3);
+            return;
+        }
+    } else {
+        if (m_zeroPadLevel != 0) {
+            ((SpectrogramLayer *)this)->setZeroPadLevel(0);
+            return;
+        }
+    }
+	
     float minFreq = (float(minbin) * sr) / m_fftSize;
     float maxFreq = (float(bins) * sr) / m_fftSize;