diff data/model/FFTModel.h @ 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 7aa1de571880
children 1405f4a2caf3
line wrap: on
line diff
--- a/data/model/FFTModel.h	Tue Apr 29 15:34:17 2008 +0000
+++ b/data/model/FFTModel.h	Thu May 08 14:46:22 2008 +0000
@@ -85,6 +85,16 @@
         return m_server->isColumnReady(x << m_xshift);
     }
 
+    float getMagnitudesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0) {
+        return m_server->getMagnitudesAt(x << m_xshift, values, minbin << m_yshift, count, getYRatio());
+    }
+    float getNormalizedMagnitudesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0) {
+        return m_server->getNormalizedMagnitudesAt(x << m_xshift, values, minbin << m_yshift, count, getYRatio());
+    }
+    float getPhasesAt(size_t x, float *values, size_t minbin = 0, size_t count = 0) {
+        return m_server->getPhasesAt(x << m_xshift, values, minbin << m_yshift, count, getYRatio());
+    }
+
     size_t getFillExtent() const { return m_server->getFillExtent(); }
 
     // DenseThreeDimensionalModel and Model methods:
@@ -186,6 +196,13 @@
 
     size_t getPeakPickWindowSize(PeakPickType type, size_t sampleRate,
                                  size_t bin, float &percentile) const;
+
+    size_t getYRatio() {
+        size_t ys = m_yshift;
+        size_t r = 1;
+        while (ys) { --ys; r <<= 1; }
+        return r;
+    }
 };
 
 #endif