| 91 | void setCeilingSetter(CeilingSetter fn) { m_setCeiling = std::move(fn); } |
| 92 | |
| 93 | void setLevels(float inPeakDb, float outPeakDb, float rawOutPeakDb, |
| 94 | float grDb, float ceilingDb) { |
| 95 | m_inPeakDb = inPeakDb; |
| 96 | m_outPeakDb = outPeakDb; |
| 97 | m_grDb = grDb; |
| 98 | m_ceilingDb = ceilingDb; |
| 99 | // Peak-hold: track the highest *raw* engine block-peak in a |
| 100 | // 1.5 s window via a millisecond timestamp. Reading the raw |
| 101 | // value (not the panel's smoothed display) catches single |
| 102 | // fast clamps that would otherwise get averaged out before |
| 103 | // the bar renders. |
| 104 | const qint64 nowMs = QDateTime::currentMSecsSinceEpoch(); |
| 105 | if (rawOutPeakDb > m_holdDb || nowMs >= m_holdUntilMs) { |
| 106 | if (rawOutPeakDb > m_holdDb) { |
| 107 | m_holdDb = rawOutPeakDb; |
| 108 | m_holdUntilMs = nowMs + 1500; |
| 109 | } else { |
| 110 | m_holdDb = rawOutPeakDb; // expired — track current |
| 111 | } |
| 112 | } |
| 113 | update(); |
| 114 | } |
| 115 | |
| 116 | protected: |
| 117 | QRectF barRect() const { |