diff data/model/FFTModel.h @ 212:fb8ddd00f440

* better icon * support range mappers in thumbwheel * supply range mapper for vertical zoom from spectrogram * fix bug in fftmodel for scaled ffts * make the various widgets all respond to double-click for edit, middle-click for reset, ctrl-left-click for reset
author Chris Cannam
date Fri, 12 Jan 2007 14:49:18 +0000
parents f75f8a1cd7b1
children 21b9b25bff48
line wrap: on
line diff
--- a/data/model/FFTModel.h	Thu Jan 11 13:29:58 2007 +0000
+++ b/data/model/FFTModel.h	Fri Jan 12 14:49:18 2007 +0000
@@ -59,7 +59,13 @@
         return m_server->getWidth() >> m_xshift;
     }
     virtual size_t getHeight() const {
-        return m_server->getHeight() >> m_yshift;
+        // If there is no y-shift, the server's height (based on its
+        // fftsize/2 + 1) is correct.  If there is a shift, then the
+        // server is using a larger fft size than we want, so we shift
+        // it right as many times as necessary, but then we need to
+        // re-add the "+1" part (because ((fftsize*2)/2 + 1) / 2 !=
+        // fftsize/2 + 1).
+        return (m_server->getHeight() >> m_yshift) + (m_yshift > 0 ? 1 : 0);
     }
     virtual float getValueAt(size_t x, size_t y) const {
         return const_cast<FFTModel *>(this)->getMagnitudeAt(x, y);