Skip to content

Commit

Permalink
prevent extra redraws on meter
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzawa-san committed Oct 14, 2024
1 parent 85cbc66 commit 38be7ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/qtgui/meter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,14 @@ QSize CMeter::sizeHint() const

void CMeter::setLevel(float dbfs)
{
const float old = m_dBFS;
float alpha = dbfs < m_dBFS ? ALPHA_DECAY : ALPHA_RISE;
m_dBFS -= alpha * (m_dBFS - dbfs);
update();
// only redraw when the label needs to change
if (qRound(m_dBFS * 10) != qRound(old * 10))
{
update();
}
}

void CMeter::setSqlLevel(float dbfs)
Expand Down

0 comments on commit 38be7ce

Please sign in to comment.