diff data/model/WaveFileModel.cpp @ 177:aff66ec5aea4

* Audition effects plugins during playback
author Chris Cannam
date Wed, 04 Oct 2006 11:01:39 +0000
parents 570794f6f6a7
children 0ed2b2e26b44
line wrap: on
line diff
--- a/data/model/WaveFileModel.cpp	Tue Oct 03 15:01:50 2006 +0000
+++ b/data/model/WaveFileModel.cpp	Wed Oct 04 11:01:39 2006 +0000
@@ -517,23 +517,27 @@
         }
 
         first = false;
+        if (m_model.m_exiting) break;
         if (updating) sleep(1);
     }
 
-    QMutexLocker locker(&m_model.m_mutex);
-    for (size_t ct = 0; ct < 2; ++ct) {
-        if (count[ct] > 0) {
-            for (size_t ch = 0; ch < size_t(channels); ++ch) {
-                size_t rangeIndex = ch * 2 + ct;
-                range[rangeIndex].absmean /= count[ct];
-                m_model.m_cache[ct].push_back(range[rangeIndex]);
-                range[rangeIndex] = Range();
+    if (!m_model.m_exiting) {
+
+        QMutexLocker locker(&m_model.m_mutex);
+        for (size_t ct = 0; ct < 2; ++ct) {
+            if (count[ct] > 0) {
+                for (size_t ch = 0; ch < size_t(channels); ++ch) {
+                    size_t rangeIndex = ch * 2 + ct;
+                    range[rangeIndex].absmean /= count[ct];
+                    m_model.m_cache[ct].push_back(range[rangeIndex]);
+                    range[rangeIndex] = Range();
+                }
+                count[ct] = 0;
             }
-            count[ct] = 0;
+            
+            const Range &rr = *m_model.m_cache[ct].begin();
+            MUNLOCK(&rr, m_model.m_cache[ct].capacity() * sizeof(Range));
         }
-
-	const Range &rr = *m_model.m_cache[ct].begin();
-	MUNLOCK(&rr, m_model.m_cache[ct].capacity() * sizeof(Range));
     }
     
     delete[] range;