diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-06-18 21:16:28 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-06-18 21:16:28 -0500 |
| commit | 528e50684d9c57d7733d60b84461babaee6c321b (patch) | |
| tree | 2e366fa92de5e3b163b3c4ecba053155dba07e4d | |
| parent | e92f43d3369a6d5cf78cc3f79ad1660c545be793 (diff) | |
| download | slskd-528e50684d9c57d7733d60b84461babaee6c321b.tar.gz | |
add Reset()
| -rw-r--r-- | src/slskd/Common/ExponentialMovingAverage.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/slskd/Common/ExponentialMovingAverage.cs b/src/slskd/Common/ExponentialMovingAverage.cs index aaa6e5ea..6bc773cb 100644 --- a/src/slskd/Common/ExponentialMovingAverage.cs +++ b/src/slskd/Common/ExponentialMovingAverage.cs @@ -73,6 +73,16 @@ namespace slskd private Action<double> OnUpdate { get; } /// <summary> + /// Resets the value. + /// </summary> + public void Reset() + { + Value = 0; + Initialized = false; + OnUpdate?.Invoke(Value); + } + + /// <summary> /// Updates the average with a new value. /// </summary> /// <param name="value"></param> |
