From 849876a349cea0dedaabc08ee3a051b3726abb25 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 8 Apr 2022 16:47:31 +0200 Subject: [PATCH] hook-rms: fix integration error. previously using the next value to update accumulator --- lib/hooks/rms.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hooks/rms.cpp b/lib/hooks/rms.cpp index 09699f761..3f85de5a8 100644 --- a/lib/hooks/rms.cpp +++ b/lib/hooks/rms.cpp @@ -102,12 +102,12 @@ public: /* Square the new value */ double newValue = pow(smp->data[index].f, 2); + /* Get the old value from the history */ + double oldValue = smpMemory[i][smpMemoryPosition % windowSize]; + /* Append the new value to the history memory */ smpMemory[i][smpMemoryPosition % windowSize] = newValue; - /* Get the old value from the history */ - double oldValue = smpMemory[i][(smpMemoryPosition + 1) % windowSize]; - /* Update the accumulator */ accumulator[index] += newValue; accumulator[index] -= oldValue;