comparison layer/SpectrogramLayer.cpp @ 162:f32212631b9c

* Handle generator transforms (plugins whose channel count isn't dependent on number of audio inputs, as they have none) * Be less keen to suspend writing FFT data in spectrogram repaint -- only do it if we find we actually need to query the FFT data (i.e. we aren't repainting an area that hasn't been generated at all yet)
author Chris Cannam
date Tue, 10 Oct 2006 19:04:57 +0000
parents dc2fe023a14f
children 48182241f594
comparison
equal deleted inserted replaced
161:dc2fe023a14f 162:f32212631b9c
1955 } 1955 }
1956 1956
1957 MagnitudeRange overallMag = m_viewMags[v]; 1957 MagnitudeRange overallMag = m_viewMags[v];
1958 bool overallMagChanged = false; 1958 bool overallMagChanged = false;
1959 1959
1960 fft->suspendWrites(); 1960 bool fftSuspended = false;
1961 1961
1962 #ifdef DEBUG_SPECTROGRAM_REPAINT 1962 #ifdef DEBUG_SPECTROGRAM_REPAINT
1963 std::cerr << (float(v->getFrameForX(1) - v->getFrameForX(0)) / increment) << " bins per pixel" << std::endl; 1963 std::cerr << (float(v->getFrameForX(1) - v->getFrameForX(0)) / increment) << " bins per pixel" << std::endl;
1964 #endif 1964 #endif
1965 1965
1990 } 1990 }
1991 1991
1992 for (int s = s0i; s <= s1i; ++s) { 1992 for (int s = s0i; s <= s1i; ++s) {
1993 1993
1994 if (!fft->isColumnAvailable(s)) continue; 1994 if (!fft->isColumnAvailable(s)) continue;
1995
1996 if (!fftSuspended) {
1997 fft->suspendWrites();
1998 fftSuspended = true;
1999 }
2000
1995 MagnitudeRange mag; 2001 MagnitudeRange mag;
1996 2002
1997 for (size_t q = minbin; q < bins; ++q) { 2003 for (size_t q = minbin; q < bins; ++q) {
1998 2004
1999 float y0 = yval[q + 1]; 2005 float y0 = yval[q + 1];
2147 2153
2148 #ifdef DEBUG_SPECTROGRAM_REPAINT 2154 #ifdef DEBUG_SPECTROGRAM_REPAINT
2149 std::cerr << "SpectrogramLayer::paint() returning" << std::endl; 2155 std::cerr << "SpectrogramLayer::paint() returning" << std::endl;
2150 #endif 2156 #endif
2151 2157
2152 fft->resume(); 2158 if (fftSuspended) fft->resume();
2153 } 2159 }
2154 2160
2155 void 2161 void
2156 SpectrogramLayer::illuminateLocalFeatures(View *v, QPainter &paint) const 2162 SpectrogramLayer::illuminateLocalFeatures(View *v, QPainter &paint) const
2157 { 2163 {