summaryrefslogtreecommitdiff
path: root/libs/ardour/kmeterdsp.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2013-07-16 16:25:27 +0200
committerRobin Gareus <robin@gareus.org>2013-07-16 16:25:27 +0200
commita716f3c55a0bae667977545c3d190f6f78f4db72 (patch)
tree7ce4cd23f514f0875a86208b666d0f2f5e421b0d /libs/ardour/kmeterdsp.cc
parente9289a19c8101ea584167d468748d2499664bc03 (diff)
RMS meter - reset after calculating new data
Diffstat (limited to 'libs/ardour/kmeterdsp.cc')
-rw-r--r--libs/ardour/kmeterdsp.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/libs/ardour/kmeterdsp.cc b/libs/ardour/kmeterdsp.cc
index 77d1a87a81..afd0f71719 100644
--- a/libs/ardour/kmeterdsp.cc
+++ b/libs/ardour/kmeterdsp.cc
@@ -46,12 +46,6 @@ void Kmeterdsp::process (float *p, int n)
float s, t, z1, z2;
- if (_flag) // Display thread has read the rms value.
- {
- _rms = 0;
- _flag = false;
- }
-
// Get filter state.
z1 = _z1;
z2 = _z2;
@@ -88,9 +82,18 @@ void Kmeterdsp::process (float *p, int n)
_z1 = z1 + 1e-20f;
_z2 = z2 + 1e-20f;
- // Adjust RMS value and update maximum since last read().
s = sqrtf (2 * z2);
- if (s > _rms) _rms = s;
+
+ if (_flag) // Display thread has read the rms value.
+ {
+ _rms = s;
+ _flag = false;
+ }
+ else
+ {
+ // Adjust RMS value and update maximum since last read().
+ if (s > _rms) _rms = s;
+ }
}