# HG changeset patch # User Chris Cannam # Date 1287997893 -7200 # Node ID eed79c69be61687e8cb00b7aa73fae56e935959a # Parent fe83e6e686831db84ee3e97330bc9778652fd8a7# Parent 143e1b56e81b885d045fd7b51ff5204fc0ee996e Merge diff -r 143e1b56e81b -r eed79c69be61 audioio/AudioCallbackPlaySource.cpp --- 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; diff -r 143e1b56e81b -r eed79c69be61 framework/Document.cpp --- 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 #include #include +#include // 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; } diff -r 143e1b56e81b -r eed79c69be61 framework/MainWindowBase.cpp --- 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(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(layer)) continue; + + layer->showLayer(pane, show); + } + } + } +} + +void MainWindowBase::toggleZoomWheels() { if (m_viewManager->getZoomWheelsEnabled()) { diff -r 143e1b56e81b -r eed79c69be61 framework/MainWindowBase.h --- 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(); diff -r 143e1b56e81b -r eed79c69be61 framework/SVFileReader.cpp --- 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::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(model) && + !dynamic_cast(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); } }