diff --git a/docs/modules/ROOT/pages/reference/misc/dynamic_smoother.adoc b/docs/modules/ROOT/pages/reference/misc/dynamic_smoother.adoc index 9bb57f32..2988c634 100644 --- a/docs/modules/ROOT/pages/reference/misc/dynamic_smoother.adoc +++ b/docs/modules/ROOT/pages/reference/misc/dynamic_smoother.adoc @@ -27,19 +27,20 @@ Notice that, compared to the one-pole lowpass filter, the dynamic smoother respo ```c++ struct dynamic_smoother { - dynamic_smoother( - frequency base - , float sps - ); - - dynamic_smoother( - frequency base - , float sensitivity - , float sps - ); - - float operator()(float s); - void base_frequency(frequency base, float sps); + dynamic_smoother( + frequency base + , float sps + ); + + dynamic_smoother( + frequency base + , float sensitivity + , float sps + ); + + float operator()(float s); + dynamic_smoother& operator=(float y); + void base_frequency(frequency base, float sps); }; ``` @@ -67,6 +68,7 @@ Notice that, compared to the one-pole lowpass filter, the dynamic smoother respo In this case, the sensitivity is set to 0.5. | `dynamic_smoother(b)` | Copy construct a `dynamic_smoother` from `b`. | `a = b` | Assign `b` to `a`. +| `a = s` | Set the latest result to `s`. |=== NOTE: C++ brace initialization may also be used. diff --git a/q_lib/include/q/fx/lowpass.hpp b/q_lib/include/q/fx/lowpass.hpp index f2fa96b5..811e6309 100755 --- a/q_lib/include/q/fx/lowpass.hpp +++ b/q_lib/include/q/fx/lowpass.hpp @@ -241,6 +241,12 @@ namespace cycfi::q return low2; } + dynamic_smoother& operator=(float y) + { + low1 = low2 = y; + return *this; + } + void base_frequency(frequency base, float sps) { wc = as_double(base) / sps;