diff data/model/FFTModel.cpp @ 408:115f60df1e4d

* Speed up spectrogram painting by releasing mutex in FFTDataServer while calculating data prior to writing it, and by adding whole-column value query methods to FFT objects * Add paint cache to Thumbwheel -- repaints of this widget were slowing down the whole spectrogram repaint * More uses of MutexLocker (named and with debug) and more profile points * Make startup much quicker some of the time, with OSC server in place
author Chris Cannam
date Thu, 08 May 2008 14:46:22 +0000
parents 7e1b7fcb6c00
children 83eae5239db6
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Tue Apr 29 15:34:17 2008 +0000
+++ b/data/model/FFTModel.cpp	Thu May 08 14:46:22 2008 +0000
@@ -167,9 +167,15 @@
     Profiler profiler("FFTModel::getColumn", false);
 
     result.clear();
-    size_t height(getHeight());
-    for (size_t y = 0; y < height; ++y) {
-        result.push_back(const_cast<FFTModel *>(this)->getMagnitudeAt(x, y));
+    size_t h = getHeight();
+
+    float magnitudes[h];
+    if (m_server->getMagnitudesAt(x << m_xshift, magnitudes)) {
+        for (size_t y = 0; y < h; ++y) {
+            result.push_back(magnitudes[h]);
+        }
+    } else {
+        for (size_t i = 0; i < h; ++i) result.push_back(0.f);
     }
 }