summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-11-02 15:27:48 +0100
committerStanislaw Halik <sthalik@misaki.pl>2021-11-02 15:28:15 +0100
commitc99692bf76ccc6798181ec13547f45f1f8430b78 (patch)
treebbe75fc6830e32d41f3ad39212c9dc7643f9fdc9
parent469eff22db856b778a8c06f7bff42dbb2cb6385c (diff)
tracker/pt: clamp max filter gain
-rw-r--r--tracker-pt/point-filter.cpp3
1 files changed, 2 insertions, 1 deletions
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]);
}