Ardour  9.0-pre0-582-g084a23a80d
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 #pragma once
24 
25 #include "ardour/types.h"
28 #include "ardour/export_formats.h"
29 
30 #include "pbd/xml++.h"
31 #include "pbd/signals.h"
32 
33 #include "ardour_dialog.h"
34 #include "audio_clock.h"
35 
36 #ifdef interface
37 #undef interface
38 #endif
39 
40 #include <gtkmm/adjustment.h>
41 #include <gtkmm/box.h>
42 #include <gtkmm/checkbutton.h>
43 #include <gtkmm/combobox.h>
44 #include <gtkmm/comboboxtext.h>
45 #include <gtkmm/entry.h>
46 #include <gtkmm/label.h>
47 #include <gtkmm/liststore.h>
48 #include <gtkmm/radiobutton.h>
49 #include <gtkmm/spinbutton.h>
50 #include <gtkmm/table.h>
51 #include <gtkmm/treeview.h>
52 
54 {
55 private:
56 
63 
64  typedef std::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
65 
66 
67 public:
68 
69  explicit ExportFormatDialog (FormatPtr format, bool new_dialog = false);
71 
73 
74 private:
75 
78 
80 
83 
84  void end_dialog ();
85  void revert ();
86 
87  /*** Init functions ***/
88 
89  void load_state (FormatPtr spec);
92 
93  /*** Interactive selections ***/
94 
95  /* These are connected to signals from GUI components, and should change element states */
96 
97  void update_compatibility_selection (std::string const & path);
103 
104  template<typename ColsT>
105  void update_selection (Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
106 
107  /* These are connected to signals from elements, and should only update the gui */
108 
109  void change_compatibility_selection (bool select, WeakCompatPtr compat);
110 
111  void change_quality_selection (bool select, WeakQualityPtr quality);
116 
117  template<typename T, typename ColsT>
118  void change_selection (bool select, std::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
119 
120  void change_quality_compatibility (bool compatibility, WeakQualityPtr quality);
122  void change_sample_rate_compatibility (bool compatibility, WeakSampleRatePtr rate);
124  void change_dither_type_compatibility (bool compatibility, WeakDitherTypePtr type);
125 
126  template<typename T, typename ColsT>
127  void change_compatibility (bool compatibility, std::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols,
128  std::string const & c_incompatible = "red", std::string const & c_compatible = "white");
129 
131 
133 
134  /*** Non-interactive selections ***/
135 
136  void update_name ();
137 
140 
145 
146  void update_clock (AudioClock & clock, ARDOUR::AnyTime const & time);
147  void update_time (ARDOUR::AnyTime & time, AudioClock const & clock);
148 
149  /* SRC, codec, etc */
150 
155 
158 
159  /*** Encoding options */
160 
162 
164  void remove_widget (Gtk::Widget & to_remove, Gtk::Container * remove_from);
165 
166  void show_linear_enconding_options (std::shared_ptr<ARDOUR::ExportFormatLinear> ptr);
167  void show_ogg_enconding_options (std::shared_ptr<ARDOUR::ExportFormatOggVorbis> ptr);
168  void show_flac_enconding_options (std::shared_ptr<ARDOUR::ExportFormatFLAC> ptr);
169  void show_bwf_enconding_options (std::shared_ptr<ARDOUR::ExportFormatBWF> ptr);
170  void show_opus_enconding_options (std::shared_ptr<ARDOUR::ExportFormatOggOpus> ptr);
171  void show_mpeg_enconding_options (std::shared_ptr<ARDOUR::ExportFormatMPEG> ptr);
172  void show_ffmpeg_enconding_options (std::shared_ptr<ARDOUR::ExportFormatFFMPEG> ptr);
173 
174  void fill_sample_format_lists (std::shared_ptr<ARDOUR::HasSampleFormat> ptr);
175  void fill_codec_quality_lists (std::shared_ptr<ARDOUR::HasCodecQuality> ptr);
176  void fill_sample_rate_lists (std::shared_ptr<ARDOUR::ExportFormat> ptr);
177 
178  /*** GUI components ***/
179 
180  /* Name, new and remove */
181 
183 
187 
188  /* Normalize */
203 
204  /* Silence */
205 
207 
211 
215 
216  /* Post-export hook */
217 
221 
222  /* Format table */
223 
225  {
226  public:
230 
232  };
234  Glib::RefPtr<Gtk::ListStore> compatibility_list;
235 
236  /* Hack to disallow row selection in compatibilities */
239 
241  {
242  public:
246 
248  };
250  Glib::RefPtr<Gtk::ListStore> quality_list;
251 
253  {
254  public:
258 
260  };
262  Glib::RefPtr<Gtk::ListStore> format_list;
263 
265  {
266  public:
270 
272  };
274  Glib::RefPtr<Gtk::ListStore> sample_rate_list;
275 
277 
282 
287 
288  /* SRC quality combo */
289 
291  {
292  public:
295 
296  SRCQualityCols () { add(id); add(label); }
297  };
299  Glib::RefPtr<Gtk::ListStore> src_quality_list;
300 
304 
305  /* Watermark */
306 
308  {
309  public:
313 
315  add(label);
316  add(interval);
317  add(duration);
318  }
319  };
320 
322  Glib::RefPtr<Gtk::ListStore> demo_noise_list;
323 
325 
330 
334 
335  /* Common encoding option components */
336 
339 
341 
342  /* Other common components */
343 
346 
347  /*** Changing encoding option stuff ***/
348 
349  /* Linear */
350 
352  {
353  public:
357 
359  };
361  Glib::RefPtr<Gtk::ListStore> sample_format_list;
362 
364  {
365  public:
369 
371  };
373  Glib::RefPtr<Gtk::ListStore> dither_type_list;
374 
377 
381 
383 
387  void update_command ();
388 
391 
392 
393  /* codec quality combo */
394 
396  {
397  public:
400 
402  };
404  Glib::RefPtr<Gtk::ListStore> codec_quality_list;
405 
407 
408  /* Tagging */
409 
411 
412 };
413 
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