From c236a2e1cb404e9560f7a7ea6f1f75c53e041464 Mon Sep 17 00:00:00 2001 From: vsonnier Date: Wed, 1 Jun 2016 20:00:21 +0200 Subject: [PATCH] Fix limitless manual gain slider --- src/visual/GainCanvas.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/visual/GainCanvas.cpp b/src/visual/GainCanvas.cpp index f58661b..a7c5240 100644 --- a/src/visual/GainCanvas.cpp +++ b/src/visual/GainCanvas.cpp @@ -164,6 +164,15 @@ void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) { gInfo = gainInfo[panelHit]; gInfo->current = gInfo->current + ((movement / 100.0) * ((gInfo->high - gInfo->low) / 100.0)); + + //BEGIN Clamp to prevent the meter to escape + if (gInfo->current > gInfo->high) { + gInfo->current = gInfo->high; + } + if (gInfo->current < gInfo->low) { + gInfo->current = gInfo->low; + } + gInfo->changed = true; float levelVal = float(gInfo->current-gInfo->low)/float(gInfo->high-gInfo->low);