Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 41:f2c416cbdaa9
* Add time/Hz description for waveform model to the bottom right of a pane
containing a waveform (also tried this in the status bar, wasn't so good)
* Further spectrogram fixes
author | Chris Cannam |
---|---|
date | Fri, 24 Feb 2006 17:26:11 +0000 |
parents | 3be4438b186d |
children | 1bdf285c4eac |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Fri Feb 24 15:46:47 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Fri Feb 24 17:26:11 2006 +0000 @@ -70,7 +70,7 @@ setMaxFrequency(2000); setMinFrequency(40); setFrequencyScale(LogFrequencyScale); - setColourScale(dBColourScale); + setColourScale(MeterColourScale); setBinDisplay(PeakFrequencies); setNormalizeColumns(true); } @@ -1221,6 +1221,8 @@ m_width = width; m_height = height; + + std::cerr << "done, width = " << m_width << " height = " << m_height << std::endl; } void @@ -1296,6 +1298,8 @@ size_t start = m_layer.m_model->getStartFrame(); size_t end = m_layer.m_model->getEndFrame(); + std::cerr << "start = " << start << ", end = " << end << std::endl; + WindowType windowType = m_layer.m_windowType; size_t windowSize = m_layer.m_windowSize; size_t windowIncrement = m_layer.getWindowIncrement(); @@ -1533,7 +1537,9 @@ int f0 = getFrameForX(x) - modelStart; int f1 = getFrameForX(x + 1) - modelStart - 1; - if (f1 < int(modelStart) || f0 > int(modelEnd)) return false; + if (f1 < int(modelStart) || f0 > int(modelEnd)) { + return false; + } // And that range may be drawn from a possibly non-integral // range of spectrogram windows: @@ -1864,7 +1870,7 @@ // std::cerr << "x0 " << x0 << ", x1 " << x1 << ", w " << w << ", h " << h << std::endl; QImage scaled(w, h, QImage::Format_RGB32); - scaled.fill(0); + scaled.fill(m_cache->getColour(0).rgb()); float ymag[h]; float ydiv[h]; @@ -1910,9 +1916,6 @@ if (!getXBinRange(x0 + x, s0, s1)) { assert(x <= scaled.width()); - for (int y = 0; y < h; ++y) { - scaled.setPixel(x, y, qRgb(0, 0, 0)); - } m_mutex.unlock(); continue; } @@ -2338,7 +2341,9 @@ if (n == 1 || n == 3 || n == 6 || n == 8 || n == 10) { // black notes paint.drawLine(w - pkw, y, w, y); - paint.drawRect(w - pkw, y - (py-y)/4, pkw/2, 2*((py-y)/4)); + int rh = ((py - y) / 4) * 2; + if (rh < 2) rh = 2; + paint.drawRect(w - pkw, y - (py-y)/4, pkw/2, rh); } else if (n == 0 || n == 5) { // C, A if (py < h) {