# HG changeset patch # User Chris Cannam # Date 1529932576 -3600 # Node ID 21342513c252a81b2335acfc604b3c0b681fa79b # Parent a575dae05fbfb27884b157775efa00cc70796e4f Slightly nicer pan handling, avoiding showing spurious >0dB peaks diff -r a575dae05fbf -r 21342513c252 widgets/LevelPanWidget.cpp --- a/widgets/LevelPanWidget.cpp Fri Jun 22 17:51:47 2018 +0100 +++ b/widgets/LevelPanWidget.cpp Mon Jun 25 14:16:16 2018 +0100 @@ -146,7 +146,6 @@ } update(); } - SVCERR << "setLevel: level " << level << " -> notch " << m_notch << " (which converts back to level " << getLevel() << ")" << endl; } float @@ -490,24 +489,36 @@ if (monitoring) { paint.setPen(Qt::NoPen); + for (int pan = -maxPan; pan <= maxPan; ++pan) { - float audioPan = panToAudioPan(pan); - float audioLevel; - if (audioPan < 0.f) { - audioLevel = m_monitorLeft + m_monitorRight * (1.f + audioPan); - } else { - audioLevel = m_monitorRight + m_monitorLeft * (1.f - audioPan); - } + float rprop = float(pan - (-maxPan)) / float(maxPan * 2); + float lprop = float(maxPan - pan) / float(maxPan * 2); + float audioLevel = + lprop * m_monitorLeft * m_monitorLeft + + rprop * m_monitorRight * m_monitorRight; int notchHere = audioLevelToNotch(audioLevel); + for (int notch = 1; notch <= notchHere; notch += 2) { + paint.setBrush(notchToColour(notch)); QRectF clr = cellLightRect(rect, (notch-1)/2, pan); - double adj = thinLineWidth(rect)/2; - clr = clr.adjusted(adj, adj, -adj, -adj); +// double adj = thinLineWidth(rect)/2; +// clr = clr.adjusted(adj, adj, -adj, -adj); + paint.drawRoundedRect(clr, radius, radius); + if (notch + 2 > notchHere && notchHere % 2 != 0) { - paint.drawPie(clr, 180 * 16, 180 * 16); - } else { - paint.drawEllipse(clr); + paint.save(); + paint.setBrush(columnBackground); + paint.drawRoundedRect(QRectF(clr.x(), + clr.y()-0.5, + clr.width(), + clr.height()/4 + thin), + radius, radius); + paint.drawRect(QRectF(clr.x(), + clr.y() + clr.height()/4 - thin, + clr.width(), + clr.height()/4 + thin)); + paint.restore(); } } }