summaryrefslogtreecommitdiff
path: root/src/wx/audio_plot.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-06-20 17:34:23 +0100
committerCarl Hetherington <cth@carlh.net>2013-06-20 21:20:38 +0100
commit50cb31af16240b248700dab1484d7f07656c66df (patch)
tree393568f3c24506ac6b004346b9ef5101f9fdcf61 /src/wx/audio_plot.cc
parentedfd92e5554e3389e6456f497f44ca6e866800bf (diff)
Various fixes to make audio analysis sort-of work.
Diffstat (limited to 'src/wx/audio_plot.cc')
-rw-r--r--src/wx/audio_plot.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc
index fb02fea7b..e2e2cdf76 100644
--- a/src/wx/audio_plot.cc
+++ b/src/wx/audio_plot.cc
@@ -1,5 +1,3 @@
-/* -*- c-basic-offset: 8; default-tab-width: 8; -*- */
-
/*
Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
@@ -193,6 +191,10 @@ AudioPlot::y_for_linear (float p) const
void
AudioPlot::plot_peak (wxGraphicsPath& path, int channel) const
{
+ if (_analysis->points (channel) == 0) {
+ return;
+ }
+
path.MoveToPoint (_db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::PEAK]));
float peak = 0;
@@ -213,6 +215,10 @@ AudioPlot::plot_peak (wxGraphicsPath& path, int channel) const
void
AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const
{
+ if (_analysis->points (channel) == 0) {
+ return;
+ }
+
path.MoveToPoint (_db_label_width, y_for_linear (_analysis->get_point(channel, 0)[AudioPoint::RMS]));
list<float> smoothing;