From 06642fdee48477ab85f89ff670f105affe402df7 Mon Sep 17 00:00:00 2001 From: Norihiro Kamae Date: Thu, 29 Aug 2024 10:40:39 +0900 Subject: [PATCH] UI: Fix low value of std::clamp gets greater than high value `std::clamp` was introduced at 60a45d3aa3 but it caused a runtime assertion failure on Windows that checks the low value of `std::clamp` is not greater than the high value. --- UI/volume-control.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/volume-control.cpp b/UI/volume-control.cpp index 25ad2048404bd3..5d74e2c7a6cf99 100644 --- a/UI/volume-control.cpp +++ b/UI/volume-control.cpp @@ -1008,7 +1008,7 @@ VolumeMeter::calculateBallisticsForChannel(int channelNr, uint64_t ts, float decay = float(peakDecayRate * timeSinceLastRedraw); displayPeak[channelNr] = std::clamp(displayPeak[channelNr] - decay, - currentPeak[channelNr], 0.f); + std::min(currentPeak[channelNr], 0.f), 0.f); } if (currentPeak[channelNr] >= displayPeakHold[channelNr] ||