From a2eed42dec7cb76ad787eccaad6ffa800d945e24 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 27 Feb 2013 22:43:00 +0000 Subject: [PATCH] Fix drift in RMS smoothing; plot the centre of the window at its point, rather than the end. --- src/wx/audio_plot.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 9b2e6b1b0..2098adb40 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -227,8 +227,9 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const } p = sqrt (p / smoothing.size ()); - - path.AddLineToPoint (_db_label_width + i * _x_scale, y_for_linear (p)); + + int const ind = max (0, i - int(smoothing.size() / 2)); + path.AddLineToPoint (_db_label_width + ind * _x_scale, y_for_linear (p)); } } -- 2.30.2