comparison layer/SpectrogramLayer.cpp @ 47:2e2ad8510e52

* Fix a crash in PortAudio output for mono data * Don't construct a chromagram in TonalChangeDetect plugin ctor * Update layer show/hide/dormancy for multi-view-capable layers -- the dormancy concept doesn't really work with these constraints any more
author Chris Cannam
date Fri, 03 Mar 2006 17:52:21 +0000
parents 25a2915d351d
children 97b0643bd799
comparison
equal deleted inserted replaced
46:2152e19d7db9 47:2e2ad8510e52
796 { 796 {
797 return m_normalizeColumns; 797 return m_normalizeColumns;
798 } 798 }
799 799
800 void 800 void
801 SpectrogramLayer::setLayerDormant(const bool dormant) 801 SpectrogramLayer::setLayerDormant(const View *v, bool dormant)
802 { 802 {
803 if (dormant == m_dormant) return; 803 QMutexLocker locker(&m_mutex);
804
805 if (dormant == m_dormancy[v]) return;
804 806
805 if (dormant) { 807 if (dormant) {
806 808
807 m_mutex.lock(); 809 m_dormancy[v] = true;
808 m_dormant = true;
809 810
810 // delete m_cache; 811 // delete m_cache;
811 // m_cache = 0; 812 // m_cache = 0;
812 813
813 m_cacheInvalid = true; 814 m_cacheInvalid = true;
814 m_pixmapCacheInvalid = true; 815 m_pixmapCacheInvalid = true;
815 delete m_pixmapCache; 816 delete m_pixmapCache;
816 m_pixmapCache = 0; 817 m_pixmapCache = 0;
817 818
818 m_mutex.unlock();
819
820 } else { 819 } else {
821 820
822 m_dormant = false; 821 m_dormancy[v] = false;
823 fillCache();
824 } 822 }
825 } 823 }
826 824
827 void 825 void
828 SpectrogramLayer::cacheInvalid() 826 SpectrogramLayer::cacheInvalid()
1270 1268
1271 bool interrupted = false; 1269 bool interrupted = false;
1272 1270
1273 // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl; 1271 // std::cerr << "SpectrogramLayer::CacheFillThread::run in loop" << std::endl;
1274 1272
1275 if (m_layer.m_dormant) { 1273 /*!!! Need a way of finding out whether this layer is dormant in
1276 1274 all the views that are currently visible... or not
1275
1276 if (m_layer.m_dormancy[) {
1277 */
1278 if (0) { //!!!
1279
1277 if (m_layer.m_cacheInvalid) { 1280 if (m_layer.m_cacheInvalid) {
1278 delete m_layer.m_cache; 1281 delete m_layer.m_cache;
1279 m_layer.m_cache = 0; 1282 m_layer.m_cache = 0;
1280 } 1283 }
1281 1284
1693 1696
1694 if (!m_model || !m_model->isOK() || !m_model->isReady()) { 1697 if (!m_model || !m_model->isOK() || !m_model->isReady()) {
1695 return; 1698 return;
1696 } 1699 }
1697 1700
1698 if (m_dormant) { 1701 if (isLayerDormant(v)) {
1699 std::cerr << "SpectrogramLayer::paint(): Layer is dormant" << std::endl; 1702 std::cerr << "SpectrogramLayer::paint(): Layer is dormant" << std::endl;
1700 return; 1703 return;
1701 } 1704 }
1702 1705
1703 #ifdef DEBUG_SPECTROGRAM_REPAINT 1706 #ifdef DEBUG_SPECTROGRAM_REPAINT