A simple class for filtering values. Single exponential smoothing with different factors for increasing and decreasing values.
Similar to LagUD. See RedSlide for another implementation.
Create a new filter.
factorUp |
Smoothing for increasing values. Less is more. |
factorDown |
Smoothing for decreasing values. Less is more. |
initVal |
The initial value. |
Note that a factor of 0.0
will 'freeze' the filter, and factors above 1.0
will be unstable - overshoot, ring and even start to oscillate.
Dynamically set how much smoothing for increasing values.
Dynamically set how much smoothing for decreasing values.
Perform the smoothing.
Get or set the current value.