Clicking on the audio graph jumps to that position in the film (#1507).
[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 #include "lib/film.h"
22 #include "lib/audio_analysis.h"
23 #include "lib/playlist.h"
24 #include <wx/wx.h>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/signals2.hpp>
27
28 class AudioPlot;
29 class FilmViewer;
30 class Film;
31
32 class AudioDialog : public wxDialog
33 {
34 public:
35         AudioDialog (wxWindow* parent, boost::shared_ptr<Film> film, boost::weak_ptr<FilmViewer> viewer, boost::shared_ptr<Content> content = boost::shared_ptr<Content>());
36
37         bool Show (bool show = true);
38
39         void set_cursor (boost::optional<dcpomatic::DCPTime> time, boost::optional<float> db);
40
41 private:
42         void film_change (ChangeType, int);
43         void content_change (ChangeType, int);
44         void channel_clicked (wxCommandEvent &);
45         void type_clicked (wxCommandEvent &);
46         void smoothing_changed ();
47         void try_to_load_analysis ();
48         void analysis_finished ();
49         void setup_statistics ();
50
51         boost::shared_ptr<AudioAnalysis> _analysis;
52         boost::weak_ptr<Film> _film;
53         boost::weak_ptr<FilmViewer> _viewer;
54         /** content to analyse, or 0 to analyse all the film's content */
55         boost::weak_ptr<Content> _content;
56         int _channels;
57         boost::shared_ptr<const Playlist> _playlist;
58         wxStaticText* _cursor;
59         AudioPlot* _plot;
60         wxStaticText* _sample_peak;
61         wxStaticText* _true_peak;
62         wxStaticText* _integrated_loudness;
63         wxStaticText* _loudness_range;
64         wxStaticText* _leqm;
65         wxCheckBox* _channel_checkbox[MAX_DCP_AUDIO_CHANNELS];
66         wxCheckBox* _type_checkbox[AudioPoint::COUNT];
67         wxSlider* _smoothing;
68         boost::signals2::scoped_connection _film_connection;
69         boost::signals2::scoped_connection _film_content_connection;
70         boost::signals2::scoped_connection _analysis_finished_connection;
71 };