diff audioio/AudioCallbackPlaySource.cpp @ 118:b4110b17bca8

* Fix #1672407 confused by plugin-named files in cwd (or home?) * Fix #1491848 crash when loading new file while transform plugin runs * Fix #1502287 Background remains black after spectrogram layer deleted * Fix #1604477 Replacing the main audio file silences secondary audio file * Fix failure to initialise property box layout to last preference on startup * Fix resample/wrong-rate display in Pane, ensure that right rate is chosen if all current models have an acceptable rate even if previous main model had a different one * Fix "global zoom" broken in previous commit * Some fixes to spectrogram cache area updating (makes spectrogram appear more quickly, previously it had a tendency to refresh with empty space) * Fixes to colour 3d plot normalization
author Chris Cannam
date Thu, 08 Mar 2007 16:53:08 +0000
parents f8e362511b2f
children fbd09fcda469
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Wed Mar 07 18:00:49 2007 +0000
+++ b/audioio/AudioCallbackPlaySource.cpp	Thu Mar 08 16:53:08 2007 +0000
@@ -126,7 +126,9 @@
 	m_sourceChannelCount = modelChannels;
     }
 
-//    std::cout << "Adding model with " << modelChannels << " channels " << std::endl;
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "Adding model with " << modelChannels << " channels " << std::endl;
+#endif
 
     if (m_sourceSampleRate == 0) {
 
@@ -144,7 +146,10 @@
 
             for (std::set<Model *>::const_iterator i = m_models.begin();
                  i != m_models.end(); ++i) {
-                if (*i != dtvm && dynamic_cast<DenseTimeValueModel *>(*i)) {
+                DenseTimeValueModel *dtvm2 =
+                    dynamic_cast<DenseTimeValueModel *>(*i);
+                if (dtvm2 && dtvm2 != dtvm &&
+                    dtvm2->getSampleRate() != model->getSampleRate()) {
                     std::cerr << "AudioCallbackPlaySource::addModel: Conflicting dense time-value model " << *i << " found" << std::endl;
                     conflicting = true;
                     break;
@@ -195,7 +200,7 @@
     }
 
 #ifdef DEBUG_AUDIO_PLAY_SOURCE
-    std::cout << "AudioCallbackPlaySource::addModel: emitting modelReplaced" << std::endl;
+    std::cout << "AudioCallbackPlaySource::addModel: now have " << m_models.size() << " model(s) -- emitting modelReplaced" << std::endl;
 #endif
 
     if (buffersChanged || srChanged) {
@@ -210,6 +215,10 @@
 {
     m_mutex.lock();
 
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::removeModel(" << model << ")" << std::endl;
+#endif
+
     m_models.erase(model);
 
     if (m_models.empty()) {
@@ -243,6 +252,10 @@
 {
     m_mutex.lock();
 
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::clearModels()" << std::endl;
+#endif
+
     m_models.clear();
 
     if (m_converter) {