Skip to content

Commit e0f5835

Browse files
committed
Add operator= to dynamic_smoother
1 parent c09fda1 commit e0f5835

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

docs/modules/ROOT/pages/reference/misc/dynamic_smoother.adoc

+15-13
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@ Notice that, compared to the one-pole lowpass filter, the dynamic smoother respo
2727
```c++
2828
struct dynamic_smoother
2929
{
30-
dynamic_smoother(
31-
frequency base
32-
, float sps
33-
);
34-
35-
dynamic_smoother(
36-
frequency base
37-
, float sensitivity
38-
, float sps
39-
);
40-
41-
float operator()(float s);
42-
void base_frequency(frequency base, float sps);
30+
dynamic_smoother(
31+
frequency base
32+
, float sps
33+
);
34+
35+
dynamic_smoother(
36+
frequency base
37+
, float sensitivity
38+
, float sps
39+
);
40+
41+
float operator()(float s);
42+
dynamic_smoother& operator=(float y);
43+
void base_frequency(frequency base, float sps);
4344
};
4445
```
4546

@@ -67,6 +68,7 @@ Notice that, compared to the one-pole lowpass filter, the dynamic smoother respo
6768
In this case, the sensitivity is set to 0.5.
6869
| `dynamic_smoother(b)` | Copy construct a `dynamic_smoother` from `b`.
6970
| `a = b` | Assign `b` to `a`.
71+
| `a = s` | Set the latest result to `s`.
7072
|===
7173

7274
NOTE: C++ brace initialization may also be used.

q_lib/include/q/fx/lowpass.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ namespace cycfi::q
241241
return low2;
242242
}
243243

244+
dynamic_smoother& operator=(float y)
245+
{
246+
low1 = low2 = y;
247+
return *this;
248+
}
249+
244250
void base_frequency(frequency base, float sps)
245251
{
246252
wc = as_double(base) / sps;

0 commit comments

Comments
 (0)