Fix drift in RMS smoothing; plot the centre of the window at its point, rather than...
authorCarl Hetherington <cth@carlh.net>
Wed, 27 Feb 2013 22:43:00 +0000 (22:43 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 27 Feb 2013 22:43:00 +0000 (22:43 +0000)
src/wx/audio_plot.cc

index 9b2e6b1b0eef8cb218b370418619a64b44a8c800..2098adb40d04e2a7f7801b35d1de99d676f60400 100644 (file)
@@ -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));
        }
 }