diff audioio/AudioCallbackPlaySource.cpp @ 8:24b500216029

* Refactor sparse models. Previously the 1D and time-value models duplicated a lot of code; now there is a base class (SparseModel) templated on the stored point type, and the subclasses define point types with the necessary characteristics. * Add NoteModel, a new SparseModel subclass. * Reorganise local feature description display. Instead of asking the layer to draw its own, just query it for a textual description and draw that in Pane. Greatly simplifies this part of the layer code. * Add local feature descriptions to colour 3D plot and waveform layers. * Add pitch in MIDI-pitch-and-cents to spectrogram layer. * Give AudioGenerator its own mutex to shorten lock times in CallbackPlaySource. * Minor adjustments to layers menu &c
author Chris Cannam
date Thu, 02 Feb 2006 16:10:19 +0000
parents 3a41ba527b4a
children e71385792d9d
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Mon Jan 30 17:51:56 2006 +0000
+++ b/audioio/AudioCallbackPlaySource.cpp	Thu Feb 02 16:10:19 2006 +0000
@@ -80,6 +80,8 @@
 void
 AudioCallbackPlaySource::addModel(Model *model)
 {
+    m_audioGenerator->addModel(model);
+
     m_mutex.lock();
 
     m_models.insert(model);
@@ -116,8 +118,6 @@
 	m_audioGenerator->setTargetChannelCount(modelChannels);
     }
 
-    m_audioGenerator->addModel(model);
-
     if (!m_writeBuffers || (m_writeBuffers->size() < modelChannels)) {
 	clearRingBuffers(true, modelChannels);
 	buffersChanged = true;
@@ -172,10 +172,10 @@
     }
     m_lastModelEndFrame = lastEnd;
 
+    m_mutex.unlock();
+
     m_audioGenerator->removeModel(model);
 
-    m_mutex.unlock();
-
     clearRingBuffers();
 }
 
@@ -193,11 +193,11 @@
 
     m_lastModelEndFrame = 0;
 
-    m_audioGenerator->clearModels();
-
     m_sourceSampleRate = 0;
 
     m_mutex.unlock();
+
+    m_audioGenerator->clearModels();
 }    
 
 void
@@ -224,7 +224,7 @@
 
     if (!haveLock) {
 	m_mutex.unlock();
-	m_condition.wakeAll();
+//!!!	m_condition.wakeAll();
     }
 }