Ardour  8.12
export_format_dialog.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2013 Paul Davis <paul@linuxaudiosystems.com>
3  * Copyright (C) 2009 David Robillard <d@drobilla.net>
4  * Copyright (C) 2011-2012 Sakari Bergen <sakari.bergen@beatwaves.net>
5  * Copyright (C) 2013-2014 Colin Fletcher <colin.m.fletcher@googlemail.com>
6  * Copyright (C) 2015-2018 Robin Gareus <robin@gareus.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #ifndef __export_format_dialog_h__
24 #define __export_format_dialog_h__
25 
26 #include "ardour/types.h"
29 #include "ardour/export_formats.h"
30 
31 #include "pbd/xml++.h"
32 #include "pbd/signals.h"
33 
34 #include "ardour_dialog.h"
35 #include "audio_clock.h"
36 
37 #ifdef interface
38 #undef interface
39 #endif
40 
41 #include <gtkmm/adjustment.h>
42 #include <gtkmm/box.h>
43 #include <gtkmm/checkbutton.h>
44 #include <gtkmm/combobox.h>
45 #include <gtkmm/comboboxtext.h>
46 #include <gtkmm/entry.h>
47 #include <gtkmm/label.h>
48 #include <gtkmm/liststore.h>
49 #include <gtkmm/radiobutton.h>
50 #include <gtkmm/spinbutton.h>
51 #include <gtkmm/table.h>
52 #include <gtkmm/treeview.h>
53 
55 {
56 private:
57 
64 
65  typedef std::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
66 
67 
68 public:
69 
70  explicit ExportFormatDialog (FormatPtr format, bool new_dialog = false);
72 
74 
75 private:
76 
79 
81 
84 
85  void end_dialog ();
86  void revert ();
87 
88  /*** Init functions ***/
89 
90  void load_state (FormatPtr spec);
93 
94  /*** Interactive selections ***/
95 
96  /* These are connected to signals from GUI components, and should change element states */
97 
98  void update_compatibility_selection (std::string const & path);
104 
105  template<typename ColsT>
106  void update_selection (Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
107 
108  /* These are connected to signals from elements, and should only update the gui */
109 
110  void change_compatibility_selection (bool select, WeakCompatPtr compat);
111 
112  void change_quality_selection (bool select, WeakQualityPtr quality);
117 
118  template<typename T, typename ColsT>
119  void change_selection (bool select, std::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
120 
121  void change_quality_compatibility (bool compatibility, WeakQualityPtr quality);
123  void change_sample_rate_compatibility (bool compatibility, WeakSampleRatePtr rate);
125  void change_dither_type_compatibility (bool compatibility, WeakDitherTypePtr type);
126 
127  template<typename T, typename ColsT>
128  void change_compatibility (bool compatibility, std::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols,
129  std::string const & c_incompatible = "red", std::string const & c_compatible = "white");
130 
132 
134 
135  /*** Non-interactive selections ***/
136 
137  void update_name ();
138 
141 
146 
147  void update_clock (AudioClock & clock, ARDOUR::AnyTime const & time);
148  void update_time (ARDOUR::AnyTime & time, AudioClock const & clock);
149 
150  /* SRC, codec, etc */
151 
156 
159 
160  /*** Encoding options */
161 
163 
165  void remove_widget (Gtk::Widget & to_remove, Gtk::Container * remove_from);
166 
167  void show_linear_enconding_options (std::shared_ptr<ARDOUR::ExportFormatLinear> ptr);
168  void show_ogg_enconding_options (std::shared_ptr<ARDOUR::ExportFormatOggVorbis> ptr);
169  void show_flac_enconding_options (std::shared_ptr<ARDOUR::ExportFormatFLAC> ptr);
170  void show_bwf_enconding_options (std::shared_ptr<ARDOUR::ExportFormatBWF> ptr);
171  void show_opus_enconding_options (std::shared_ptr<ARDOUR::ExportFormatOggOpus> ptr);
172  void show_mpeg_enconding_options (std::shared_ptr<ARDOUR::ExportFormatMPEG> ptr);
173  void show_ffmpeg_enconding_options (std::shared_ptr<ARDOUR::ExportFormatFFMPEG> ptr);
174 
175  void fill_sample_format_lists (std::shared_ptr<ARDOUR::HasSampleFormat> ptr);
176  void fill_codec_quality_lists (std::shared_ptr<ARDOUR::HasCodecQuality> ptr);
177  void fill_sample_rate_lists (std::shared_ptr<ARDOUR::ExportFormat> ptr);
178 
179  /*** GUI components ***/
180 
181  /* Name, new and remove */
182 
184 
188 
189  /* Normalize */
204 
205  /* Silence */
206 
208 
212 
216 
217  /* Post-export hook */
218 
222 
223  /* Format table */
224 
226  {
227  public:
231 
233  };
235  Glib::RefPtr<Gtk::ListStore> compatibility_list;
236 
237  /* Hack to disallow row selection in compatibilities */
240 
242  {
243  public:
247 
249  };
251  Glib::RefPtr<Gtk::ListStore> quality_list;
252 
254  {
255  public:
259 
261  };
263  Glib::RefPtr<Gtk::ListStore> format_list;
264 
266  {
267  public:
271 
273  };
275  Glib::RefPtr<Gtk::ListStore> sample_rate_list;
276 
278 
283 
288 
289  /* SRC quality combo */
290 
292  {
293  public:
296 
297  SRCQualityCols () { add(id); add(label); }
298  };
300  Glib::RefPtr<Gtk::ListStore> src_quality_list;
301 
305 
306  /* Watermark */
307 
309  {
310  public:
314 
316  add(label);
317  add(interval);
318  add(duration);
319  }
320  };
321 
323  Glib::RefPtr<Gtk::ListStore> demo_noise_list;
324 
326 
331 
335 
336  /* Common encoding option components */
337 
340 
342 
343  /* Other common components */
344 
347 
348  /*** Changing encoding option stuff ***/
349 
350  /* Linear */
351 
353  {
354  public:
358 
360  };
362  Glib::RefPtr<Gtk::ListStore> sample_format_list;
363 
365  {
366  public:
370 
372  };
374  Glib::RefPtr<Gtk::ListStore> dither_type_list;
375 
378 
382 
384 
388  void update_command ();
389 
392 
393 
394  /* codec quality combo */
395 
397  {
398  public:
401 
403  };
405  Glib::RefPtr<Gtk::ListStore> codec_quality_list;
406 
408 
409  /* Tagging */
410 
412 
413 };
414 
415 #endif /* __export_format_dialog_h__ */
std::weak_ptr< SampleRateState > WeakSampleRatePtr
HasSampleFormat::WeakSampleFormatPtr WeakSampleFormatPtr
std::weak_ptr< QualityState > WeakQualityPtr
HasSampleFormat::WeakDitherTypePtr WeakDitherTypePtr
ARDOUR::ExportFormatManager::WeakSampleFormatPtr WeakSampleFormatPtr
std::shared_ptr< ARDOUR::ExportFormatSpecification > FormatPtr
void update_demo_noise_sensitivity()
void update_trim_end_selection()
void update_tagging_selection()
void show_ogg_enconding_options(std::shared_ptr< ARDOUR::ExportFormatOggVorbis > ptr)
Glib::RefPtr< Gtk::ListStore > quality_list
Gtk::SpinButton normalize_lufs_spinbutton
Gtk::CheckButton with_mp4chaps
Glib::RefPtr< Gtk::ListStore > sample_format_list
ARDOUR::AnyTime silence_end
void change_quality_selection(bool select, WeakQualityPtr quality)
void empty_encoding_option_table()
Gtk::ComboBox codec_quality_combo
void prohibit_compatibility_selection()
void fill_codec_quality_lists(std::shared_ptr< ARDOUR::HasCodecQuality > ptr)
ARDOUR::ExportFormatManager::WeakSampleRatePtr WeakSampleRatePtr
void change_sample_rate_selection(bool select, WeakSampleRatePtr rate)
void update_with_mp4chaps()
SRCQualityCols src_quality_cols
void update_format_selection()
void show_ffmpeg_enconding_options(std::shared_ptr< ARDOUR::ExportFormatFFMPEG > ptr)
void change_dither_type_selection(bool select, WeakDitherTypePtr type)
void update_clock(AudioClock &clock, ARDOUR::AnyTime const &time)
Gtk::CheckButton normalize_checkbox
void load_state(FormatPtr spec)
Glib::RefPtr< Gtk::ListStore > demo_noise_list
void update_codec_quality_selection()
Gtk::CheckButton silence_end_checkbox
void update_trim_start_selection()
Gtk::ComboBox demo_noise_combo
void change_compatibility(bool compatibility, std::weak_ptr< T > w_ptr, Glib::RefPtr< Gtk::ListStore > &list, ColsT &cols, std::string const &c_incompatible="red", std::string const &c_compatible="white")
void change_sample_format_compatibility(bool compatibility, WeakSampleFormatPtr format)
Glib::RefPtr< Gtk::ListStore > compatibility_list
void update_sample_rate_selection()
Gtk::TreeView sample_rate_view
void init_encoding_option_widgets()
Gtk::CheckButton trim_start_checkbox
Gtk::SpinButton demo_noise_dbfs_spinbutton
void show_mpeg_enconding_options(std::shared_ptr< ARDOUR::ExportFormatMPEG > ptr)
Glib::RefPtr< Gtk::ListStore > codec_quality_list
void update_selection(Glib::RefPtr< Gtk::ListStore > &list, Gtk::TreeView &view, ColsT &cols)
void change_format_compatibility(bool compatibility, WeakFormatPtr format)
void change_selection(bool select, std::weak_ptr< T > w_ptr, Glib::RefPtr< Gtk::ListStore > &list, Gtk::TreeView &view, ColsT &cols)
void update_silence_start_selection()
ARDOUR::AnyTime silence_start
void update_normalize_selection()
void update_time(ARDOUR::AnyTime &time, AudioClock const &clock)
Gtk::CheckButton silence_start_checkbox
Gtk::Table watermark_options_table
Gtk::CheckButton with_toc
void show_linear_enconding_options(std::shared_ptr< ARDOUR::ExportFormatLinear > ptr)
void fill_sample_format_lists(std::shared_ptr< ARDOUR::HasSampleFormat > ptr)
void update_normalize_sensitivity()
ARDOUR::WeakExportFormatPtr WeakFormatPtr
void change_sample_format_selection(bool select, WeakSampleFormatPtr format)
void change_dither_type_compatibility(bool compatibility, WeakDitherTypePtr type)
ARDOUR::ExportFormatManager::WeakQualityPtr WeakQualityPtr
void update_demo_noise_selection()
CompatibilityCols compatibility_cols
sigc::connection compatibility_select_connection
Glib::RefPtr< Gtk::ListStore > dither_type_list
void set_codec_quality_selection()
void show_bwf_enconding_options(std::shared_ptr< ARDOUR::ExportFormatBWF > ptr)
Gtk::TreeView dither_type_view
void update_dither_type_selection()
DemoNoiseCols demo_noise_cols
Gtk::Adjustment normalize_lufs_adjustment
void change_encoding_options(ARDOUR::ExportFormatPtr ptr)
ARDOUR::WeakExportFormatCompatibilityPtr WeakCompatPtr
void show_opus_enconding_options(std::shared_ptr< ARDOUR::ExportFormatOggOpus > ptr)
Gtk::SpinButton normalize_dbtp_spinbutton
void change_quality_compatibility(bool compatibility, WeakQualityPtr quality)
ExportFormatDialog(FormatPtr format, bool new_dialog=false)
ARDOUR::ExportFormatManager::WeakDitherTypePtr WeakDitherTypePtr
Gtk::TreeView sample_format_view
Gtk::CheckButton trim_end_checkbox
Gtk::RadioButton normalize_loudness_rb
DitherTypeCols dither_type_cols
void change_sample_rate_compatibility(bool compatibility, WeakSampleRatePtr rate)
ARDOUR::ExportFormatManager manager
Gtk::ComboBoxText normalize_tp_limiter
Gtk::Adjustment demo_noise_dbfs_adjustment
void fill_sample_rate_lists(std::shared_ptr< ARDOUR::ExportFormat > ptr)
void change_format_selection(bool select, WeakFormatPtr format)
Gtk::RadioButton normalize_peak_rb
void update_silence_end_selection()
Gtk::CheckButton with_cue
void update_quality_selection()
Gtk::ComboBox src_quality_combo
Gtk::Adjustment normalize_dbfs_adjustment
Glib::RefPtr< Gtk::ListStore > sample_rate_list
void update_sample_format_selection()
void show_flac_enconding_options(std::shared_ptr< ARDOUR::ExportFormatFLAC > ptr)
void update_compatibility_selection(std::string const &path)
void change_compatibility_selection(bool select, WeakCompatPtr compat)
Glib::RefPtr< Gtk::ListStore > src_quality_list
void remove_widget(Gtk::Widget &to_remove, Gtk::Container *remove_from)
CodecQualityCols codec_quality_cols
Gtk::CheckButton tag_checkbox
SampleRateCols sample_rate_cols
Gtk::Adjustment normalize_dbtp_adjustment
Gtk::SpinButton normalize_dbfs_spinbutton
void update_src_quality_selection()
SampleFormatCols sample_format_cols
void set_session(ARDOUR::Session *s)
Glib::RefPtr< Gtk::ListStore > format_list
Gtk::TreeView compatibility_view
void add(TreeModelColumnBase &column)
void path(Glib::ustring &path, Glib::ustring &path_reversed)
Compute a widget's path of the form "GtkWindow.MyLabel".
Definition: xml++.h:114
std::weak_ptr< ExportFormatCompatibility > WeakExportFormatCompatibilityPtr
std::shared_ptr< ExportFormat > ExportFormatPtr
std::weak_ptr< ExportFormat > WeakExportFormatPtr
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< ARDOUR::ExportFormatCompatibilityPtr > ptr
Gtk::TreeModelColumn< bool > selected
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< int > interval
Gtk::TreeModelColumn< int > duration
Gtk::TreeModelColumn< ARDOUR::HasSampleFormat::DitherTypePtr > ptr
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< ARDOUR::ExportFormatPtr > ptr
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< ARDOUR::ExportFormatManager::QualityPtr > ptr
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< ARDOUR::ExportFormatBase::SRCQuality > id
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< std::string > label
Gtk::TreeModelColumn< ARDOUR::HasSampleFormat::SampleFormatPtr > ptr
Gtk::TreeModelColumn< std::string > color
Gtk::TreeModelColumn< ARDOUR::ExportFormatManager::SampleRatePtr > ptr
Gtk::TreeModelColumn< std::string > label