From c99692bf76ccc6798181ec13547f45f1f8430b78 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 2 Nov 2021 15:27:48 +0100 Subject: tracker/pt: clamp max filter gain --- tracker-pt/point-filter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tracker-pt/point-filter.cpp b/tracker-pt/point-filter.cpp index f031940b..652c099e 100644 --- a/tracker-pt/point-filter.cpp +++ b/tracker-pt/point-filter.cpp @@ -31,6 +31,7 @@ const PointOrder& point_filter::operator()(const PointOrder& input) } constexpr f E = (f)1.75; + constexpr f max = .25; const f C = progn( constexpr int A = 1'000'000; double K = *s.point_filter_coefficient; @@ -57,7 +58,7 @@ const PointOrder& point_filter::operator()(const PointOrder& input) for (unsigned i = 0; i < 3; i++) { - f x = std::clamp(delta, (f)0, (f)1); + f x = std::clamp(delta, (f)0, max); state_[i] += x*(input[i] - state_[i]); } -- cgit v1.2.3