Logging improvements to allow prettier displays in the server GUI.
[dcpomatic.git] / src / wx / audio_plot.h
1 /*
2     Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include <vector>
21 #include <boost/shared_ptr.hpp>
22 #include <wx/wx.h>
23 #include "lib/util.h"
24 #include "lib/audio_analysis.h"
25
26 struct Metrics;
27
28 class AudioPlot : public wxPanel
29 {
30 public:
31         AudioPlot (wxWindow *);
32
33         void set_analysis (boost::shared_ptr<AudioAnalysis>);
34         void set_channel_visible (int c, bool v);
35         void set_type_visible (int t, bool v);
36         void set_smoothing (int);
37         void set_message (wxString);
38         void set_gain_correction (double gain);
39
40         static const int max_smoothing;
41
42 private:
43         void paint ();
44         void plot_peak (wxGraphicsPath &, int, Metrics const &) const;
45         void plot_rms (wxGraphicsPath &, int, Metrics const &) const;
46         float y_for_linear (float, Metrics const &) const;
47         AudioPoint get_point (int channel, int point) const;
48
49         boost::shared_ptr<AudioAnalysis> _analysis;
50         bool _channel_visible[MAX_DCP_AUDIO_CHANNELS];
51         bool _type_visible[AudioPoint::COUNT];
52         int _smoothing;
53         std::vector<wxColour> _colours;
54         wxString _message;
55         float _gain_correction;
56
57         static const int _minimum;
58 };