# HG changeset patch # User Chris Cannam # Date 1141665625 0 # Node ID 97b0643bd7994684f2b7464b450d9a31a92f486e # Parent 2e2ad8510e526436bddb1a36b9477c1b07169391 * A bit more work on main window / document / commands stuff. This is still pretty unstable. * Enable CSV file reader also to read files with other separators (e.g. .lab files with space separators) * Show "(R)" on waveform display when resampling during playback * Add ability to import additional audio files (can't process them yet) * Fixes to spectrogram cache for multiple views * Fix to avoid floating-point exception in sparse model when resolution not set yet diff -r 2e2ad8510e52 -r 97b0643bd799 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Fri Mar 03 17:52:21 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Mon Mar 06 17:20:25 2006 +0000 @@ -1270,14 +1270,24 @@ // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl; -/*!!! Need a way of finding out whether this layer is dormant in - all the views that are currently visible... or not - - if (m_layer.m_dormancy[) { -*/ - if (0) { //!!! + bool haveUndormantViews = false; + + for (std::map::iterator i = + m_layer.m_dormancy.begin(); + i != m_layer.m_dormancy.end(); ++i) { + + if (!i->second) { + haveUndormantViews = true; + break; + } + } + + if (!haveUndormantViews) { + + if (m_layer.m_cacheInvalid && m_layer.m_cache) { + std::cerr << "All views dormant, freeing spectrogram cache" + << std::endl; - if (m_layer.m_cacheInvalid) { delete m_layer.m_cache; m_layer.m_cache = 0; } @@ -1288,8 +1298,11 @@ while (!m_layer.m_model->isReady()) { m_layer.m_condition.wait(&m_layer.m_mutex, 100); + if (m_layer.m_exiting) break; } + if (m_layer.m_exiting) break; + m_layer.m_cacheInvalid = false; m_fillExtent = 0; m_fillCompletion = 0; @@ -1699,10 +1712,15 @@ } if (isLayerDormant(v)) { - std::cerr << "SpectrogramLayer::paint(): Layer is dormant" << std::endl; - return; + std::cerr << "SpectrogramLayer::paint(): Layer is dormant, making it undormant again" << std::endl; } + // Need to do this even if !isLayerDormant, as that could mean v + // is not in the dormancy map at all -- we need it to be present + // and accountable for when determining whether we need the cache + // in the cache-fill thread above. + m_dormancy[v] = false; + #ifdef DEBUG_SPECTROGRAM_REPAINT std::cerr << "SpectrogramLayer::paint(): About to lock" << std::endl; #endif diff -r 2e2ad8510e52 -r 97b0643bd799 widgets/Pane.cpp --- a/widgets/Pane.cpp Fri Mar 03 17:52:21 2006 +0000 +++ b/widgets/Pane.cpp Mon Mar 06 17:20:25 2006 +0000 @@ -300,11 +300,13 @@ if (waveformModel) { - QString desc = tr("%1 / %2Hz") + QString desc = tr("%1 / %2Hz%3") .arg(RealTime::frame2RealTime(waveformModel->getEndFrame(), - waveformModel->getSampleRate()) + sampleRate) .toText(false).c_str()) - .arg(waveformModel->getSampleRate()); + .arg(sampleRate) + .arg((m_manager && + sampleRate != m_manager->getPlaybackSampleRate()) ? " (R)" : ""); paint.drawText(width() - paint.fontMetrics().width(desc) - 5, height() - paint.fontMetrics().height() +