diff data/fft/FFTDataServer.cpp @ 154:6ec58bb8f729

* Suspend/resume fft data server write activity while reading from a server to repaint the spectrogram display. Makes a significant improvement to the otherwise dreadful responsiveness of spectrogram display.
author Chris Cannam
date Thu, 03 Aug 2006 12:42:15 +0000
parents 8d92611901d3
children ae9be6b6b522
line wrap: on
line diff
--- a/data/fft/FFTDataServer.cpp	Wed Aug 02 16:42:17 2006 +0000
+++ b/data/fft/FFTDataServer.cpp	Thu Aug 03 12:42:15 2006 +0000
@@ -22,7 +22,7 @@
 #include "system/System.h"
 
 #define DEBUG_FFT_SERVER 1
-#define DEBUG_FFT_SERVER_FILL 1
+//#define DEBUG_FFT_SERVER_FILL 1
 
 #ifdef DEBUG_FFT_SERVER_FILL
 #ifndef DEBUG_FFT_SERVER
@@ -413,6 +413,9 @@
 void
 FFTDataServer::resume()
 {
+#ifdef DEBUG_FFT_SERVER
+    std::cerr << "FFTDataServer(" << this << "): resume" << std::endl;
+#endif
     m_suspended = false;
     m_condition.wakeAll();
 }
@@ -553,6 +556,7 @@
 {
     if (!haveCache(x)) {
         if (m_lastUsedCache == -1) {
+            if (m_suspended) resume();
             m_fillThread->start();
         }
         return false;
@@ -646,6 +650,8 @@
                        m_workbuffer,
                        m_workbuffer + m_fftSize/2,
                        factor);
+
+    if (m_suspended) resume();
 }    
 
 size_t