2 Copyright (C) 2008 Paul Davis
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __export_format_dialog_h__
22 #define __export_format_dialog_h__
24 #include "ardour/types.h"
25 #include "ardour/export_format_manager.h"
26 #include "ardour/export_format_compatibility.h"
27 #include "ardour/export_formats.h"
29 #include "pbd/xml++.h"
30 #include "pbd/signals.h"
32 #include "ardour_dialog.h"
33 #include "audio_clock.h"
39 #include <gtkmm/adjustment.h>
40 #include <gtkmm/box.h>
41 #include <gtkmm/checkbutton.h>
42 #include <gtkmm/combobox.h>
43 #include <gtkmm/entry.h>
44 #include <gtkmm/label.h>
45 #include <gtkmm/liststore.h>
46 #include <gtkmm/radiobutton.h>
47 #include <gtkmm/spinbutton.h>
48 #include <gtkmm/table.h>
49 #include <gtkmm/treeview.h>
51 class ExportFormatDialog : public ArdourDialog, public PBD::ScopedConnectionList
55 typedef ARDOUR::WeakExportFormatCompatibilityPtr WeakCompatPtr;
56 typedef ARDOUR::WeakExportFormatPtr WeakFormatPtr;
57 typedef ARDOUR::ExportFormatManager::WeakQualityPtr WeakQualityPtr;
58 typedef ARDOUR::ExportFormatManager::WeakSampleRatePtr WeakSampleRatePtr;
59 typedef ARDOUR::ExportFormatManager::WeakSampleFormatPtr WeakSampleFormatPtr;
60 typedef ARDOUR::ExportFormatManager::WeakDitherTypePtr WeakDitherTypePtr;
62 typedef boost::shared_ptr<ARDOUR::ExportFormatSpecification> FormatPtr;
67 explicit ExportFormatDialog (FormatPtr format, bool new_dialog = false);
68 ~ExportFormatDialog ();
70 void set_session (ARDOUR::Session* s);
75 ARDOUR::ExportFormatManager manager;
77 XMLNode & original_state;
79 ARDOUR::AnyTime silence_start;
80 ARDOUR::AnyTime silence_end;
85 /*** Init functions ***/
87 void load_state (FormatPtr spec);
88 void init_format_table ();
89 void init_encoding_option_widgets ();
91 /*** Interactive selections ***/
93 /* These are connected to signals from GUI components, and should change element states */
95 void update_compatibility_selection (std::string const & path);
96 void update_quality_selection ();
97 void update_format_selection ();
98 void update_sample_rate_selection ();
99 void update_sample_format_selection ();
100 void update_dither_type_selection ();
102 template<typename ColsT>
103 void update_selection (Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
105 /* These are connected to signals from elements, and should only update the gui */
107 void change_compatibility_selection (bool select, WeakCompatPtr compat);
109 void change_quality_selection (bool select, WeakQualityPtr quality);
110 void change_format_selection (bool select, WeakFormatPtr format);
111 void change_sample_rate_selection (bool select, WeakSampleRatePtr rate);
112 void change_sample_format_selection (bool select, WeakSampleFormatPtr format);
113 void change_dither_type_selection (bool select, WeakDitherTypePtr type);
115 template<typename T, typename ColsT>
116 void change_selection (bool select, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, Gtk::TreeView & view, ColsT & cols);
118 void change_quality_compatibility (bool compatibility, WeakQualityPtr quality);
119 void change_format_compatibility (bool compatibility, WeakFormatPtr format);
120 void change_sample_rate_compatibility (bool compatibility, WeakSampleRatePtr rate);
121 void change_sample_format_compatibility (bool compatibility, WeakSampleFormatPtr format);
122 void change_dither_type_compatibility (bool compatibility, WeakDitherTypePtr type);
124 template<typename T, typename ColsT>
125 void change_compatibility (bool compatibility, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols,
126 std::string const & c_incompatible = "red", std::string const & c_compatible = "white");
128 void update_description();
130 uint32_t applying_changes_from_engine;
132 /*** Non-interactive selections ***/
136 void update_trim_start_selection ();
137 void update_trim_end_selection ();
139 void update_normalize_selection ();
140 void update_normalize_sensitivity ();
141 void update_silence_start_selection ();
142 void update_silence_end_selection ();
144 void update_clock (AudioClock & clock, ARDOUR::AnyTime const & time);
145 void update_time (ARDOUR::AnyTime & time, AudioClock const & clock);
147 void update_src_quality_selection ();
148 void update_codec_quality_selection ();
149 void update_tagging_selection ();
150 void set_codec_quality_selection ();
152 /*** Encoding options */
154 void change_encoding_options (ARDOUR::ExportFormatPtr ptr);
156 void empty_encoding_option_table ();
157 void remove_widget (Gtk::Widget & to_remove, Gtk::Container * remove_from);
159 void show_linear_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatLinear> ptr);
160 void show_ogg_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatOggVorbis> ptr);
161 void show_flac_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatFLAC> ptr);
162 void show_bwf_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatBWF> ptr);
163 void show_ffmpeg_enconding_options (boost::shared_ptr<ARDOUR::ExportFormatFFMPEG> ptr);
165 void fill_sample_format_lists (boost::shared_ptr<ARDOUR::HasSampleFormat> ptr);
166 void fill_codec_quality_lists (boost::shared_ptr<ARDOUR::HasCodecQuality> ptr);
168 /*** GUI components ***/
170 /* Name, new and remove */
174 Gtk::Label name_label;
175 Gtk::Entry name_entry;
176 Gtk::Label name_generated_part;
180 Gtk::HBox normalize_hbox;
181 Gtk::CheckButton normalize_checkbox;
182 Gtk::RadioButton normalize_peak_rb;
183 Gtk::RadioButton normalize_loudness_rb;
184 Gtk::SpinButton normalize_dbfs_spinbutton;
185 Gtk::Adjustment normalize_dbfs_adjustment;
186 Gtk::SpinButton normalize_lufs_spinbutton;
187 Gtk::Adjustment normalize_lufs_adjustment;
188 Gtk::SpinButton normalize_dbtp_spinbutton;
189 Gtk::Adjustment normalize_dbtp_adjustment;
190 Gtk::Label normalize_dbfs_label;
191 Gtk::Label normalize_lufs_label;
192 Gtk::Label normalize_dbtp_label;
196 Gtk::Table silence_table;
198 Gtk::CheckButton trim_start_checkbox;
199 Gtk::CheckButton silence_start_checkbox;
200 AudioClock silence_start_clock;
202 Gtk::CheckButton trim_end_checkbox;
203 Gtk::CheckButton silence_end_checkbox;
204 AudioClock silence_end_clock;
206 /* Post-export hook */
208 Gtk::Label command_label;
209 Gtk::Entry command_entry;
213 struct CompatibilityCols : public Gtk::TreeModelColumnRecord
216 Gtk::TreeModelColumn<ARDOUR::ExportFormatCompatibilityPtr> ptr;
217 Gtk::TreeModelColumn<bool> selected;
218 Gtk::TreeModelColumn<std::string> label;
220 CompatibilityCols () { add(ptr); add(selected); add(label); }
222 CompatibilityCols compatibility_cols;
223 Glib::RefPtr<Gtk::ListStore> compatibility_list;
225 /* Hack to disallow row selection in compatibilities */
226 void prohibit_compatibility_selection ();
227 sigc::connection compatibility_select_connection;
229 struct QualityCols : public Gtk::TreeModelColumnRecord
232 Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::QualityPtr> ptr;
233 Gtk::TreeModelColumn<std::string> color;
234 Gtk::TreeModelColumn<std::string> label;
236 QualityCols () { add(ptr); add(color); add(label); }
238 QualityCols quality_cols;
239 Glib::RefPtr<Gtk::ListStore> quality_list;
241 struct FormatCols : public Gtk::TreeModelColumnRecord
244 Gtk::TreeModelColumn<ARDOUR::ExportFormatPtr> ptr;
245 Gtk::TreeModelColumn<std::string> color;
246 Gtk::TreeModelColumn<std::string> label;
248 FormatCols () { add(ptr); add(color); add(label); }
250 FormatCols format_cols;
251 Glib::RefPtr<Gtk::ListStore> format_list;
253 struct SampleRateCols : public Gtk::TreeModelColumnRecord
256 Gtk::TreeModelColumn<ARDOUR::ExportFormatManager::SampleRatePtr> ptr;
257 Gtk::TreeModelColumn<std::string> color;
258 Gtk::TreeModelColumn<std::string> label;
260 SampleRateCols () { add(ptr); add(color); add(label); }
262 SampleRateCols sample_rate_cols;
263 Glib::RefPtr<Gtk::ListStore> sample_rate_list;
265 Gtk::Table format_table;
267 Gtk::Label compatibility_label;
268 Gtk::Label quality_label;
269 Gtk::Label format_label;
270 Gtk::Label sample_rate_label;
272 Gtk::TreeView compatibility_view;
273 Gtk::TreeView quality_view;
274 Gtk::TreeView format_view;
275 Gtk::TreeView sample_rate_view;
277 /* SRC quality combo */
279 struct SRCQualityCols : public Gtk::TreeModelColumnRecord
282 Gtk::TreeModelColumn<ARDOUR::ExportFormatBase::SRCQuality> id;
283 Gtk::TreeModelColumn<std::string> label;
285 SRCQualityCols () { add(id); add(label); }
287 SRCQualityCols src_quality_cols;
288 Glib::RefPtr<Gtk::ListStore> src_quality_list;
290 Gtk::Label src_quality_label;
291 Gtk::ComboBox src_quality_combo;
293 /* Common encoding option components */
295 Gtk::VBox encoding_options_vbox;
296 Gtk::Label encoding_options_label;
298 Gtk::Table encoding_options_table;
300 /* Other common components */
302 Gtk::Button * revert_button;
303 Gtk::Button * close_button;
305 /*** Changing encoding option stuff ***/
309 struct SampleFormatCols : public Gtk::TreeModelColumnRecord
312 Gtk::TreeModelColumn<ARDOUR::HasSampleFormat::SampleFormatPtr> ptr;
313 Gtk::TreeModelColumn<std::string> color;
314 Gtk::TreeModelColumn<std::string> label;
316 SampleFormatCols () { add(ptr); add(color); add(label); }
318 SampleFormatCols sample_format_cols;
319 Glib::RefPtr<Gtk::ListStore> sample_format_list;
321 struct DitherTypeCols : public Gtk::TreeModelColumnRecord
324 Gtk::TreeModelColumn<ARDOUR::HasSampleFormat::DitherTypePtr> ptr;
325 Gtk::TreeModelColumn<std::string> color;
326 Gtk::TreeModelColumn<std::string> label;
328 DitherTypeCols () { add(ptr); add (color); add(label); }
330 DitherTypeCols dither_type_cols;
331 Glib::RefPtr<Gtk::ListStore> dither_type_list;
333 Gtk::Label sample_format_label;
334 Gtk::Label dither_label;
336 Gtk::CheckButton with_cue;
337 Gtk::CheckButton with_toc;
338 Gtk::CheckButton with_mp4chaps;
340 Gtk::VBox cue_toc_vbox;
342 void update_with_toc ();
343 void update_with_cue ();
344 void update_with_mp4chaps();
345 void update_command ();
347 Gtk::TreeView sample_format_view;
348 Gtk::TreeView dither_type_view;
351 /* codec quality combo */
353 struct CodecQualityCols : public Gtk::TreeModelColumnRecord
356 Gtk::TreeModelColumn<int> quality;
357 Gtk::TreeModelColumn<std::string> label;
359 CodecQualityCols () { add(quality); add(label); }
361 CodecQualityCols codec_quality_cols;
362 Glib::RefPtr<Gtk::ListStore> codec_quality_list;
364 Gtk::ComboBox codec_quality_combo;
368 Gtk::CheckButton tag_checkbox;
372 #endif /* __export_format_dialog_h__ */