changeset 213:eed79c69be61

Merge
author Chris Cannam
date Mon, 25 Oct 2010 11:11:33 +0200
parents fe83e6e68683 (diff) 143e1b56e81b (current diff)
children 15057cf59da5
files framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 5 files changed, 92 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp	Fri Oct 15 12:08:34 2010 +0100
+++ b/audioio/AudioCallbackPlaySource.cpp	Mon Oct 25 11:11:33 2010 +0200
@@ -106,7 +106,10 @@
     m_exiting = true;
 
     if (m_fillThread) {
-	m_condition.wakeAll();
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource dtor: awakening thread" << std::endl;
+#endif
+        m_condition.wakeAll();
 	m_fillThread->wait();
 	delete m_fillThread;
     }
@@ -252,6 +255,10 @@
     connect(model, SIGNAL(modelChanged(size_t, size_t)),
             this, SLOT(modelChanged(size_t, size_t)));
 
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::addModel: awakening thread" << std::endl;
+#endif
+
     m_condition.wakeAll();
 }
 
@@ -304,10 +311,10 @@
     }
     m_lastModelEndFrame = lastEnd;
 
+    m_audioGenerator->removeModel(model);
+
     m_mutex.unlock();
 
-    m_audioGenerator->removeModel(model);
-
     clearRingBuffers();
 }
 
@@ -441,6 +448,11 @@
     m_lastRetrievalTimestamp = 0;
     m_lastCurrentFrame = 0;
     m_playing = true;
+
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::play: awakening thread" << std::endl;
+#endif
+
     m_condition.wakeAll();
     if (changed) {
         emit playStatusChanged(m_playing);
@@ -453,8 +465,16 @@
 void
 AudioCallbackPlaySource::stop()
 {
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cerr << "AudioCallbackPlaySource::stop()" << std::endl;
+#endif
     bool changed = m_playing;
     m_playing = false;
+
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::stop: awakening thread" << std::endl;
+#endif
+
     m_condition.wakeAll();
     m_lastRetrievalTimestamp = 0;
     if (changed) {
@@ -1058,6 +1078,10 @@
 	return 0;
     }
 
+#ifdef DEBUG_AUDIO_PLAY_SOURCE_PLAYING
+    std::cerr << "AudioCallbackPlaySource::getSourceSamples: Playing" << std::endl;
+#endif
+
     // Ensure that all buffers have at least the amount of data we
     // need -- else reduce the size of our requests correspondingly
 
@@ -1151,6 +1175,10 @@
 
         applyAuditioningEffect(count, buffer);
 
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::getSamples: awakening thread" << std::endl;
+#endif
+
         m_condition.wakeAll();
 
 	return got;
@@ -1239,6 +1267,10 @@
 
     applyAuditioningEffect(count, buffer);
 
+#ifdef DEBUG_AUDIO_PLAY_SOURCE
+    std::cout << "AudioCallbackPlaySource::getSamples [stretched]: awakening thread" << std::endl;
+#endif
+
     m_condition.wakeAll();
 
     return count;
--- a/framework/Document.cpp	Fri Oct 15 12:08:34 2010 +0100
+++ b/framework/Document.cpp	Mon Oct 25 11:11:33 2010 +0200
@@ -31,6 +31,7 @@
 #include <QTextStream>
 #include <QSettings>
 #include <iostream>
+#include <typeinfo>
 
 // For alignment:
 #include "data/model/AggregateWaveModel.h"
@@ -630,7 +631,8 @@
 
     if (m_layers.find(layer) == m_layers.end()) {
 	std::cerr << "Document::deleteLayer: Layer "
-		  << layer << " does not exist, or has already been deleted "
+                  << layer << " (" << typeid(layer).name() <<
+                  ") does not exist, or has already been deleted "
 		  << "(this may not be as serious as it sounds)" << std::endl;
 	return;
     }
--- a/framework/MainWindowBase.cpp	Fri Oct 15 12:08:34 2010 +0100
+++ b/framework/MainWindowBase.cpp	Mon Oct 25 11:11:33 2010 +0200
@@ -2049,6 +2049,47 @@
 }
 
 void
+MainWindowBase::toggleTimeRulers()
+{
+    bool haveRulers = false;
+    bool someHidden = false;
+
+    for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+
+        Pane *pane = m_paneStack->getPane(i);
+        if (!pane) continue;
+
+        for (int j = 0; j < pane->getLayerCount(); ++j) {
+
+            Layer *layer = pane->getLayer(j);
+            if (!dynamic_cast<TimeRulerLayer *>(layer)) continue;
+
+            haveRulers = true;
+            if (layer->isLayerDormant(pane)) someHidden = true;
+        }
+    }
+
+    if (haveRulers) {
+
+        bool show = someHidden;
+
+        for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+
+            Pane *pane = m_paneStack->getPane(i);
+            if (!pane) continue;
+
+            for (int j = 0; j < pane->getLayerCount(); ++j) {
+
+                Layer *layer = pane->getLayer(j);
+                if (!dynamic_cast<TimeRulerLayer *>(layer)) continue;
+
+                layer->showLayer(pane, show);
+            }
+        }
+    }
+}
+
+void
 MainWindowBase::toggleZoomWheels()
 {
     if (m_viewManager->getZoomWheelsEnabled()) {
--- a/framework/MainWindowBase.h	Fri Oct 15 12:08:34 2010 +0100
+++ b/framework/MainWindowBase.h	Mon Oct 25 11:11:33 2010 +0200
@@ -171,6 +171,7 @@
     virtual void showStandardOverlays();
     virtual void showAllOverlays();
 
+    virtual void toggleTimeRulers();
     virtual void toggleZoomWheels();
     virtual void togglePropertyBoxes();
     virtual void toggleStatusBar();
--- a/framework/SVFileReader.cpp	Fri Oct 15 12:08:34 2010 +0100
+++ b/framework/SVFileReader.cpp	Mon Oct 25 11:11:33 2010 +0200
@@ -412,8 +412,18 @@
     
     for (std::set<Model *>::iterator i = unaddedModels.begin();
          i != unaddedModels.end(); ++i) {
-        m_document->addImportedModel(*i);
-        m_addedModels.insert(*i);
+        Model *model = *i;
+        // don't want to add these models, because their lifespans
+        // are entirely dictated by the models that "own" them even
+        // though they were read independently from the .sv file.
+        // (pity we don't have a nicer way)
+        if (!dynamic_cast<PathModel *>(model) &&
+            !dynamic_cast<AlignmentModel *>(model)) {
+            m_document->addImportedModel(model);
+        }
+        // but we add all models here, so they don't get deleted
+        // when the file loader is destroyed
+        m_addedModels.insert(model);
     }
 }