2008-09-17 08:56:00 -04:00
/*
2019-08-02 17:26:43 -04:00
* Copyright ( C ) 2008 - 2017 Paul Davis < paul @ linuxaudiosystems . com >
* Copyright ( C ) 2009 - 2010 Carl Hetherington < carl @ carlh . net >
* Copyright ( C ) 2009 - 2012 David Robillard < d @ drobilla . net >
* Copyright ( C ) 2009 - 2013 Sakari Bergen < sakari . bergen @ beatwaves . net >
* Copyright ( C ) 2013 - 2014 Colin Fletcher < colin . m . fletcher @ googlemail . com >
* Copyright ( C ) 2016 - 2019 Robin Gareus < robin @ gareus . org >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along
* with this program ; if not , write to the Free Software Foundation , Inc . ,
* 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
*/
2008-09-17 08:56:00 -04:00
2017-07-16 21:48:18 -04:00
# include <gtkmm/stock.h>
2009-02-25 13:26:51 -05:00
# include "ardour/session.h"
# include "ardour/export_format_specification.h"
2008-09-17 08:56:00 -04:00
2017-07-15 11:38:28 -04:00
# include "widgets/tooltips.h"
2009-12-21 13:23:07 -05:00
# include "export_format_dialog.h"
# include "gui_thread.h"
2017-07-15 11:38:28 -04:00
2016-07-14 14:44:52 -04:00
# include "pbd/i18n.h"
2008-09-17 08:56:00 -04:00
using namespace ARDOUR ;
ExportFormatDialog : : ExportFormatDialog ( FormatPtr format , bool new_dialog ) :
2010-05-02 19:54:25 -04:00
ArdourDialog ( new_dialog ? _ ( " New Export Format Profile " ) : _ ( " Edit Export Format Profile " ) ) ,
2008-09-17 08:56:00 -04:00
format ( format ) ,
manager ( format ) ,
original_state ( format - > get_state ( ) ) ,
applying_changes_from_engine ( 0 ) ,
name_label ( _ ( " Label: " ) , Gtk : : ALIGN_LEFT ) ,
2012-06-24 07:36:33 -04:00
name_generated_part ( " " , Gtk : : ALIGN_LEFT ) ,
2008-09-17 08:56:00 -04:00
2016-05-02 09:43:22 -04:00
normalize_checkbox ( _ ( " Normalize: " ) ) ,
normalize_peak_rb ( _ ( " Peak " ) ) ,
normalize_loudness_rb ( _ ( " Loudness " ) ) ,
normalize_dbfs_adjustment ( 0.00 , - 90.00 , 0.00 , 0.1 , 0.2 ) ,
normalize_lufs_adjustment ( - 23.0 , - 90.00 , 0.00 , 0.1 , 1.0 ) ,
normalize_dbtp_adjustment ( - 1.0 , - 90.00 , 0.00 , 0.1 , 0.2 ) ,
normalize_dbfs_label ( _ ( " dBFS " ) , Gtk : : ALIGN_LEFT ) ,
normalize_lufs_label ( _ ( " LUFS " ) , Gtk : : ALIGN_LEFT ) ,
normalize_dbtp_label ( _ ( " dBTP " ) , Gtk : : ALIGN_LEFT ) ,
2008-09-17 08:56:00 -04:00
silence_table ( 2 , 4 ) ,
trim_start_checkbox ( _ ( " Trim silence at start " ) ) ,
silence_start_checkbox ( _ ( " Add silence at start: " ) ) ,
2011-11-17 17:49:13 -05:00
silence_start_clock ( " silence_start " , true , " " , true , false , true ) ,
2008-09-17 08:56:00 -04:00
trim_end_checkbox ( _ ( " Trim silence at end " ) ) ,
silence_end_checkbox ( _ ( " Add silence at end: " ) ) ,
2011-11-17 17:49:13 -05:00
silence_end_clock ( " silence_end " , true , " " , true , false , true ) ,
2008-09-17 08:56:00 -04:00
2016-06-07 11:07:37 -04:00
command_label ( _ ( " Command to run post-export \n (%f=file path, %d=directory, %b=basename, see tooltip for more): " ) , Gtk : : ALIGN_LEFT ) ,
2013-10-07 09:44:35 -04:00
2008-09-17 08:56:00 -04:00
format_table ( 3 , 4 ) ,
compatibility_label ( _ ( " Compatibility " ) , Gtk : : ALIGN_LEFT ) ,
quality_label ( _ ( " Quality " ) , Gtk : : ALIGN_LEFT ) ,
format_label ( _ ( " File format " ) , Gtk : : ALIGN_LEFT ) ,
sample_rate_label ( _ ( " Sample rate " ) , Gtk : : ALIGN_LEFT ) ,
src_quality_label ( _ ( " Sample rate conversion quality: " ) , Gtk : : ALIGN_RIGHT ) ,
2020-06-04 21:10:20 -04:00
/* Watermarking */
watermark_heading ( _ ( " Preview / Watermark " ) , Gtk : : ALIGN_LEFT ) ,
demo_noise_mode_label ( _ ( " Mode: " ) , Gtk : : ALIGN_LEFT ) ,
demo_noise_level_label ( _ ( " Noise Level: " ) , Gtk : : ALIGN_LEFT ) ,
demo_noise_dbfs_unit ( _ ( " dBFS " ) , Gtk : : ALIGN_LEFT ) ,
demo_noise_dbfs_adjustment ( - 20.0 , - 90.00 , - 6.00 , 1 , 5 ) ,
demo_noise_dbfs_spinbutton ( demo_noise_dbfs_adjustment , 1 , 0 ) ,
/* Changing encoding options from here on */
2010-12-11 19:41:36 -05:00
encoding_options_label ( " " , Gtk : : ALIGN_LEFT ) ,
2008-09-17 08:56:00 -04:00
/* Changing encoding options from here on */
sample_format_label ( _ ( " Sample Format " ) , Gtk : : ALIGN_LEFT ) ,
dither_label ( _ ( " Dithering " ) , Gtk : : ALIGN_LEFT ) ,
2012-01-18 16:56:06 -05:00
with_cue ( _ ( " Create CUE file for disk-at-once CD/DVD creation " ) ) ,
with_toc ( _ ( " Create TOC file for disk-at-once CD/DVD creation " ) ) ,
2015-04-12 08:26:39 -04:00
with_mp4chaps ( _ ( " Create chapter mark file for MP4 chapter marks " ) ) ,
2012-01-18 16:56:06 -05:00
2008-09-17 08:56:00 -04:00
tag_checkbox ( _ ( " Tag file with session's metadata " ) )
{
/* Pack containers in dialog */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
get_vbox ( ) - > pack_start ( silence_table , false , false , 6 ) ;
get_vbox ( ) - > pack_start ( format_table , false , false , 6 ) ;
2020-06-04 21:10:20 -04:00
get_vbox ( ) - > pack_start ( watermark_options_table , false , false , 6 ) ;
get_vbox ( ) - > pack_start ( encoding_options_vbox , false , false , 6 ) ;
2012-01-18 16:56:06 -05:00
get_vbox ( ) - > pack_start ( cue_toc_vbox , false , false , 0 ) ;
2012-06-24 07:36:33 -04:00
get_vbox ( ) - > pack_start ( name_hbox , false , false , 6 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Name, new and remove */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
name_hbox . pack_start ( name_label , false , false , 0 ) ;
2012-06-24 07:36:33 -04:00
name_hbox . pack_start ( name_entry , false , false , 0 ) ;
name_hbox . pack_start ( name_generated_part , true , true , 0 ) ;
name_entry . set_width_chars ( 20 ) ;
update_description ( ) ;
manager . DescriptionChanged . connect (
* this , invalidator ( * this ) ,
boost : : bind ( & ExportFormatDialog : : update_description , this ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Normalize */
2009-10-14 12:10:01 -04:00
2016-05-02 09:43:22 -04:00
Gtk : : RadioButtonGroup normalize_group = normalize_loudness_rb . get_group ( ) ;
normalize_peak_rb . set_group ( normalize_group ) ;
normalize_hbox . pack_start ( normalize_checkbox , false , false , 2 ) ;
normalize_hbox . pack_start ( normalize_peak_rb , false , false , 0 ) ;
normalize_hbox . pack_start ( normalize_dbfs_spinbutton , false , false , 2 ) ;
normalize_hbox . pack_start ( normalize_dbfs_label , false , false , 0 ) ;
normalize_hbox . pack_start ( * Gtk : : manage ( new Gtk : : Label ( " " ) ) , false , false , 6 ) ; // separator
normalize_hbox . pack_start ( normalize_loudness_rb , false , false , 0 ) ;
normalize_hbox . pack_start ( normalize_lufs_spinbutton , false , false , 2 ) ;
normalize_hbox . pack_start ( normalize_lufs_label , false , false , 0 ) ;
normalize_hbox . pack_start ( * Gtk : : manage ( new Gtk : : Label ( _ ( " \u2227 " ) ) ) , false , false , 4 ) ;
normalize_hbox . pack_start ( normalize_dbtp_spinbutton , false , false , 2 ) ;
normalize_hbox . pack_start ( normalize_dbtp_label , false , false , 0 ) ;
2009-10-14 12:10:01 -04:00
2017-07-15 11:38:28 -04:00
ArdourWidgets : : set_tooltip ( normalize_loudness_rb ,
2016-05-14 16:57:04 -04:00
_ ( " Normalize to EBU-R128 LUFS target loudness without exceeding the given true-peak limit. EBU-R128 normalization is only available for mono and stereo targets, true-peak works for any channel layout. " ) ) ;
2016-05-14 06:21:47 -04:00
2016-05-02 09:43:22 -04:00
normalize_dbfs_spinbutton . configure ( normalize_dbfs_adjustment , 0.1 , 2 ) ;
normalize_lufs_spinbutton . configure ( normalize_lufs_adjustment , 0.1 , 2 ) ;
normalize_dbtp_spinbutton . configure ( normalize_dbtp_adjustment , 0.1 , 2 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Silence */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
silence_table . set_row_spacings ( 6 ) ;
silence_table . set_col_spacings ( 12 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
silence_table . attach ( normalize_hbox , 0 , 3 , 0 , 1 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
silence_table . attach ( trim_start_checkbox , 0 , 1 , 1 , 2 ) ;
silence_table . attach ( silence_start_checkbox , 1 , 2 , 1 , 2 ) ;
silence_table . attach ( silence_start_clock , 2 , 3 , 1 , 2 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
silence_table . attach ( trim_end_checkbox , 0 , 1 , 2 , 3 ) ;
silence_table . attach ( silence_end_checkbox , 1 , 2 , 2 , 3 ) ;
silence_table . attach ( silence_end_clock , 2 , 3 , 2 , 3 ) ;
2009-10-14 12:10:01 -04:00
2014-07-03 13:40:07 -04:00
/* Post-export hook script */
2013-10-07 15:28:13 -04:00
get_vbox ( ) - > pack_start ( command_label , false , false ) ;
get_vbox ( ) - > pack_start ( command_entry , false , false ) ;
2017-07-15 11:38:28 -04:00
ArdourWidgets : : set_tooltip ( command_entry ,
2016-06-07 11:07:37 -04:00
_ (
" %a Artist name \n "
" %b File's base-name \n "
2016-06-12 05:00:11 -04:00
" %c Copyright \n "
2016-06-07 11:07:37 -04:00
" %d File's directory \n "
" %f File's full absolute path \n "
2016-06-12 10:26:57 -04:00
" %l Lyricist \n "
2016-06-07 11:07:37 -04:00
" %n Session name \n "
2016-06-12 05:00:11 -04:00
" %o Conductor \n "
2016-06-07 11:07:37 -04:00
" %t Title \n "
2016-06-12 05:00:11 -04:00
" %z Organization \n "
2016-06-07 11:07:37 -04:00
" %A Album \n "
" %C Comment \n "
" %E Engineer \n "
" %G Genre \n "
2016-06-12 05:00:11 -04:00
" %L Total track count \n "
" %M Mixer \n "
2016-06-07 11:07:37 -04:00
" %N Timespan name \n "
2016-06-12 05:00:11 -04:00
" %O Composer \n "
2016-06-07 11:07:37 -04:00
" %P Producer \n "
2016-06-12 05:00:11 -04:00
" %S Disc subtitle \n "
2016-06-07 11:07:37 -04:00
" %T Track number \n "
2016-06-12 05:00:11 -04:00
" %Y Year \n "
" %Z Country "
2016-06-07 11:07:37 -04:00
) ) ;
2008-09-17 08:56:00 -04:00
/* Format table */
init_format_table ( ) ;
2009-10-14 12:10:01 -04:00
2020-06-04 21:10:20 -04:00
/* Watermark */
watermark_options_table . attach ( watermark_heading , 0 , 3 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
watermark_options_table . attach ( demo_noise_mode_label , 0 , 1 , 1 , 2 , Gtk : : FILL , Gtk : : SHRINK ) ;
watermark_options_table . attach ( demo_noise_combo , 1 , 3 , 1 , 2 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
watermark_options_table . attach ( demo_noise_level_label , 0 , 1 , 2 , 3 , Gtk : : FILL , Gtk : : SHRINK ) ;
watermark_options_table . attach ( demo_noise_dbfs_spinbutton , 1 , 2 , 2 , 3 , Gtk : : FILL , Gtk : : SHRINK ) ;
watermark_options_table . attach ( demo_noise_dbfs_unit , 2 , 3 , 2 , 3 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2008-09-17 08:56:00 -04:00
/* Encoding options */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
init_encoding_option_widgets ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
encoding_options_table . set_spacings ( 1 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
encoding_options_vbox . pack_start ( encoding_options_label , false , false , 0 ) ;
encoding_options_vbox . pack_start ( encoding_options_table , false , false , 12 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Pango : : AttrList bold ;
Pango : : Attribute b = Pango : : Attribute : : create_attr_weight ( Pango : : WEIGHT_BOLD ) ;
bold . insert ( b ) ;
encoding_options_label . set_attributes ( bold ) ;
2009-10-14 12:10:01 -04:00
2018-11-19 17:45:26 -05:00
/* Codec options */
codec_quality_list = Gtk : : ListStore : : create ( codec_quality_cols ) ;
codec_quality_combo . set_model ( codec_quality_list ) ;
codec_quality_combo . pack_start ( codec_quality_cols . label ) ;
//codec_quality_combo.set_active (0);
2008-09-17 08:56:00 -04:00
/* Buttons */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
revert_button = add_button ( Gtk : : Stock : : CANCEL , Gtk : : RESPONSE_CANCEL ) ;
2009-12-11 18:29:48 -05:00
revert_button - > signal_clicked ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : revert ) ) ;
2008-09-17 08:56:00 -04:00
close_button = add_button ( Gtk : : Stock : : SAVE , Gtk : : RESPONSE_APPLY ) ;
close_button - > set_sensitive ( false ) ;
2009-12-11 18:29:48 -05:00
close_button - > signal_clicked ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : end_dialog ) ) ;
2012-04-25 08:58:19 -04:00
manager . CompleteChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & Gtk : : Button : : set_sensitive , close_button , _1 ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2012-01-18 16:56:06 -05:00
with_cue . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_with_cue ) ) ;
with_toc . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_with_toc ) ) ;
2015-04-12 08:26:39 -04:00
with_mp4chaps . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_with_mp4chaps ) ) ;
2013-10-07 15:28:13 -04:00
command_entry . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_command ) ) ;
2012-01-18 16:56:06 -05:00
cue_toc_vbox . pack_start ( with_cue , false , false ) ;
cue_toc_vbox . pack_start ( with_toc , false , false ) ;
2015-04-12 08:26:39 -04:00
cue_toc_vbox . pack_start ( with_mp4chaps , false , false ) ;
2012-01-18 16:56:06 -05:00
2008-09-17 08:56:00 -04:00
/* Load state before hooking up the rest of the signals */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
load_state ( format ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Name entry */
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
name_entry . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_name ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Normalize, silence and src_quality signals */
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
trim_start_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_trim_start_selection ) ) ;
trim_end_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_trim_end_selection ) ) ;
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
normalize_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
2016-05-02 09:43:22 -04:00
normalize_peak_rb . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
normalize_loudness_rb . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
normalize_dbfs_spinbutton . signal_value_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
normalize_lufs_spinbutton . signal_value_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
normalize_dbtp_spinbutton . signal_value_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
silence_start_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_start_selection ) ) ;
silence_start_clock . ValueChanged . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_start_selection ) ) ;
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
silence_end_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_end_selection ) ) ;
silence_end_clock . ValueChanged . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_end_selection ) ) ;
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
src_quality_combo . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_src_quality_selection ) ) ;
2018-11-19 17:45:26 -05:00
codec_quality_combo . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_codec_quality_selection ) ) ;
2009-10-14 12:10:01 -04:00
2020-06-04 21:10:20 -04:00
watermark_heading . set_attributes ( bold ) ;
demo_noise_combo . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_demo_noise_selection ) ) ;
demo_noise_dbfs_spinbutton . signal_value_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_demo_noise_selection ) ) ;
2008-09-17 08:56:00 -04:00
/* Format table signals */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : CellRendererToggle * toggle = dynamic_cast < Gtk : : CellRendererToggle * > ( compatibility_view . get_column_cell_renderer ( 0 ) ) ;
2009-12-11 18:29:48 -05:00
toggle - > signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_compatibility_selection ) ) ;
compatibility_select_connection = compatibility_view . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : prohibit_compatibility_selection ) ) ;
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
quality_view . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_quality_selection ) ) ;
format_view . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_format_selection ) ) ;
sample_rate_view . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_sample_rate_selection ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Encoding option signals */
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
sample_format_view . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_sample_format_selection ) ) ;
dither_type_view . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_dither_type_selection ) ) ;
2009-10-14 12:10:01 -04:00
2009-12-11 18:29:48 -05:00
tag_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_tagging_selection ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Finalize */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
2016-05-02 09:43:22 -04:00
update_normalize_sensitivity ( ) ;
2008-09-17 08:56:00 -04:00
}
ExportFormatDialog : : ~ ExportFormatDialog ( )
{
}
void
ExportFormatDialog : : revert ( )
{
+ + applying_changes_from_engine ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
format - > set_state ( original_state ) ;
load_state ( format ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
- - applying_changes_from_engine ;
}
void
ExportFormatDialog : : set_session ( ARDOUR : : Session * s )
{
2009-12-17 13:24:23 -05:00
SessionHandlePtr : : set_session ( s ) ;
2008-09-17 08:56:00 -04:00
silence_start_clock . set_session ( s ) ;
silence_end_clock . set_session ( s ) ;
2009-10-14 12:10:01 -04:00
2009-12-17 13:24:23 -05:00
if ( ! _session ) {
return ;
}
2008-09-17 08:56:00 -04:00
update_clock ( silence_start_clock , silence_start ) ;
update_clock ( silence_end_clock , silence_end ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Select native samplerate if no selection is yet made */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( sample_rate_view . get_selection ( ) - > count_selected_rows ( ) = = 0 ) {
Gtk : : ListStore : : Children : : iterator it ;
for ( it = sample_rate_list - > children ( ) . begin ( ) ; it ! = sample_rate_list - > children ( ) . end ( ) ; + + it ) {
2017-09-18 12:39:17 -04:00
if ( ( samplecnt_t ) ( * it ) - > get_value ( sample_rate_cols . ptr ) - > rate = = _session - > nominal_sample_rate ( ) ) {
2008-09-17 08:56:00 -04:00
sample_rate_view . get_selection ( ) - > select ( it ) ;
break ;
}
}
}
}
void
ExportFormatDialog : : load_state ( FormatPtr spec )
{
name_entry . set_text ( spec - > name ( ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
normalize_checkbox . set_active ( spec - > normalize ( ) ) ;
2016-05-02 09:43:22 -04:00
normalize_peak_rb . set_active ( ! spec - > normalize_loudness ( ) ) ;
normalize_loudness_rb . set_active ( spec - > normalize_loudness ( ) ) ;
normalize_dbfs_spinbutton . set_value ( spec - > normalize_dbfs ( ) ) ;
normalize_lufs_spinbutton . set_value ( spec - > normalize_lufs ( ) ) ;
normalize_dbtp_spinbutton . set_value ( spec - > normalize_dbtp ( ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
trim_start_checkbox . set_active ( spec - > trim_beginning ( ) ) ;
silence_start = spec - > silence_beginning_time ( ) ;
2010-12-18 14:27:04 -05:00
silence_start_checkbox . set_active ( spec - > silence_beginning_time ( ) . not_zero ( ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
trim_end_checkbox . set_active ( spec - > trim_end ( ) ) ;
silence_end = spec - > silence_end_time ( ) ;
2010-12-18 14:27:04 -05:00
silence_end_checkbox . set_active ( spec - > silence_end_time ( ) . not_zero ( ) ) ;
2009-10-14 12:10:01 -04:00
2012-01-18 16:56:06 -05:00
with_cue . set_active ( spec - > with_cue ( ) ) ;
with_toc . set_active ( spec - > with_toc ( ) ) ;
2015-04-12 08:26:39 -04:00
with_mp4chaps . set_active ( spec - > with_mp4chaps ( ) ) ;
2012-01-18 16:56:06 -05:00
2020-06-04 21:10:20 -04:00
demo_noise_combo . set_active ( 0 ) ;
for ( Gtk : : ListStore : : Children : : iterator it = demo_noise_list - > children ( ) . begin ( ) ; it ! = demo_noise_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( demo_noise_cols . interval ) = = spec - > demo_noise_interval ( )
& & it - > get_value ( demo_noise_cols . duration ) = = spec - > demo_noise_duration ( ) ) {
demo_noise_combo . set_active ( it ) ;
break ;
}
}
demo_noise_dbfs_spinbutton . set_value ( spec - > demo_noise_level ( ) ) ;
update_demo_noise_sensitivity ( ) ;
2008-09-17 08:56:00 -04:00
for ( Gtk : : ListStore : : Children : : iterator it = src_quality_list - > children ( ) . begin ( ) ; it ! = src_quality_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( src_quality_cols . id ) = = spec - > src_quality ( ) ) {
src_quality_combo . set_active ( it ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2018-11-19 17:45:26 -05:00
for ( Gtk : : ListStore : : Children : : iterator it = codec_quality_list - > children ( ) . begin ( ) ; it ! = codec_quality_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( codec_quality_cols . quality ) = = spec - > codec_quality ( ) ) {
codec_quality_combo . set_active ( it ) ;
break ;
}
}
2008-09-17 08:56:00 -04:00
for ( Gtk : : ListStore : : Children : : iterator it = format_list - > children ( ) . begin ( ) ; it ! = format_list - > children ( ) . end ( ) ; + + it ) {
2010-11-02 06:58:38 -04:00
boost : : shared_ptr < ARDOUR : : ExportFormat > format_in_list = it - > get_value ( format_cols . ptr ) ;
if ( format_in_list - > get_format_id ( ) = = spec - > format_id ( ) & &
// BWF has the same format id with wav, so we need to check this.
format_in_list - > has_broadcast_info ( ) = = spec - > has_broadcast_info ( ) ) {
format_in_list - > set_selected ( true ) ;
2008-09-17 08:56:00 -04:00
break ;
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( Gtk : : ListStore : : Children : : iterator it = sample_rate_list - > children ( ) . begin ( ) ; it ! = sample_rate_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( sample_rate_cols . ptr ) - > rate = = spec - > sample_rate ( ) ) {
it - > get_value ( sample_rate_cols . ptr ) - > set_selected ( true ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( spec - > sample_format ( ) ) {
for ( Gtk : : ListStore : : Children : : iterator it = sample_format_list - > children ( ) . begin ( ) ; it ! = sample_format_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( sample_format_cols . ptr ) - > format = = spec - > sample_format ( ) ) {
it - > get_value ( sample_format_cols . ptr ) - > set_selected ( true ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( Gtk : : ListStore : : Children : : iterator it = dither_type_list - > children ( ) . begin ( ) ; it ! = dither_type_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( dither_type_cols . ptr ) - > type = = spec - > dither_type ( ) ) {
it - > get_value ( dither_type_cols . ptr ) - > set_selected ( true ) ;
break ;
}
}
}
2009-10-14 12:10:01 -04:00
2016-05-02 09:43:22 -04:00
update_normalize_sensitivity ( ) ;
2008-09-17 08:56:00 -04:00
tag_checkbox . set_active ( spec - > tag ( ) ) ;
2013-10-07 15:28:13 -04:00
command_entry . set_text ( spec - > command ( ) ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : init_format_table ( )
{
format_table . set_spacings ( 1 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
format_table . attach ( compatibility_label , 0 , 1 , 0 , 1 ) ;
format_table . attach ( quality_label , 1 , 2 , 0 , 1 ) ;
format_table . attach ( format_label , 2 , 3 , 0 , 1 ) ;
format_table . attach ( sample_rate_label , 3 , 4 , 0 , 1 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
format_table . attach ( compatibility_view , 0 , 1 , 1 , 2 ) ;
format_table . attach ( quality_view , 1 , 2 , 1 , 2 ) ;
format_table . attach ( format_view , 2 , 3 , 1 , 2 ) ;
format_table . attach ( sample_rate_view , 3 , 4 , 1 , 2 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
format_table . attach ( src_quality_label , 0 , 3 , 2 , 3 ) ;
format_table . attach ( src_quality_combo , 3 , 4 , 2 , 3 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
compatibility_view . set_headers_visible ( false ) ;
quality_view . set_headers_visible ( false ) ;
format_view . set_headers_visible ( false ) ;
sample_rate_view . set_headers_visible ( false ) ;
/*** Table entries ***/
Gtk : : TreeModel : : iterator iter ;
Gtk : : TreeModel : : Row row ;
/* Compatibilities */
compatibility_list = Gtk : : ListStore : : create ( compatibility_cols ) ;
compatibility_view . set_model ( compatibility_list ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
ExportFormatManager : : CompatList const & compat_list = manager . get_compatibilities ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( ExportFormatManager : : CompatList : : const_iterator it = compat_list . begin ( ) ; it ! = compat_list . end ( ) ; + + it ) {
iter = compatibility_list - > append ( ) ;
row = * iter ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
row [ compatibility_cols . ptr ] = * it ;
row [ compatibility_cols . selected ] = false ;
row [ compatibility_cols . label ] = ( * it ) - > name ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
WeakCompatPtr ptr ( * it ) ;
2012-04-25 08:58:19 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_compatibility_selection , this , _1 , ptr ) , gui_context ( ) ) ;
2008-09-17 08:56:00 -04:00
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
compatibility_view . append_column_editable ( " " , compatibility_cols . selected ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : CellRendererText * text_renderer = Gtk : : manage ( new Gtk : : CellRendererText ) ;
text_renderer - > property_editable ( ) = false ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : TreeView : : Column * column = compatibility_view . get_column ( 0 ) ;
column - > pack_start ( * text_renderer ) ;
column - > add_attribute ( text_renderer - > property_text ( ) , compatibility_cols . label ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Qualities */
quality_list = Gtk : : ListStore : : create ( quality_cols ) ;
quality_view . set_model ( quality_list ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
ExportFormatManager : : QualityList const & qualities = manager . get_qualities ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( ExportFormatManager : : QualityList : : const_iterator it = qualities . begin ( ) ; it ! = qualities . end ( ) ; + + it ) {
iter = quality_list - > append ( ) ;
row = * iter ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
row [ quality_cols . ptr ] = * it ;
row [ quality_cols . color ] = " white " ;
row [ quality_cols . label ] = ( * it ) - > name ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
WeakQualityPtr ptr ( * it ) ;
2012-04-25 08:58:19 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_quality_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_quality_compatibility , this , _1 , ptr ) , gui_context ( ) ) ;
2008-09-17 08:56:00 -04:00
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
quality_view . append_column ( " " , quality_cols . label ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Formats */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
format_list = Gtk : : ListStore : : create ( format_cols ) ;
format_view . set_model ( format_list ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
ExportFormatManager : : FormatList const & formats = manager . get_formats ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( ExportFormatManager : : FormatList : : const_iterator it = formats . begin ( ) ; it ! = formats . end ( ) ; + + it ) {
iter = format_list - > append ( ) ;
row = * iter ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
row [ format_cols . ptr ] = * it ;
row [ format_cols . color ] = " white " ;
row [ format_cols . label ] = ( * it ) - > name ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
WeakFormatPtr ptr ( * it ) ;
2012-04-25 08:58:19 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_format_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_format_compatibility , this , _1 , ptr ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Encoding options */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
boost : : shared_ptr < HasSampleFormat > hsf ;
2009-10-14 12:10:01 -04:00
2012-05-23 22:54:10 -04:00
if ( ( hsf = boost : : dynamic_pointer_cast < HasSampleFormat > ( * it ) ) ) {
2012-04-25 08:58:19 -04:00
hsf - > SampleFormatSelectChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_sample_format_selection , this , _1 , _2 ) , gui_context ( ) ) ;
hsf - > SampleFormatCompatibleChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_sample_format_compatibility , this , _1 , _2 ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2012-04-25 08:58:19 -04:00
hsf - > DitherTypeSelectChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_dither_type_selection , this , _1 , _2 ) , gui_context ( ) ) ;
hsf - > DitherTypeCompatibleChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_dither_type_compatibility , this , _1 , _2 ) , gui_context ( ) ) ;
2008-09-17 08:56:00 -04:00
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
format_view . append_column ( " " , format_cols . label ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Sample Rates */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
sample_rate_list = Gtk : : ListStore : : create ( sample_rate_cols ) ;
sample_rate_view . set_model ( sample_rate_list ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
ExportFormatManager : : SampleRateList const & rates = manager . get_sample_rates ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( ExportFormatManager : : SampleRateList : : const_iterator it = rates . begin ( ) ; it ! = rates . end ( ) ; + + it ) {
iter = sample_rate_list - > append ( ) ;
row = * iter ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
row [ sample_rate_cols . ptr ] = * it ;
row [ sample_rate_cols . color ] = " white " ;
row [ sample_rate_cols . label ] = ( * it ) - > name ( ) ;
2011-06-01 13:00:29 -04:00
2008-09-17 08:56:00 -04:00
WeakSampleRatePtr ptr ( * it ) ;
2012-04-25 08:58:19 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_sample_rate_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , boost : : bind ( & ExportFormatDialog : : change_sample_rate_compatibility , this , _1 , ptr ) , gui_context ( ) ) ;
2008-09-17 08:56:00 -04:00
}
sample_rate_view . append_column ( " " , sample_rate_cols . label ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* Color rendering */
Gtk : : TreeViewColumn * label_col ;
Gtk : : CellRendererText * renderer ;
label_col = quality_view . get_column ( 0 ) ;
renderer = dynamic_cast < Gtk : : CellRendererText * > ( quality_view . get_column_cell_renderer ( 0 ) ) ;
label_col - > add_attribute ( renderer - > property_foreground ( ) , quality_cols . color ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
label_col = format_view . get_column ( 0 ) ;
renderer = dynamic_cast < Gtk : : CellRendererText * > ( format_view . get_column_cell_renderer ( 0 ) ) ;
label_col - > add_attribute ( renderer - > property_foreground ( ) , format_cols . color ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
label_col = sample_rate_view . get_column ( 0 ) ;
renderer = dynamic_cast < Gtk : : CellRendererText * > ( sample_rate_view . get_column_cell_renderer ( 0 ) ) ;
label_col - > add_attribute ( renderer - > property_foreground ( ) , sample_rate_cols . color ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
/* SRC Qualities */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
src_quality_list = Gtk : : ListStore : : create ( src_quality_cols ) ;
src_quality_combo . set_model ( src_quality_list ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_SincBest ;
row [ src_quality_cols . label ] = _ ( " Best (sinc) " ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_SincMedium ;
row [ src_quality_cols . label ] = _ ( " Medium (sinc) " ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_SincFast ;
row [ src_quality_cols . label ] = _ ( " Fast (sinc) " ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_Linear ;
row [ src_quality_cols . label ] = _ ( " Linear " ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_ZeroOrderHold ;
row [ src_quality_cols . label ] = _ ( " Zero order hold " ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
src_quality_combo . pack_start ( src_quality_cols . label ) ;
src_quality_combo . set_active ( 0 ) ;
2020-06-04 21:10:20 -04:00
/* Demo Noise Optoins */
demo_noise_list = Gtk : : ListStore : : create ( demo_noise_cols ) ;
demo_noise_combo . set_model ( demo_noise_list ) ;
iter = demo_noise_list - > append ( ) ;
row = * iter ;
row [ demo_noise_cols . duration ] = 0 ;
row [ demo_noise_cols . interval ] = 0 ;
row [ demo_noise_cols . label ] = _ ( " No Watermark " ) ;
iter = demo_noise_list - > append ( ) ;
row = * iter ;
row [ demo_noise_cols . duration ] = 500 ;
row [ demo_noise_cols . interval ] = 15000 ;
row [ demo_noise_cols . label ] = _ ( " 1/2 sec white noise every 15 sec " ) ;
iter = demo_noise_list - > append ( ) ;
row = * iter ;
row [ demo_noise_cols . duration ] = 1000 ;
row [ demo_noise_cols . interval ] = 30000 ;
row [ demo_noise_cols . label ] = _ ( " 1 sec white noise every 30 sec " ) ;
iter = demo_noise_list - > append ( ) ;
row = * iter ;
row [ demo_noise_cols . duration ] = 1000 ;
row [ demo_noise_cols . interval ] = 1200000 ;
row [ demo_noise_cols . label ] = _ ( " 1 sec white noise every 2 mins " ) ;
demo_noise_combo . pack_start ( demo_noise_cols . label ) ;
demo_noise_combo . set_active ( 0 ) ;
ArdourWidgets : : set_tooltip ( demo_noise_combo ,
_ ( " This option allows to add noise, to send complete mixes to the clients for preview but watermarked. White noise is injected after analysis, right before the sample-format conversion or encoding. The first noise burst happens at 1/3 of the interval. Note: there is currently no limiter. " ) ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : init_encoding_option_widgets ( )
{
Gtk : : TreeViewColumn * label_col ;
Gtk : : CellRendererText * renderer ;
sample_format_list = Gtk : : ListStore : : create ( sample_format_cols ) ;
sample_format_view . set_model ( sample_format_list ) ;
sample_format_view . set_headers_visible ( false ) ;
sample_format_view . append_column ( " " , sample_format_cols . label ) ;
label_col = sample_format_view . get_column ( 0 ) ;
renderer = dynamic_cast < Gtk : : CellRendererText * > ( sample_format_view . get_column_cell_renderer ( 0 ) ) ;
label_col - > add_attribute ( renderer - > property_foreground ( ) , sample_format_cols . color ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
dither_type_list = Gtk : : ListStore : : create ( dither_type_cols ) ;
dither_type_view . set_model ( dither_type_list ) ;
dither_type_view . set_headers_visible ( false ) ;
dither_type_view . append_column ( " " , dither_type_cols . label ) ;
label_col = dither_type_view . get_column ( 0 ) ;
renderer = dynamic_cast < Gtk : : CellRendererText * > ( dither_type_view . get_column_cell_renderer ( 0 ) ) ;
label_col - > add_attribute ( renderer - > property_foreground ( ) , dither_type_cols . color ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
}
void
2010-09-14 12:51:02 -04:00
ExportFormatDialog : : update_compatibility_selection ( std : : string const & path )
2008-09-17 08:56:00 -04:00
{
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : TreeModel : : iterator iter = compatibility_view . get_model ( ) - > get_iter ( path ) ;
2011-06-11 10:14:24 -04:00
ExportFormatCompatibilityPtr ptr = iter - > get_value ( compatibility_cols . ptr ) ;
2008-09-17 08:56:00 -04:00
bool state = iter - > get_value ( compatibility_cols . selected ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
iter - > set_value ( compatibility_cols . selected , state ) ;
ptr - > set_selected ( state ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : update_quality_selection ( )
{
update_selection < QualityCols > ( quality_list , quality_view , quality_cols ) ;
}
void
ExportFormatDialog : : update_format_selection ( )
{
update_selection < FormatCols > ( format_list , format_view , format_cols ) ;
}
void
ExportFormatDialog : : update_sample_rate_selection ( )
{
update_selection < SampleRateCols > ( sample_rate_list , sample_rate_view , sample_rate_cols ) ;
}
void
ExportFormatDialog : : update_sample_format_selection ( )
{
update_selection < SampleFormatCols > ( sample_format_list , sample_format_view , sample_format_cols ) ;
}
void
ExportFormatDialog : : update_dither_type_selection ( )
{
update_selection < DitherTypeCols > ( dither_type_list , dither_type_view , dither_type_cols ) ;
}
template < typename ColsT >
void
ExportFormatDialog : : update_selection ( Glib : : RefPtr < Gtk : : ListStore > & list , Gtk : : TreeView & view , ColsT & cols )
{
if ( applying_changes_from_engine ) {
return ;
}
Gtk : : ListStore : : Children : : iterator it ;
Glib : : RefPtr < Gtk : : TreeSelection > selection = view . get_selection ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( it = list - > children ( ) . begin ( ) ; it ! = list - > children ( ) . end ( ) ; + + it ) {
bool selected = selection - > is_selected ( it ) ;
it - > get_value ( cols . ptr ) - > set_selected ( selected ) ;
}
2018-11-21 17:21:52 -05:00
set_codec_quality_selection ( ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : change_compatibility_selection ( bool select , WeakCompatPtr compat )
{
+ + applying_changes_from_engine ;
2009-10-14 12:10:01 -04:00
2011-06-11 10:14:24 -04:00
ExportFormatCompatibilityPtr ptr = compat . lock ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( Gtk : : ListStore : : Children : : iterator it = compatibility_list - > children ( ) . begin ( ) ; it ! = compatibility_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( compatibility_cols . ptr ) = = ptr ) {
it - > set_value ( compatibility_cols . selected , select ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
- - applying_changes_from_engine ;
}
void
ExportFormatDialog : : change_quality_selection ( bool select , WeakQualityPtr quality )
{
change_selection < ExportFormatManager : : QualityState , QualityCols > ( select , quality , quality_list , quality_view , quality_cols ) ;
}
void
ExportFormatDialog : : change_format_selection ( bool select , WeakFormatPtr format )
{
change_selection < ExportFormat , FormatCols > ( select , format , format_list , format_view , format_cols ) ;
2011-06-11 10:14:24 -04:00
ExportFormatPtr ptr = format . lock ( ) ;
2008-09-17 08:56:00 -04:00
if ( select & & ptr ) {
change_encoding_options ( ptr ) ;
}
}
void
ExportFormatDialog : : change_sample_rate_selection ( bool select , WeakSampleRatePtr rate )
{
change_selection < ExportFormatManager : : SampleRateState , SampleRateCols > ( select , rate , sample_rate_list , sample_rate_view , sample_rate_cols ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( select ) {
ExportFormatManager : : SampleRatePtr ptr = rate . lock ( ) ;
2009-12-17 13:24:23 -05:00
if ( ptr & & _session ) {
2017-09-18 12:39:17 -04:00
src_quality_combo . set_sensitive ( ( uint32_t ) ptr - > rate ! = _session - > sample_rate ( ) ) ;
2008-09-17 08:56:00 -04:00
}
}
}
void
ExportFormatDialog : : change_sample_format_selection ( bool select , WeakSampleFormatPtr format )
{
change_selection < HasSampleFormat : : SampleFormatState , SampleFormatCols > ( select , format , sample_format_list , sample_format_view , sample_format_cols ) ;
}
void
ExportFormatDialog : : change_dither_type_selection ( bool select , WeakDitherTypePtr type )
{
change_selection < HasSampleFormat : : DitherTypeState , DitherTypeCols > ( select , type , dither_type_list , dither_type_view , dither_type_cols ) ;
}
template < typename T , typename ColsT >
void
ExportFormatDialog : : change_selection ( bool select , boost : : weak_ptr < T > w_ptr , Glib : : RefPtr < Gtk : : ListStore > & list , Gtk : : TreeView & view , ColsT & cols )
{
+ + applying_changes_from_engine ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
boost : : shared_ptr < T > ptr = w_ptr . lock ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : ListStore : : Children : : iterator it ;
Glib : : RefPtr < Gtk : : TreeSelection > selection ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
selection = view . get_selection ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( ! ptr ) {
selection - > unselect_all ( ) ;
} else {
for ( it = list - > children ( ) . begin ( ) ; it ! = list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( cols . ptr ) = = ptr ) {
if ( select ) {
selection - > select ( it ) ;
} else {
selection - > unselect ( it ) ;
}
break ;
}
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
- - applying_changes_from_engine ;
}
void
ExportFormatDialog : : change_quality_compatibility ( bool compatibility , WeakQualityPtr quality )
{
change_compatibility < ExportFormatManager : : QualityState , QualityCols > ( compatibility , quality , quality_list , quality_cols ) ;
}
void
ExportFormatDialog : : change_format_compatibility ( bool compatibility , WeakFormatPtr format )
{
change_compatibility < ExportFormat , FormatCols > ( compatibility , format , format_list , format_cols ) ;
}
void
ExportFormatDialog : : change_sample_rate_compatibility ( bool compatibility , WeakSampleRatePtr rate )
{
change_compatibility < ExportFormatManager : : SampleRateState , SampleRateCols > ( compatibility , rate , sample_rate_list , sample_rate_cols ) ;
}
void
ExportFormatDialog : : change_sample_format_compatibility ( bool compatibility , WeakSampleFormatPtr format )
{
change_compatibility < HasSampleFormat : : SampleFormatState , SampleFormatCols > ( compatibility , format , sample_format_list , sample_format_cols ) ;
}
void
ExportFormatDialog : : change_dither_type_compatibility ( bool compatibility , WeakDitherTypePtr type )
{
change_compatibility < HasSampleFormat : : DitherTypeState , DitherTypeCols > ( compatibility , type , dither_type_list , dither_type_cols , " red " ) ;
}
template < typename T , typename ColsT >
void
ExportFormatDialog : : change_compatibility ( bool compatibility , boost : : weak_ptr < T > w_ptr , Glib : : RefPtr < Gtk : : ListStore > & list , ColsT & cols ,
2010-09-14 12:51:02 -04:00
std : : string const & c_incompatible , std : : string const & c_compatible )
2008-09-17 08:56:00 -04:00
{
boost : : shared_ptr < T > ptr = w_ptr . lock ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : ListStore : : Children : : iterator it ;
for ( it = list - > children ( ) . begin ( ) ; it ! = list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( cols . ptr ) = = ptr ) {
it - > set_value ( cols . color , compatibility ? c_compatible : c_incompatible ) ;
break ;
}
}
}
2012-01-18 16:56:06 -05:00
void
ExportFormatDialog : : update_with_cue ( )
{
manager . select_with_cue ( with_cue . get_active ( ) ) ;
}
void
ExportFormatDialog : : update_with_toc ( )
{
manager . select_with_toc ( with_toc . get_active ( ) ) ;
}
2015-04-12 08:26:39 -04:00
void
ExportFormatDialog : : update_with_mp4chaps ( )
{
manager . select_with_mp4chaps ( with_mp4chaps . get_active ( ) ) ;
}
2013-10-07 15:22:56 -04:00
2013-10-07 15:28:13 -04:00
void
ExportFormatDialog : : update_command ( )
{
manager . set_command ( command_entry . get_text ( ) ) ;
}
void
2012-06-24 07:36:33 -04:00
ExportFormatDialog : : update_description ( )
{
2012-06-24 09:57:20 -04:00
std : : string text = " : " + format - > description ( false ) ;
2012-06-24 07:36:33 -04:00
name_generated_part . set_text ( text ) ;
}
2008-09-17 08:56:00 -04:00
void
ExportFormatDialog : : update_name ( )
{
manager . set_name ( name_entry . get_text ( ) ) ;
}
void
ExportFormatDialog : : update_trim_start_selection ( )
{
manager . select_trim_beginning ( trim_start_checkbox . get_active ( ) ) ;
}
void
ExportFormatDialog : : update_trim_end_selection ( )
{
manager . select_trim_end ( trim_end_checkbox . get_active ( ) ) ;
}
2016-05-02 09:43:22 -04:00
void
ExportFormatDialog : : update_normalize_sensitivity ( )
{
bool en = normalize_checkbox . get_active ( ) ;
bool loudness = normalize_loudness_rb . get_active ( ) ;
normalize_dbfs_spinbutton . set_sensitive ( ! loudness & & en ) ;
normalize_lufs_spinbutton . set_sensitive ( loudness & & en ) ;
normalize_dbtp_spinbutton . set_sensitive ( loudness & & en ) ;
}
2008-09-17 08:56:00 -04:00
void
ExportFormatDialog : : update_normalize_selection ( )
{
manager . select_normalize ( normalize_checkbox . get_active ( ) ) ;
2016-05-02 09:43:22 -04:00
manager . select_normalize_loudness ( normalize_loudness_rb . get_active ( ) ) ;
manager . select_normalize_dbfs ( normalize_dbfs_spinbutton . get_value ( ) ) ;
manager . select_normalize_lufs ( normalize_lufs_spinbutton . get_value ( ) ) ;
manager . select_normalize_dbtp ( normalize_dbtp_spinbutton . get_value ( ) ) ;
update_normalize_sensitivity ( ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : update_silence_start_selection ( )
{
update_time ( silence_start , silence_start_clock ) ;
AnyTime zero ;
2009-10-26 10:38:58 -04:00
zero . type = AnyTime : : Timecode ;
2008-09-17 08:56:00 -04:00
manager . select_silence_beginning ( silence_start_checkbox . get_active ( ) ? silence_start : zero ) ;
}
void
ExportFormatDialog : : update_silence_end_selection ( )
{
update_time ( silence_end , silence_end_clock ) ;
AnyTime zero ;
2009-10-26 10:38:58 -04:00
zero . type = AnyTime : : Timecode ;
2008-09-17 08:56:00 -04:00
manager . select_silence_end ( silence_end_checkbox . get_active ( ) ? silence_end : zero ) ;
}
void
ExportFormatDialog : : update_clock ( AudioClock & clock , ARDOUR : : AnyTime const & time )
{
// TODO position
2017-09-18 12:39:17 -04:00
clock . set ( _session - > convert_to_samples ( time ) , true ) ;
2009-10-14 12:10:01 -04:00
2009-10-26 10:38:58 -04:00
AudioClock : : Mode mode ( AudioClock : : Timecode ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
switch ( time . type ) {
2009-10-26 10:38:58 -04:00
case AnyTime : : Timecode :
mode = AudioClock : : Timecode ;
2008-09-17 08:56:00 -04:00
break ;
case AnyTime : : BBT :
mode = AudioClock : : BBT ;
break ;
2017-09-18 12:39:17 -04:00
case AnyTime : : Samples :
mode = AudioClock : : Samples ;
2008-09-17 08:56:00 -04:00
break ;
case AnyTime : : Seconds :
mode = AudioClock : : MinSec ;
break ;
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
clock . set_mode ( mode ) ;
}
void
ExportFormatDialog : : update_time ( AnyTime & time , AudioClock const & clock )
{
2009-12-17 13:24:23 -05:00
if ( ! _session ) {
2008-09-17 08:56:00 -04:00
return ;
}
2009-10-14 12:10:01 -04:00
2017-09-18 12:39:17 -04:00
samplecnt_t samples = clock . current_duration ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
switch ( clock . mode ( ) ) {
2009-10-26 10:38:58 -04:00
case AudioClock : : Timecode :
time . type = AnyTime : : Timecode ;
2017-09-18 12:39:17 -04:00
_session - > timecode_time ( samples , time . timecode ) ;
2008-09-17 08:56:00 -04:00
break ;
case AudioClock : : BBT :
time . type = AnyTime : : BBT ;
2017-09-18 12:39:17 -04:00
_session - > bbt_time ( samples , time . bbt ) ;
2008-09-17 08:56:00 -04:00
break ;
2017-11-22 14:36:28 -05:00
case AudioClock : : Seconds :
2008-09-17 08:56:00 -04:00
case AudioClock : : MinSec :
time . type = AnyTime : : Seconds ;
2017-09-18 12:39:17 -04:00
time . seconds = ( double ) samples / _session - > sample_rate ( ) ;
2008-09-17 08:56:00 -04:00
break ;
2017-09-18 12:39:17 -04:00
case AudioClock : : Samples :
time . type = AnyTime : : Samples ;
time . samples = samples ;
2008-09-17 08:56:00 -04:00
break ;
}
}
void
ExportFormatDialog : : update_src_quality_selection ( )
{
Gtk : : TreeModel : : const_iterator iter = src_quality_combo . get_active ( ) ;
ExportFormatBase : : SRCQuality quality = iter - > get_value ( src_quality_cols . id ) ;
manager . select_src_quality ( quality ) ;
}
2020-06-04 21:10:20 -04:00
void
ExportFormatDialog : : update_demo_noise_sensitivity ( )
{
Gtk : : TreeModel : : const_iterator iter = demo_noise_combo . get_active ( ) ;
if ( ! iter ) {
demo_noise_dbfs_spinbutton . set_sensitive ( false ) ;
return ;
}
int duration = iter - > get_value ( demo_noise_cols . duration ) ;
int interval = iter - > get_value ( demo_noise_cols . interval ) ;
demo_noise_dbfs_spinbutton . set_sensitive ( interval ! = 0 & & duration ! = 0 ) ;
}
void
ExportFormatDialog : : update_demo_noise_selection ( )
{
Gtk : : TreeModel : : const_iterator iter = demo_noise_combo . get_active ( ) ;
if ( ! iter ) {
demo_noise_dbfs_spinbutton . set_sensitive ( false ) ;
return ;
}
int duration = iter - > get_value ( demo_noise_cols . duration ) ;
int interval = iter - > get_value ( demo_noise_cols . interval ) ;
demo_noise_dbfs_spinbutton . set_sensitive ( interval ! = 0 & & duration ! = 0 ) ;
manager . select_demo_noise_duration ( duration ) ;
manager . select_demo_noise_interval ( interval ) ;
}
2018-11-19 17:45:26 -05:00
void
ExportFormatDialog : : update_codec_quality_selection ( )
{
Gtk : : TreeModel : : const_iterator iter = codec_quality_combo . get_active ( ) ;
if ( ! iter ) {
return ;
}
int quality = iter - > get_value ( codec_quality_cols . quality ) ;
manager . select_codec_quality ( quality ) ;
}
2008-09-17 08:56:00 -04:00
void
ExportFormatDialog : : update_tagging_selection ( )
{
manager . select_tagging ( tag_checkbox . get_active ( ) ) ;
}
void
2011-06-11 10:14:24 -04:00
ExportFormatDialog : : change_encoding_options ( ExportFormatPtr ptr )
2008-09-17 08:56:00 -04:00
{
empty_encoding_option_table ( ) ;
boost : : shared_ptr < ARDOUR : : ExportFormatLinear > linear_ptr ;
boost : : shared_ptr < ARDOUR : : ExportFormatOggVorbis > ogg_ptr ;
boost : : shared_ptr < ARDOUR : : ExportFormatFLAC > flac_ptr ;
boost : : shared_ptr < ARDOUR : : ExportFormatBWF > bwf_ptr ;
2018-11-19 17:45:26 -05:00
boost : : shared_ptr < ARDOUR : : ExportFormatFFMPEG > ffmpeg_ptr ;
2008-09-17 08:56:00 -04:00
2012-05-23 22:54:10 -04:00
if ( ( linear_ptr = boost : : dynamic_pointer_cast < ExportFormatLinear > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_linear_enconding_options ( linear_ptr ) ;
2012-05-23 22:54:10 -04:00
} else if ( ( ogg_ptr = boost : : dynamic_pointer_cast < ExportFormatOggVorbis > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_ogg_enconding_options ( ogg_ptr ) ;
2012-05-23 22:54:10 -04:00
} else if ( ( flac_ptr = boost : : dynamic_pointer_cast < ExportFormatFLAC > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_flac_enconding_options ( flac_ptr ) ;
2012-05-23 22:54:10 -04:00
} else if ( ( bwf_ptr = boost : : dynamic_pointer_cast < ExportFormatBWF > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_bwf_enconding_options ( bwf_ptr ) ;
2018-11-19 17:45:26 -05:00
} else if ( ( ffmpeg_ptr = boost : : dynamic_pointer_cast < ExportFormatFFMPEG > ( ptr ) ) ) {
show_ffmpeg_enconding_options ( ffmpeg_ptr ) ;
2008-09-17 08:56:00 -04:00
} else {
std : : cout < < " Unrecognized format! " < < std : : endl ;
}
}
void
ExportFormatDialog : : empty_encoding_option_table ( )
{
encoding_options_table . foreach ( sigc : : bind ( sigc : : mem_fun ( * this , & ExportFormatDialog : : remove_widget ) , & encoding_options_table ) ) ;
}
void
ExportFormatDialog : : remove_widget ( Gtk : : Widget & to_remove , Gtk : : Container * remove_from )
{
remove_from - > remove ( to_remove ) ;
}
void
ExportFormatDialog : : show_linear_enconding_options ( boost : : shared_ptr < ARDOUR : : ExportFormatLinear > ptr )
{
/* Set label and pack table */
encoding_options_label . set_label ( _ ( " Linear encoding options " ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
encoding_options_table . resize ( 2 , 2 ) ;
encoding_options_table . attach ( sample_format_label , 0 , 1 , 0 , 1 ) ;
encoding_options_table . attach ( dither_label , 1 , 2 , 0 , 1 ) ;
encoding_options_table . attach ( sample_format_view , 0 , 1 , 1 , 2 ) ;
encoding_options_table . attach ( dither_type_view , 1 , 2 , 1 , 2 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
fill_sample_format_lists ( boost : : dynamic_pointer_cast < HasSampleFormat > ( ptr ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
}
void
2018-11-19 21:35:25 -05:00
ExportFormatDialog : : show_ogg_enconding_options ( boost : : shared_ptr < ARDOUR : : ExportFormatOggVorbis > ptr )
2008-09-17 08:56:00 -04:00
{
encoding_options_label . set_label ( _ ( " Ogg Vorbis options " ) ) ;
2009-10-14 12:10:01 -04:00
2018-11-19 21:35:25 -05:00
encoding_options_table . resize ( 2 , 1 ) ;
encoding_options_table . attach ( codec_quality_combo , 0 , 1 , 0 , 1 ) ;
encoding_options_table . attach ( tag_checkbox , 0 , 1 , 1 , 2 ) ;
fill_codec_quality_lists ( ptr ) ;
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
}
void
ExportFormatDialog : : show_flac_enconding_options ( boost : : shared_ptr < ARDOUR : : ExportFormatFLAC > ptr )
{
encoding_options_label . set_label ( _ ( " FLAC options " ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
encoding_options_table . resize ( 3 , 2 ) ;
encoding_options_table . attach ( sample_format_label , 0 , 1 , 0 , 1 ) ;
encoding_options_table . attach ( dither_label , 1 , 2 , 0 , 1 ) ;
encoding_options_table . attach ( sample_format_view , 0 , 1 , 1 , 2 ) ;
encoding_options_table . attach ( dither_type_view , 1 , 2 , 1 , 2 ) ;
encoding_options_table . attach ( tag_checkbox , 0 , 2 , 2 , 3 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
fill_sample_format_lists ( boost : : dynamic_pointer_cast < HasSampleFormat > ( ptr ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
}
void
ExportFormatDialog : : show_bwf_enconding_options ( boost : : shared_ptr < ARDOUR : : ExportFormatBWF > ptr )
{
encoding_options_label . set_label ( _ ( " Broadcast Wave options " ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
encoding_options_table . resize ( 2 , 2 ) ;
encoding_options_table . attach ( sample_format_label , 0 , 1 , 0 , 1 ) ;
encoding_options_table . attach ( dither_label , 1 , 2 , 0 , 1 ) ;
encoding_options_table . attach ( sample_format_view , 0 , 1 , 1 , 2 ) ;
encoding_options_table . attach ( dither_type_view , 1 , 2 , 1 , 2 ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
fill_sample_format_lists ( boost : : dynamic_pointer_cast < HasSampleFormat > ( ptr ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
}
2018-11-19 17:45:26 -05:00
void
ExportFormatDialog : : show_ffmpeg_enconding_options ( boost : : shared_ptr < ARDOUR : : ExportFormatFFMPEG > ptr )
{
encoding_options_label . set_label ( _ ( " FFMPEG/MP3 options " ) ) ;
encoding_options_table . resize ( 1 , 1 ) ;
encoding_options_table . attach ( codec_quality_combo , 0 , 1 , 0 , 1 ) ;
2019-03-02 08:39:10 -05:00
encoding_options_table . attach ( tag_checkbox , 0 , 1 , 1 , 2 ) ;
2018-11-19 21:35:25 -05:00
fill_codec_quality_lists ( ptr ) ;
2018-11-19 17:45:26 -05:00
show_all_children ( ) ;
}
2008-09-17 08:56:00 -04:00
void
ExportFormatDialog : : fill_sample_format_lists ( boost : : shared_ptr < ARDOUR : : HasSampleFormat > ptr )
{
/* Fill lists */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : TreeModel : : iterator iter ;
Gtk : : TreeModel : : Row row ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
sample_format_list - > clear ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
HasSampleFormat : : SampleFormatList const & formats = ptr - > get_sample_formats ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( HasSampleFormat : : SampleFormatList : : const_iterator it = formats . begin ( ) ; it ! = formats . end ( ) ; + + it ) {
iter = sample_format_list - > append ( ) ;
row = * iter ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
row [ sample_format_cols . ptr ] = * it ;
row [ sample_format_cols . color ] = ( * it ) - > compatible ( ) ? " white " : " red " ;
row [ sample_format_cols . label ] = ( * it ) - > name ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( ( * it ) - > selected ( ) ) {
sample_format_view . get_selection ( ) - > select ( iter ) ;
}
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
dither_type_list - > clear ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
HasSampleFormat : : DitherTypeList const & types = ptr - > get_dither_types ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
for ( HasSampleFormat : : DitherTypeList : : const_iterator it = types . begin ( ) ; it ! = types . end ( ) ; + + it ) {
iter = dither_type_list - > append ( ) ;
row = * iter ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
row [ dither_type_cols . ptr ] = * it ;
row [ dither_type_cols . color ] = " white " ;
row [ dither_type_cols . label ] = ( * it ) - > name ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( ( * it ) - > selected ( ) ) {
dither_type_view . get_selection ( ) - > select ( iter ) ;
}
}
}
2018-11-19 21:35:25 -05:00
void
ExportFormatDialog : : fill_codec_quality_lists ( boost : : shared_ptr < ARDOUR : : HasCodecQuality > ptr )
{
HasCodecQuality : : CodecQualityList const & codecs = ptr - > get_codec_qualities ( ) ;
codec_quality_list - > clear ( ) ;
for ( HasCodecQuality : : CodecQualityList : : const_iterator it = codecs . begin ( ) ; it ! = codecs . end ( ) ; + + it ) {
Gtk : : TreeModel : : iterator iter = codec_quality_list - > append ( ) ;
Gtk : : TreeModel : : Row row = * iter ;
row [ codec_quality_cols . quality ] = ( * it ) - > quality ;
row [ codec_quality_cols . label ] = ( * it ) - > name ;
}
2018-11-21 17:21:52 -05:00
set_codec_quality_selection ( ) ;
}
2018-11-19 21:35:25 -05:00
2018-11-21 17:21:52 -05:00
void
ExportFormatDialog : : set_codec_quality_selection ( )
{
2018-11-19 21:35:25 -05:00
for ( Gtk : : ListStore : : Children : : iterator it = codec_quality_list - > children ( ) . begin ( ) ; it ! = codec_quality_list - > children ( ) . end ( ) ; + + it ) {
if ( it - > get_value ( codec_quality_cols . quality ) = = format - > codec_quality ( ) ) {
codec_quality_combo . set_active ( it ) ;
break ;
}
}
}
2008-09-17 08:56:00 -04:00
void
ExportFormatDialog : : end_dialog ( )
{
hide_all ( ) ;
}
void
ExportFormatDialog : : prohibit_compatibility_selection ( )
{
compatibility_select_connection . block ( true ) ;
compatibility_view . get_selection ( ) - > unselect_all ( ) ;
compatibility_select_connection . block ( false ) ;
}