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;