diff layer/SliceLayer.cpp @ 254:a2ae3d93c645

* bit of work on harmonic cursor in spectrum
author Chris Cannam
date Mon, 11 Jun 2007 12:14:52 +0000
parents 28c8e8e3c537
children b9380f679f70
line wrap: on
line diff
--- a/layer/SliceLayer.cpp	Fri Jun 08 15:19:50 2007 +0000
+++ b/layer/SliceLayer.cpp	Mon Jun 11 12:14:52 2007 +0000
@@ -36,7 +36,6 @@
     m_plotStyle(PlotSteps),
     m_binScale(LinearBins),
     m_normalize(false),
-    m_bias(false),
     m_gain(1.0),
     m_currentf0(0),
     m_currentf1(0)
@@ -229,7 +228,8 @@
 void
 SliceLayer::paint(View *v, QPainter &paint, QRect rect) const
 {
-    if (!m_sliceableModel) return;
+    if (!m_sliceableModel || !m_sliceableModel->isOK() ||
+        !m_sliceableModel->isReady()) return;
 
     paint.save();
     paint.setRenderHint(QPainter::Antialiasing, false);
@@ -287,10 +287,14 @@
     m_currentf0 = f0;
     m_currentf1 = f1;
 
+    BiasCurve curve;
+    getBiasCurve(curve);
+    size_t cs = curve.size();
+
     for (size_t col = col0; col <= col1; ++col) {
         for (size_t bin = 0; bin < mh; ++bin) {
             float value = m_sliceableModel->getValueAt(col, bin);
-            if (m_bias) value *= bin + 1;
+            if (bin < cs) value *= curve[bin];
             if (m_samplingMode == SamplePeak) {
                 if (value > m_values[bin]) m_values[bin] = value;
             } else {