Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 682:1a0dfcbffaf1
Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 14:06:40 +0000 |
parents | d632a1e87018 |
children | 8072264dc61f |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Tue Nov 26 11:16:45 2013 +0000 +++ b/layer/SpectrogramLayer.cpp Tue Nov 26 14:06:40 2013 +0000 @@ -40,8 +40,8 @@ #include <iostream> -using std::cerr; -using std::endl; + + #include <cassert> #include <cmath> @@ -127,7 +127,7 @@ void SpectrogramLayer::setModel(const DenseTimeValueModel *model) { -// std::cerr << "SpectrogramLayer(" << this << "): setModel(" << model << ")" << std::endl; +// cerr << "SpectrogramLayer(" << this << "): setModel(" << model << ")" << endl; if (model == m_model) return; @@ -584,16 +584,16 @@ << v->getStartFrame() << ", " << v->getEndFrame() << endl; - std::cerr << "Valid area was: " << i->second.validArea.x() << ", " + cerr << "Valid area was: " << i->second.validArea.x() << ", " << i->second.validArea.y() << " " << i->second.validArea.width() << "x" - << i->second.validArea.height() << std::endl; + << i->second.validArea.height() << endl; #endif if (long(startFrame) > v->getStartFrame()) { if (startFrame >= v->getEndFrame()) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Modified start frame is off right of view" << std::endl; + cerr << "Modified start frame is off right of view" << endl; #endif return; } @@ -610,7 +610,7 @@ } else { if (long(endFrame) < v->getStartFrame()) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Modified end frame is off left of view" << std::endl; + cerr << "Modified end frame is off left of view" << endl; #endif return; } @@ -628,10 +628,10 @@ } #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Valid area is now: " << i->second.validArea.x() << ", " + cerr << "Valid area is now: " << i->second.validArea.x() << ", " << i->second.validArea.y() << " " << i->second.validArea.width() << "x" - << i->second.validArea.height() << std::endl; + << i->second.validArea.height() << endl; #endif } } @@ -1067,7 +1067,7 @@ if (fill >= lastFill) { if (fill >= m_model->getEndFrame() && lastFill > 0) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "complete!" << std::endl; + cerr << "complete!" << endl; #endif invalidateImageCaches(); i->second.second = -1; @@ -1075,8 +1075,8 @@ } else if (fill > lastFill) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: emitting modelChanged(" - << lastFill << "," << fill << ")" << std::endl; + cerr << "SpectrogramLayer: emitting modelChanged(" + << lastFill << "," << fill << ")" << endl; #endif invalidateImageCaches(lastFill, fill); i->second.second = fill; @@ -1084,8 +1084,8 @@ } } else { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: going backwards, emitting modelChanged(" - << m_model->getStartFrame() << "," << m_model->getEndFrame() << ")" << std::endl; + cerr << "SpectrogramLayer: going backwards, emitting modelChanged(" + << m_model->getStartFrame() << "," << m_model->getEndFrame() << ")" << endl; #endif invalidateImageCaches(); i->second.second = fill; @@ -1100,7 +1100,7 @@ if (allDone) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: all complete!" << std::endl; + cerr << "SpectrogramLayer: all complete!" << endl; #endif delete m_updateTimer; m_updateTimer = 0; @@ -1674,7 +1674,7 @@ if (!m_sliceableModel) { #ifdef DEBUG_SPECTROGRAM - std::cerr << "SpectrogramLayer: emitting sliceableModelReplaced(0, " << model << ")" << std::endl; + cerr << "SpectrogramLayer: emitting sliceableModelReplaced(0, " << model << ")" << endl; #endif ((SpectrogramLayer *)this)->sliceableModelReplaced(0, model); m_sliceableModel = model; @@ -1730,7 +1730,7 @@ m_peakCaches.clear(); if (m_sliceableModel) { - std::cerr << "SpectrogramLayer: emitting sliceableModelReplaced(" << m_sliceableModel << ", 0)" << std::endl; + cerr << "SpectrogramLayer: emitting sliceableModelReplaced(" << m_sliceableModel << ", 0)" << endl; emit sliceableModelReplaced(m_sliceableModel, 0); m_sliceableModel = 0; } @@ -1805,7 +1805,7 @@ #ifdef DEBUG_SPECTROGRAM_REPAINT SVDEBUG << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << endl; - std::cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << std::endl; + cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << endl; #endif long startFrame = v->getStartFrame(); @@ -1831,7 +1831,7 @@ /* FFTModel *fft = getFFTModel(v); if (!fft) { - std::cerr << "ERROR: SpectrogramLayer::paint(): No FFT model, returning" << std::endl; + cerr << "ERROR: SpectrogramLayer::paint(): No FFT model, returning" << endl; return; } */ @@ -1859,7 +1859,7 @@ x1 = rect.right() + 1; /* float xPixelRatio = float(fft->getResolution()) / float(zoomLevel); - std::cerr << "xPixelRatio = " << xPixelRatio << std::endl; + cerr << "xPixelRatio = " << xPixelRatio << endl; if (xPixelRatio < 1.f) xPixelRatio = 1.f; */ if (cache.validArea.width() > 0) { @@ -1877,7 +1877,7 @@ cache.validArea.x() + cache.validArea.width() >= x1) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: image cache good" << std::endl; + cerr << "SpectrogramLayer: image cache good" << endl; #endif paint.drawImage(rect, cache.image, rect); @@ -1891,7 +1891,7 @@ } else { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: image cache partially OK" << std::endl; + cerr << "SpectrogramLayer: image cache partially OK" << endl; #endif recreateWholeImageCache = false; @@ -1900,7 +1900,7 @@ v->getXForFrame(startFrame); #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: dx = " << dx << " (image cache " << cw << "x" << ch << ")" << std::endl; + cerr << "SpectrogramLayer: dx = " << dx << " (image cache " << cw << "x" << ch << ")" << endl; #endif if (dx != 0 && @@ -1946,10 +1946,10 @@ pw, cache.validArea.height()); #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "valid area now " + cerr << "valid area now " << px << "," << cache.validArea.y() << " " << pw << "x" << cache.validArea.height() - << std::endl; + << endl; #endif /* paint.drawImage(rect & cache.validArea, @@ -1961,7 +1961,7 @@ // we scrolled too far to be of use #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "dx == " << dx << ": scrolled too far for cache to be useful" << std::endl; + cerr << "dx == " << dx << ": scrolled too far for cache to be useful" << endl; #endif cache.validArea = QRect(); @@ -1970,17 +1970,17 @@ } } else { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: image cache useless" << std::endl; + cerr << "SpectrogramLayer: image cache useless" << endl; if (int(cache.zoomLevel) != zoomLevel) { - std::cerr << "(cache zoomLevel " << cache.zoomLevel - << " != " << zoomLevel << ")" << std::endl; + cerr << "(cache zoomLevel " << cache.zoomLevel + << " != " << zoomLevel << ")" << endl; } if (cw != v->width()) { - std::cerr << "(cache width " << cw + cerr << "(cache width " << cw << " != " << v->width(); } if (ch != v->height()) { - std::cerr << "(cache height " << ch + cerr << "(cache height " << ch << " != " << v->height(); } #endif @@ -1991,7 +1991,7 @@ if (updateViewMagnitudes(v)) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "SpectrogramLayer: magnitude range changed to [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << std::endl; + cerr << "SpectrogramLayer: magnitude range changed to [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl; #endif if (m_normalizeVisibleArea) { cache.validArea = QRect(); @@ -1999,7 +1999,7 @@ } } else { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "No change in magnitude range [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << std::endl; + cerr << "No change in magnitude range [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl; #endif } @@ -2040,7 +2040,7 @@ } #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "[" << this << "]: last paint width: " << m_lastPaintBlockWidth << ", last paint time: " << m_lastPaintTime << ", new paint width: " << paintBlockWidth << std::endl; + cerr << "[" << this << "]: last paint width: " << m_lastPaintBlockWidth << ", last paint time: " << m_lastPaintTime << ", new paint width: " << paintBlockWidth << endl; #endif // We always paint the full height when refreshing the cache. @@ -2065,7 +2065,7 @@ vx1 = cache.validArea.x() + cache.validArea.width(); #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "x0 " << x0 << ", x1 " << x1 << ", vx0 " << vx0 << ", vx1 " << vx1 << ", paintBlockWidth " << paintBlockWidth << std::endl; + cerr << "x0 " << x0 << ", x1 " << x1 << ", vx0 " << vx0 << ", vx1 " << vx1 << ", paintBlockWidth " << paintBlockWidth << endl; #endif if (x0 < vx0) { if (x0 + paintBlockWidth < vx0) { @@ -2096,10 +2096,10 @@ cache.validArea.height()); #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Valid area becomes " << cache.validArea.x() + cerr << "Valid area becomes " << cache.validArea.x() << ", " << cache.validArea.y() << ", " << cache.validArea.width() << "x" - << cache.validArea.height() << std::endl; + << cache.validArea.height() << endl; #endif } else { @@ -2116,8 +2116,8 @@ } } #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Valid area becomes " << x0 << ", 0, " << (x1-x0) - << "x" << h << std::endl; + cerr << "Valid area becomes " << x0 << ", 0, " << (x1-x0) + << "x" << h << endl; #endif cache.validArea = QRect(x0, 0, x1 - x0, h); } @@ -2131,7 +2131,7 @@ int w = x1 - x0; #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "x0 " << x0 << ", x1 " << x1 << ", w " << w << ", h " << h << std::endl; + cerr << "x0 " << x0 << ", x1 " << x1 << ", w " << w << ", h " << h << endl; #endif int sr = m_model->getSampleRate(); @@ -2156,7 +2156,7 @@ size_t minbin = 1; if (m_minFrequency > 0) { minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.001); -// std::cerr << "m_minFrequency = " << m_minFrequency << " -> minbin = " << minbin << std::endl; +// cerr << "m_minFrequency = " << m_minFrequency << " -> minbin = " << minbin << endl; if (minbin < 1) minbin = 1; if (minbin >= maxbin) minbin = maxbin - 1; } @@ -2176,7 +2176,7 @@ displayMaxFreq = getEffectiveMaxFrequency(); } -// std::cerr << "(giving actual minFreq " << minFreq << " and display minFreq " << displayMinFreq << ")" << std::endl; +// cerr << "(giving actual minFreq " << minFreq << " and display minFreq " << displayMinFreq << ")" << endl; int increment = getWindowIncrement(); @@ -2197,7 +2197,7 @@ bool fftSuspended = false; #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << ((float(v->getFrameForX(1) - v->getFrameForX(0))) / increment) << " bin(s) per pixel" << std::endl; + cerr << ((float(v->getFrameForX(1) - v->getFrameForX(0))) / increment) << " bin(s) per pixel" << endl; #endif bool runOutOfData = false; @@ -2337,24 +2337,24 @@ if (runOutOfData) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Run out of data -- dropping out of loop" << std::endl; + cerr << "Run out of data -- dropping out of loop" << endl; #endif break; } } */ #ifdef DEBUG_SPECTROGRAM_REPAINT -// std::cerr << pixels << " pixels drawn" << std::endl; +// cerr << pixels << " pixels drawn" << endl; #endif if (overallMagChanged) { m_viewMags[v] = overallMag; #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Overall mag is now [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "] - will be updating" << std::endl; + cerr << "Overall mag is now [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "] - will be updating" << endl; #endif } else { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Overall mag unchanged at [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << std::endl; + cerr << "Overall mag unchanged at [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << endl; #endif } @@ -2464,7 +2464,7 @@ } } else { // overallMagChanged - std::cerr << "\noverallMagChanged - updating all\n" << std::endl; + cerr << "\noverallMagChanged - updating all\n" << endl; cache.validArea = QRect(); v->update(); } @@ -2540,7 +2540,7 @@ if (!m_synchronous) { if (!fft->isColumnAvailable(sx)) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Met unavailable column at col " << sx << std::endl; + cerr << "Met unavailable column at col " << sx << endl; #endif return false; } @@ -2592,10 +2592,10 @@ if (mag.isSet()) { if (sx >= int(m_columnMags.size())) { #ifdef DEBUG_SPECTROGRAM - std::cerr << "INTERNAL ERROR: " << sx << " >= " + cerr << "INTERNAL ERROR: " << sx << " >= " << m_columnMags.size() << " at SpectrogramLayer.cpp::paintDrawBuffer" - << std::endl; + << endl; #endif } else { m_columnMags[sx].sample(mag); @@ -2689,7 +2689,7 @@ for (int sx = sx0; sx < sx1; ++sx) { #ifdef DEBUG_SPECTROGRAM_REPAINT -// std::cerr << "sx = " << sx << std::endl; +// cerr << "sx = " << sx << endl; #endif if (sx < 0 || sx >= int(sourceModel->getWidth())) continue; @@ -2697,7 +2697,7 @@ if (!m_synchronous) { if (!sourceModel->isColumnAvailable(sx)) { #ifdef DEBUG_SPECTROGRAM_REPAINT - std::cerr << "Met unavailable column at col " << sx << std::endl; + cerr << "Met unavailable column at col " << sx << endl; #endif return false; } @@ -2805,10 +2805,10 @@ if (mag.isSet()) { if (sx >= int(m_columnMags.size())) { #ifdef DEBUG_SPECTROGRAM - std::cerr << "INTERNAL ERROR: " << sx << " >= " + cerr << "INTERNAL ERROR: " << sx << " >= " << m_columnMags.size() << " at SpectrogramLayer.cpp::paintDrawBuffer" - << std::endl; + << endl; #endif } else { m_columnMags[sx].sample(mag); @@ -2846,8 +2846,8 @@ return; } -// std::cerr << "SpectrogramLayer: illuminateLocalFeatures(" -// << localPos.x() << "," << localPos.y() << ")" << std::endl; +// cerr << "SpectrogramLayer: illuminateLocalFeatures(" +// << localPos.x() << "," << localPos.y() << ")" << endl; float s0, s1; float f0, f1; @@ -2864,8 +2864,8 @@ int y1 = int(getYForFrequency(v, f1)); int y0 = int(getYForFrequency(v, f0)); -// std::cerr << "SpectrogramLayer: illuminate " -// << x0 << "," << y1 << " -> " << x1 << "," << y0 << std::endl; +// cerr << "SpectrogramLayer: illuminate " +// << x0 << "," << y1 << " -> " << x1 << "," << y0 << endl; paint.setPen(v->getForeground()); @@ -3006,8 +3006,8 @@ { ImageCache &cache = m_imageCaches[v]; - std::cerr << "cache width: " << cache.image.width() << ", height: " - << cache.image.height() << std::endl; + cerr << "cache width: " << cache.image.width() << ", height: " + << cache.image.height() << endl; QImage image = cache.image; @@ -3584,7 +3584,7 @@ float dmin = m_minFrequency, dmax = m_maxFrequency; // getDisplayExtents(dmin, dmax); -// std::cerr << "current range " << dmin << " -> " << dmax << ", range " << dmax-dmin << ", mid " << (dmax + dmin)/2 << std::endl; +// cerr << "current range " << dmin << " -> " << dmax << ", range " << dmax-dmin << ", mid " << (dmax + dmin)/2 << endl; int sr = m_model->getSampleRate(); SpectrogramRangeMapper mapper(sr, m_fftSize); @@ -3618,7 +3618,7 @@ newmax = (newdist + sqrtf(newdist*newdist + 4*dmin*dmax)) / 2; newmin = newmax - newdist; -// std::cerr << "newmin = " << newmin << ", newmax = " << newmax << std::endl; +// cerr << "newmin = " << newmin << ", newmax = " << newmax << endl; } else { float dmid = (dmax + dmin) / 2;