Various fixes to make audio analysis sort-of work.
[dcpomatic.git] / src / wx / audio_plot.cc
index fb02fea7b9ebe734c8b43571998e95a0ca88688c..e2e2cdf764026eddc9a8f73b3728698aaf051bb2 100644 (file)
@@ -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;