diff layer/Layer.cpp @ 131:eaae73b6bd28

* 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 33929e0c3c6b
children 42118892f428
line wrap: on
line diff
--- a/layer/Layer.cpp	Mon Jul 31 17:05:18 2006 +0000
+++ b/layer/Layer.cpp	Thu Aug 03 12:42:15 2006 +0000
@@ -19,7 +19,9 @@
 
 #include <iostream>
 
-#include "LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ?
+#include <QMutexLocker>
+
+#include "LayerFactory.h"
 #include "base/PlayParameterRepository.h"
 
 Layer::Layer()
@@ -92,6 +94,23 @@
 }
 
 void
+Layer::setLayerDormant(const View *v, bool dormant)
+{
+    const void *vv = (const void *)v;
+    QMutexLocker locker(&m_dormancyMutex);
+    m_dormancy[vv] = dormant;
+}
+
+bool
+Layer::isLayerDormant(const View *v) const
+{
+    const void *vv = (const void *)v;
+    QMutexLocker locker(&m_dormancyMutex);
+    if (m_dormancy.find(vv) == m_dormancy.end()) return false;
+    return m_dormancy.find(vv)->second;
+}
+
+void
 Layer::showLayer(View *view, bool show)
 {
     setLayerDormant(view, !show);