Missed update to private test repo version.
[dcpomatic.git] / src / wx / audio_dialog.h
1 /*
2     Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #include "lib/audio_analysis.h"
23 #include "lib/constants.h"
24 #include "lib/film_property.h"
25 #include "lib/playlist.h"
26 #include <dcp/warnings.h>
27 LIBDCP_DISABLE_WARNINGS
28 #include <wx/wx.h>
29 LIBDCP_ENABLE_WARNINGS
30 #include <boost/signals2.hpp>
31
32
33 class AudioPlot;
34 class CheckBox;
35 class FilmViewer;
36 class Film;
37
38
39 /** @class AudioDialog
40  *  @brief Dialog to display audio analysis.
41  *
42  *  This can be used for the whole DCP, or a specific piece of content if one is passed into the constructor.
43  */
44 class AudioDialog : public wxDialog
45 {
46 public:
47         AudioDialog(wxWindow* parent, std::shared_ptr<Film> film, FilmViewer& viewer, std::shared_ptr<Content> content = std::shared_ptr<Content>());
48
49         bool Show (bool show = true) override;
50
51         void set_cursor (boost::optional<dcpomatic::DCPTime> time, boost::optional<float> db);
52
53 private:
54         void film_change(ChangeType, FilmProperty);
55         void content_change (ChangeType, int);
56         void channel_clicked (wxCommandEvent &);
57         void type_clicked (wxCommandEvent &);
58         void smoothing_changed ();
59         void try_to_load_analysis ();
60         void analysis_finished ();
61         void setup_statistics ();
62         void show_or_hide_channel_checkboxes ();
63
64         std::shared_ptr<AudioAnalysis> _analysis;
65         std::weak_ptr<Film> _film;
66         /** content to analyse, or 0 to analyse all the film's content */
67         std::weak_ptr<Content> _content;
68         int _channels;
69         std::shared_ptr<const Playlist> _playlist;
70         wxStaticText* _cursor;
71         AudioPlot* _plot;
72         wxStaticText* _sample_peak;
73         wxStaticText* _true_peak;
74         wxStaticText* _integrated_loudness;
75         wxStaticText* _loudness_range;
76         wxStaticText* _leqm;
77         CheckBox* _channel_checkbox[MAX_DCP_AUDIO_CHANNELS];
78         CheckBox* _type_checkbox[AudioPoint::COUNT];
79         wxSlider* _smoothing;
80         boost::signals2::scoped_connection _film_connection;
81         boost::signals2::scoped_connection _film_content_connection;
82         boost::signals2::scoped_connection _analysis_finished_connection;
83 };