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
2020-11-18 13:26:32 -05:00
# include <gtkmm/frame.h>
2020-11-18 13:26:45 -05:00
# include <gtkmm/stock.h>
2017-07-16 21:48:18 -04:00
2009-02-25 13:26:51 -05:00
# include "ardour/export_format_specification.h"
2020-11-18 13:26:45 -05:00
# include "ardour/session.h"
2008-09-17 08:56:00 -04:00
2021-12-14 15:23:19 -05:00
# include "temporal/tempo.h"
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 ;
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : ExportFormatDialog ( FormatPtr format , bool new_dialog )
: ArdourDialog ( new_dialog ? _ ( " New Export Format Profile " ) : _ ( " Edit Export Format Profile " ) )
2008-09-17 08:56:00 -04:00
2020-11-18 13:26:45 -05:00
, format ( format )
, manager ( format )
, original_state ( format - > get_state ( ) )
2016-05-02 09:43:22 -04:00
2020-11-18 13:26:45 -05:00
, applying_changes_from_engine ( 0 )
2008-09-17 08:56:00 -04:00
2022-01-26 16:19:32 -05:00
, name_label ( _ ( " Label: " ) , Gtk : : ALIGN_START )
, name_generated_part ( " " , Gtk : : ALIGN_START )
2008-09-17 08:56:00 -04:00
2020-11-18 13:26:45 -05: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 )
2008-09-17 08:56:00 -04:00
2022-01-26 16:19:32 -05:00
, normalize_dbfs_label ( _ ( " dBFS " ) , Gtk : : ALIGN_START )
, normalize_lufs_label ( _ ( " LUFS " ) , Gtk : : ALIGN_START )
, normalize_dbtp_label ( _ ( " dBTP " ) , Gtk : : ALIGN_START )
2013-10-07 09:44:35 -04:00
2020-11-18 13:26:45 -05:00
, silence_table ( 2 , 4 )
, trim_start_checkbox ( _ ( " Trim silence at start " ) )
, silence_start_checkbox ( _ ( " Add silence at start: " ) )
, silence_start_clock ( " silence_start " , true , " " , true , false , true )
2020-11-18 13:26:32 -05:00
2020-11-18 13:26:45 -05:00
, trim_end_checkbox ( _ ( " Trim silence at end " ) )
, silence_end_checkbox ( _ ( " Add silence at end: " ) )
, silence_end_clock ( " silence_end " , true , " " , true , false , true )
2008-09-17 08:56:00 -04:00
2024-03-23 07:19:30 -04:00
, command_label ( _ ( " Command to run post-export \n (%f=file path, %d=directory, %b=basename; see tooltip for more, \n don't add quotes around arguments): " ) , Gtk : : ALIGN_START )
2020-06-04 21:10:20 -04:00
2020-11-18 13:26:45 -05:00
, format_table ( 3 , 4 )
2022-01-26 16:19:32 -05:00
, compatibility_label ( _ ( " Compatibility " ) , Gtk : : ALIGN_START )
, quality_label ( _ ( " Quality " ) , Gtk : : ALIGN_START )
2022-11-10 19:53:19 -05:00
, format_label ( _ ( " File Format " ) , Gtk : : ALIGN_START )
, sample_rate_label ( _ ( " Sample Rate " ) , Gtk : : ALIGN_START )
2020-06-04 21:10:20 -04:00
2022-11-10 19:53:19 -05:00
, src_quality_label ( _ ( " Sample Rate Conversion Quality: " ) , Gtk : : ALIGN_END )
2020-06-04 21:10:20 -04:00
2020-11-18 13:26:45 -05:00
/* Watermarking */
2022-01-26 16:19:32 -05:00
, watermark_heading ( _ ( " Preview / Watermark " ) , Gtk : : ALIGN_START )
2020-06-04 21:10:20 -04:00
2022-01-26 16:19:32 -05:00
, demo_noise_mode_label ( _ ( " Mode: " ) , Gtk : : ALIGN_START )
, demo_noise_level_label ( _ ( " Noise Level: " ) , Gtk : : ALIGN_START )
, demo_noise_dbfs_unit ( _ ( " dBFS " ) , Gtk : : ALIGN_START )
2008-09-17 08:56:00 -04:00
2020-11-18 13:26:45 -05:00
, demo_noise_dbfs_adjustment ( - 20.0 , - 90.00 , - 6.00 , 1 , 5 )
, demo_noise_dbfs_spinbutton ( demo_noise_dbfs_adjustment , 1 , 0 )
2008-09-17 08:56:00 -04:00
2020-11-18 13:26:45 -05:00
/* Changing encoding options from here on */
2022-01-26 16:19:32 -05:00
, encoding_options_label ( " " , Gtk : : ALIGN_START )
2008-09-17 08:56:00 -04:00
2020-11-18 13:26:45 -05:00
/* Changing encoding options from here on */
2022-01-26 16:19:32 -05:00
, sample_format_label ( _ ( " Sample Format " ) , Gtk : : ALIGN_START )
, dither_label ( _ ( " Dithering " ) , Gtk : : ALIGN_START )
2012-01-18 16:56:06 -05:00
2020-11-18 13:26:45 -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 " ) )
, with_mp4chaps ( _ ( " Create chapter mark file for MP4 chapter marks " ) )
, tag_checkbox ( _ ( " Tag file with session's metadata " ) )
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 ) ;
2020-11-18 13:26:45 -05:00
name_entry . set_width_chars ( 20 ) ;
update_description ( ) ;
manager . DescriptionChanged . connect (
* this , invalidator ( * this ) ,
2024-10-18 19:51:44 -04:00
std : : 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
2022-01-26 15:11:15 -05:00
normalize_tp_limiter . append ( _ ( " limit to " ) ) ;
normalize_tp_limiter . append ( _ ( " constrain to " ) ) ;
2021-04-08 15:21:33 -04:00
2020-11-18 13:26:45 -05:00
Gtk : : RadioButtonGroup normalize_group = normalize_loudness_rb . get_group ( ) ;
2016-05-02 09:43:22 -04:00
normalize_peak_rb . set_group ( normalize_group ) ;
2021-04-08 15:21:33 -04:00
normalize_table . set_row_spacings ( 4 ) ;
normalize_table . set_col_spacings ( 4 ) ;
2016-05-02 09:43:22 -04:00
2021-04-08 15:21:33 -04:00
normalize_table . attach ( normalize_checkbox , 0 , 1 , 0 , 1 ) ;
normalize_table . attach ( normalize_peak_rb , 1 , 2 , 0 , 1 ) ;
normalize_table . attach ( normalize_dbfs_spinbutton , 2 , 3 , 0 , 1 ) ;
normalize_table . attach ( normalize_dbfs_label , 3 , 4 , 0 , 1 ) ;
2016-05-02 09:43:22 -04:00
2021-04-08 15:21:33 -04:00
normalize_table . attach ( normalize_loudness_rb , 1 , 2 , 1 , 2 ) ;
normalize_table . attach ( normalize_lufs_spinbutton , 2 , 3 , 1 , 2 ) ;
normalize_table . attach ( normalize_lufs_label , 3 , 4 , 1 , 2 ) ;
normalize_table . attach ( normalize_tp_limiter , 4 , 5 , 1 , 2 ) ;
normalize_table . attach ( normalize_dbtp_spinbutton , 5 , 6 , 1 , 2 ) ;
normalize_table . attach ( normalize_dbtp_label , 6 , 7 , 1 , 2 ) ;
2009-10-14 12:10:01 -04:00
2017-07-15 11:38:28 -04:00
ArdourWidgets : : set_tooltip ( normalize_loudness_rb ,
2020-11-18 13:26:45 -05: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
2021-04-08 15:21:33 -04:00
silence_table . attach ( normalize_table , 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
2020-11-18 13:26:32 -05:00
/* post export */
command_box . pack_start ( command_label , false , false ) ;
command_box . pack_start ( command_entry , false , false , 6 ) ;
2013-10-07 15:28:13 -04:00
2017-07-15 11:38:28 -04:00
ArdourWidgets : : set_tooltip ( command_entry ,
2020-11-18 13:26:45 -05:00
_ (
" %a Artist name \n "
" %b File's base-name \n "
" %c Copyright \n "
" %d File's directory \n "
" %f File's full absolute path \n "
" %l Lyricist \n "
" %n Session name \n "
" %o Conductor \n "
" %t Title \n "
" %z Organization \n "
" %A Album \n "
" %C Comment \n "
" %E Engineer \n "
" %G Genre \n "
" %L Total track count \n "
" %M Mixer \n "
" %N Timespan name \n "
" %O Composer \n "
" %P Producer \n "
" %S Disc subtitle \n "
" %T Track number \n "
" %Y Year \n "
" %Z Country " ) ) ;
2016-06-07 11:07:37 -04:00
2008-09-17 08:56:00 -04:00
/* Format table */
2020-11-18 13:26:45 -05:00
init_format_table ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:32 -05:00
/* SRC */
src_quality_box . pack_start ( src_quality_label , true , true ) ;
src_quality_box . pack_start ( src_quality_combo , false , false ) ;
2020-06-04 21:10:20 -04:00
/* Watermark */
2020-11-18 13:26:45 -05:00
watermark_options_table . attach ( watermark_heading , 0 , 3 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-06-04 21:10:20 -04:00
watermark_options_table . attach ( demo_noise_mode_label , 0 , 1 , 1 , 2 , Gtk : : FILL , Gtk : : SHRINK ) ;
2020-11-18 13:26:45 -05:00
watermark_options_table . attach ( demo_noise_combo , 1 , 3 , 1 , 2 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-06-04 21:10:20 -04:00
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 ) ;
2020-11-18 13:26:45 -05:00
watermark_options_table . attach ( demo_noise_dbfs_unit , 2 , 3 , 2 , 3 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-06-04 21:10:20 -04:00
2008-09-17 08:56:00 -04:00
/* Encoding options */
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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 ) ;
2020-11-18 13:26:32 -05:00
encoding_options_vbox . pack_end ( src_quality_box , false , false ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
Pango : : AttrList bold ;
2008-09-17 08:56:00 -04:00
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 ) ;
2020-11-18 13:26:45 -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 ) ;
2020-11-18 13:26:45 -05:00
close_button - > signal_clicked ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : end_dialog ) ) ;
2024-10-18 19:51:44 -04:00
manager . CompleteChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & Gtk : : Button : : set_sensitive , close_button , _1 ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -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 ) ) ;
with_mp4chaps . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_with_mp4chaps ) ) ;
command_entry . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_command ) ) ;
2012-01-18 16:56:06 -05:00
2020-11-18 13:26:32 -05:00
metadata_table . attach ( tag_checkbox , 0 , 1 , 0 , 1 ) ;
metadata_table . attach ( with_mp4chaps , 0 , 1 , 1 , 2 ) ;
metadata_table . attach ( with_cue , 1 , 2 , 0 , 1 ) ;
metadata_table . attach ( with_toc , 1 , 2 , 1 , 2 ) ;
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
2020-11-18 13:26:45 -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
2020-11-18 13:26:45 -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
2020-11-18 13:26:45 -05:00
normalize_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
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 ) ) ;
2021-04-08 15:21:33 -04:00
normalize_tp_limiter . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_normalize_selection ) ) ;
2020-11-18 13:26:45 -05:00
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
2020-11-18 13:26:45 -05:00
silence_start_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_start_selection ) ) ;
2009-12-11 18:29:48 -05:00
silence_start_clock . ValueChanged . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_start_selection ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
silence_end_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_end_selection ) ) ;
2009-12-11 18:29:48 -05:00
silence_end_clock . ValueChanged . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_silence_end_selection ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
src_quality_combo . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_src_quality_selection ) ) ;
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 ) ;
2020-11-18 13:26:45 -05:00
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 ) ) ;
2020-06-04 21:10:20 -04:00
2008-09-17 08:56:00 -04:00
/* Format table signals */
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
Gtk : : CellRendererToggle * toggle = dynamic_cast < Gtk : : CellRendererToggle * > ( compatibility_view . get_column_cell_renderer ( 0 ) ) ;
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
2020-11-18 13:26:45 -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
2020-11-18 13:26:45 -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
2020-11-18 13:26:45 -05:00
tag_checkbox . signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & ExportFormatDialog : : update_tagging_selection ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:32 -05:00
/* Pack containers in dialog */
Gtk : : Frame * f ;
Gtk : : Table * g = manage ( new Gtk : : Table ) ;
g - > set_spacings ( 6 ) ;
2020-11-18 13:26:45 -05:00
get_vbox ( ) - > pack_start ( * g ) ;
2020-11-18 13:26:32 -05:00
2020-11-18 13:26:45 -05:00
g - > attach ( name_hbox , 0 , 2 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-11-18 13:26:32 -05:00
2020-11-19 11:02:12 -05:00
f = Gtk : : manage ( new Gtk : : Frame ( _ ( " Pre Process " ) ) ) ;
2020-11-18 13:26:32 -05:00
f - > add ( silence_table ) ;
2020-11-18 13:26:45 -05:00
g - > attach ( * f , 0 , 1 , 1 , 2 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-11-19 11:02:12 -05:00
f = Gtk : : manage ( new Gtk : : Frame ( _ ( " Watermark " ) ) ) ;
2020-11-18 13:26:32 -05:00
f - > add ( watermark_options_table ) ;
2020-11-18 13:26:45 -05:00
g - > attach ( * f , 1 , 2 , 1 , 2 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : FILL ) ;
2020-11-18 13:26:32 -05:00
2020-11-19 11:02:12 -05:00
f = Gtk : : manage ( new Gtk : : Frame ( _ ( " Format " ) ) ) ;
2020-11-18 13:26:32 -05:00
f - > add ( format_table ) ;
g - > attach ( * f , 0 , 1 , 2 , 3 ) ;
2020-11-19 11:02:12 -05:00
f = Gtk : : manage ( new Gtk : : Frame ( _ ( " Encoding " ) ) ) ;
2020-11-18 13:26:32 -05:00
f - > add ( encoding_options_vbox ) ;
g - > attach ( * f , 1 , 2 , 2 , 3 ) ;
2020-11-19 11:02:12 -05:00
f = Gtk : : manage ( new Gtk : : Frame ( _ ( " Metadata " ) ) ) ;
2020-11-18 13:26:32 -05:00
f - > add ( metadata_table ) ;
2020-11-18 13:26:45 -05:00
g - > attach ( * f , 0 , 2 , 3 , 4 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-11-18 13:26:32 -05:00
2020-11-19 11:02:12 -05:00
f = Gtk : : manage ( new Gtk : : Frame ( _ ( " Post Export " ) ) ) ;
2020-11-18 13:26:32 -05:00
f - > add ( command_box ) ;
2020-11-18 13:26:45 -05:00
g - > attach ( * f , 0 , 2 , 4 , 5 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2020-11-18 13:26:32 -05:00
2008-09-17 08:56:00 -04:00
/* Finalize */
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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 ) ;
2009-10-14 12:10:01 -04:00
2009-12-17 13:24:23 -05:00
if ( ! _session ) {
return ;
}
2024-11-07 11:23:42 -05:00
silence_start_clock . set_session ( s ) ;
silence_end_clock . set_session ( s ) ;
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
2020-11-18 13:26:45 -05:00
if ( sample_rate_view . get_selection ( ) - > count_selected_rows ( ) = = 0 ) {
2008-09-17 08:56:00 -04:00
Gtk : : ListStore : : Children : : iterator it ;
2020-11-18 13:26:45 -05:00
for ( it = sample_rate_list - > children ( ) . begin ( ) ; it ! = sample_rate_list - > children ( ) . end ( ) ; + + it ) {
if ( ( samplecnt_t ) ( * it ) - > get_value ( sample_rate_cols . ptr ) - > rate = = _session - > nominal_sample_rate ( ) ) {
sample_rate_view . get_selection ( ) - > select ( it ) ;
2008-09-17 08:56:00 -04:00
break ;
}
}
}
}
void
ExportFormatDialog : : load_state ( FormatPtr spec )
{
2020-11-18 13:26:45 -05:00
name_entry . set_text ( spec - > name ( ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
normalize_checkbox . set_active ( spec - > normalize ( ) ) ;
normalize_peak_rb . set_active ( ! spec - > normalize_loudness ( ) ) ;
2021-04-08 15:21:33 -04:00
normalize_tp_limiter . set_active ( spec - > use_tp_limiter ( ) ? 0 : 1 ) ;
2020-11-18 13:26:45 -05:00
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
2020-11-18 13:26:45 -05:00
trim_start_checkbox . set_active ( spec - > trim_beginning ( ) ) ;
silence_start = spec - > silence_beginning_time ( ) ;
silence_start_checkbox . set_active ( spec - > silence_beginning_time ( ) . not_zero ( ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
trim_end_checkbox . set_active ( spec - > trim_end ( ) ) ;
silence_end = spec - > silence_end_time ( ) ;
silence_end_checkbox . set_active ( spec - > silence_end_time ( ) . not_zero ( ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
with_cue . set_active ( spec - > with_cue ( ) ) ;
with_toc . set_active ( spec - > with_toc ( ) ) ;
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 ) ;
2020-11-18 13:26:45 -05:00
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 ( ) ) {
2020-06-04 21:10:20 -04:00
demo_noise_combo . set_active ( it ) ;
break ;
}
}
demo_noise_dbfs_spinbutton . set_value ( spec - > demo_noise_level ( ) ) ;
update_demo_noise_sensitivity ( ) ;
2020-11-18 13:26:45 -05: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 ( ) ) {
2008-09-17 08:56:00 -04:00
src_quality_combo . set_active ( it ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -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 ( ) ) {
2018-11-19 17:45:26 -05:00
codec_quality_combo . set_active ( it ) ;
break ;
}
}
2020-11-18 13:26:45 -05:00
for ( Gtk : : ListStore : : Children : : iterator it = format_list - > children ( ) . begin ( ) ; it ! = format_list - > children ( ) . end ( ) ; + + it ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < ARDOUR : : ExportFormat > format_in_list = it - > get_value ( format_cols . ptr ) ;
2022-12-07 11:57:56 -05:00
if ( spec - > is_format ( format_in_list ) ) {
2010-11-02 06:58:38 -04:00
format_in_list - > set_selected ( true ) ;
2008-09-17 08:56:00 -04:00
break ;
}
}
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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 ( ) ) {
2008-09-17 08:56:00 -04:00
it - > get_value ( sample_rate_cols . ptr ) - > set_selected ( true ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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 ( ) ) {
2008-09-17 08:56:00 -04:00
it - > get_value ( sample_format_cols . ptr ) - > set_selected ( true ) ;
break ;
}
}
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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 ( ) ) {
2008-09-17 08:56:00 -04:00
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 ( ) ;
2020-11-18 13:26:45 -05:00
tag_checkbox . set_active ( spec - > tag ( ) ) ;
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
2020-11-18 13:26:45 -05:00
format_table . attach ( compatibility_label , 0 , 1 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
format_table . attach ( quality_label , 1 , 2 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
format_table . attach ( format_label , 2 , 3 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
format_table . attach ( sample_rate_label , 3 , 4 , 0 , 1 , Gtk : : EXPAND | Gtk : : FILL , Gtk : : SHRINK ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
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 ;
2020-11-18 13:26:45 -05:00
Gtk : : TreeModel : : Row row ;
2008-09-17 08:56:00 -04:00
/* Compatibilities */
compatibility_list = Gtk : : ListStore : : create ( compatibility_cols ) ;
compatibility_view . set_model ( compatibility_list ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
ExportFormatManager : : CompatList const & compat_list = manager . get_compatibilities ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
row [ compatibility_cols . ptr ] = * it ;
2008-09-17 08:56:00 -04:00
row [ compatibility_cols . selected ] = false ;
2020-11-18 13:26:45 -05:00
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 ) ;
2024-10-18 19:51:44 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , std : : 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 ) ;
2020-11-18 13:26:45 -05:00
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 ) ;
2020-11-18 13:26:45 -05:00
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
2020-11-18 13:26:45 -05:00
ExportFormatManager : : QualityList const & qualities = manager . get_qualities ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
row [ quality_cols . ptr ] = * it ;
2008-09-17 08:56:00 -04:00
row [ quality_cols . color ] = " white " ;
2020-11-18 13:26:45 -05:00
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 ) ;
2024-10-18 19:51:44 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_quality_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , std : : 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
2020-11-18 13:26:45 -05:00
ExportFormatManager : : FormatList const & formats = manager . get_formats ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
row [ format_cols . ptr ] = * it ;
2008-09-17 08:56:00 -04:00
row [ format_cols . color ] = " white " ;
2020-11-18 13:26:45 -05:00
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 ) ;
2024-10-18 19:51:44 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_format_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , std : : 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
2023-02-16 18:33:28 -05:00
std : : shared_ptr < HasSampleFormat > hsf ;
2009-10-14 12:10:01 -04:00
2023-02-16 18:33:28 -05:00
if ( ( hsf = std : : dynamic_pointer_cast < HasSampleFormat > ( * it ) ) ) {
2024-10-18 19:51:44 -04:00
hsf - > SampleFormatSelectChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_sample_format_selection , this , _1 , _2 ) , gui_context ( ) ) ;
hsf - > SampleFormatCompatibleChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_sample_format_compatibility , this , _1 , _2 ) , gui_context ( ) ) ;
2009-10-14 12:10:01 -04:00
2024-10-18 19:51:44 -04:00
hsf - > DitherTypeSelectChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_dither_type_selection , this , _1 , _2 ) , gui_context ( ) ) ;
hsf - > DitherTypeCompatibleChanged . connect ( * this , invalidator ( * this ) , std : : 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
2020-11-18 13:26:45 -05:00
ExportFormatManager : : SampleRateList const & rates = manager . get_sample_rates ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
row [ sample_rate_cols . ptr ] = * it ;
2008-09-17 08:56:00 -04:00
row [ sample_rate_cols . color ] = " white " ;
2020-11-18 13:26:45 -05:00
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 ) ;
2024-10-18 19:51:44 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_sample_rate_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , std : : 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 */
2020-11-18 13:26:45 -05:00
Gtk : : TreeViewColumn * label_col ;
Gtk : : CellRendererText * renderer ;
2008-09-17 08:56:00 -04:00
2020-11-18 13:26:45 -05:00
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
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_SincBest ;
2008-09-17 08:56:00 -04:00
row [ src_quality_cols . label ] = _ ( " Best (sinc) " ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_SincMedium ;
2008-09-17 08:56:00 -04:00
row [ src_quality_cols . label ] = _ ( " Medium (sinc) " ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_SincFast ;
2008-09-17 08:56:00 -04:00
row [ src_quality_cols . label ] = _ ( " Fast (sinc) " ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_Linear ;
2008-09-17 08:56:00 -04:00
row [ src_quality_cols . label ] = _ ( " Linear " ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
iter = src_quality_list - > append ( ) ;
row = * iter ;
row [ src_quality_cols . id ] = ExportFormatBase : : SRC_ZeroOrderHold ;
2008-09-17 08:56:00 -04:00
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
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
/* Demo Noise Options */
2020-06-04 21:10:20 -04:00
demo_noise_list = Gtk : : ListStore : : create ( demo_noise_cols ) ;
demo_noise_combo . set_model ( demo_noise_list ) ;
2020-11-18 13:26:45 -05:00
iter = demo_noise_list - > append ( ) ;
row = * iter ;
2020-06-04 21:10:20 -04:00
row [ demo_noise_cols . duration ] = 0 ;
row [ demo_noise_cols . interval ] = 0 ;
2020-11-18 13:26:45 -05:00
row [ demo_noise_cols . label ] = _ ( " No Watermark " ) ;
2020-06-04 21:10:20 -04:00
2020-11-18 13:26:45 -05:00
iter = demo_noise_list - > append ( ) ;
row = * iter ;
2020-06-04 21:10:20 -04:00
row [ demo_noise_cols . duration ] = 500 ;
row [ demo_noise_cols . interval ] = 15000 ;
2020-11-18 13:26:45 -05:00
row [ demo_noise_cols . label ] = _ ( " 1/2 sec white noise every 15 sec " ) ;
2020-06-04 21:10:20 -04:00
2020-11-18 13:26:45 -05:00
iter = demo_noise_list - > append ( ) ;
row = * iter ;
2020-06-04 21:10:20 -04:00
row [ demo_noise_cols . duration ] = 1000 ;
row [ demo_noise_cols . interval ] = 30000 ;
2020-11-18 13:26:45 -05:00
row [ demo_noise_cols . label ] = _ ( " 1 sec white noise every 30 sec " ) ;
2020-06-04 21:10:20 -04:00
2020-11-18 13:26:45 -05:00
iter = demo_noise_list - > append ( ) ;
row = * iter ;
2020-06-04 21:10:20 -04:00
row [ demo_noise_cols . duration ] = 1000 ;
row [ demo_noise_cols . interval ] = 1200000 ;
2020-11-18 13:26:45 -05:00
row [ demo_noise_cols . label ] = _ ( " 1 sec white noise every 2 mins " ) ;
2020-06-04 21:10:20 -04:00
demo_noise_combo . pack_start ( demo_noise_cols . label ) ;
demo_noise_combo . set_active ( 0 ) ;
ArdourWidgets : : set_tooltip ( demo_noise_combo ,
2022-10-17 09:56:50 -04:00
_ ( " This option allows one 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 ( )
{
2020-11-18 13:26:45 -05:00
Gtk : : TreeViewColumn * label_col ;
Gtk : : CellRendererText * renderer ;
2008-09-17 08:56:00 -04:00
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 ) ;
2020-11-18 13:26:45 -05:00
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 ) ;
2020-11-18 13:26:45 -05:00
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 ) ;
2008-09-17 08:56:00 -04:00
}
void
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : update_compatibility_selection ( std : : string const & path )
2008-09-17 08:56:00 -04:00
{
2020-11-18 13:26:45 -05:00
Gtk : : TreeModel : : iterator iter = compatibility_view . get_model ( ) - > get_iter ( path ) ;
ExportFormatCompatibilityPtr ptr = iter - > get_value ( compatibility_cols . ptr ) ;
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 ) ;
}
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 ) ;
}
2020-11-18 13:26:45 -05:00
template < typename ColsT >
2008-09-17 08:56:00 -04:00
void
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : update_selection ( Glib : : RefPtr < Gtk : : ListStore > & list , Gtk : : TreeView & view , ColsT & cols )
2008-09-17 08:56:00 -04:00
{
if ( applying_changes_from_engine ) {
return ;
}
Gtk : : ListStore : : Children : : iterator it ;
2020-11-18 13:26:45 -05:00
Glib : : RefPtr < Gtk : : TreeSelection > selection = view . get_selection ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
for ( it = list - > children ( ) . begin ( ) ; it ! = list - > children ( ) . end ( ) ; + + it ) {
2008-09-17 08:56:00 -04:00
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
2020-11-18 13:26:45 -05:00
ExportFormatCompatibilityPtr ptr = compat . lock ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
for ( Gtk : : ListStore : : Children : : iterator it = compatibility_list - > children ( ) . begin ( ) ; it ! = compatibility_list - > children ( ) . end ( ) ; + + it ) {
2008-09-17 08:56:00 -04:00
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 ) ;
2020-11-18 13:26:45 -05: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 ) {
2020-11-18 13:26:45 -05:00
ExportFormatManager : : SampleRatePtr ptr = rate . lock ( ) ;
2009-12-17 13:24:23 -05:00
if ( ptr & & _session ) {
2020-11-18 13:26:45 -05:00
src_quality_combo . set_sensitive ( ( uint32_t ) ptr - > rate ! = _session - > sample_rate ( ) & & ptr - > rate ! = ExportFormatBase : : SR_Session ) ;
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 ) ;
}
2020-11-18 13:26:45 -05:00
template < typename T , typename ColsT >
2008-09-17 08:56:00 -04:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : change_selection ( bool select , std : : weak_ptr < T > w_ptr , Glib : : RefPtr < Gtk : : ListStore > & list , Gtk : : TreeView & view , ColsT & cols )
2008-09-17 08:56:00 -04:00
{
+ + applying_changes_from_engine ;
2009-10-14 12:10:01 -04:00
2023-02-16 18:33:28 -05:00
std : : 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 ;
2020-11-18 13:26:45 -05:00
Glib : : RefPtr < Gtk : : TreeSelection > selection ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
selection = view . get_selection ( ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
if ( ! ptr ) {
2020-11-18 13:26:45 -05:00
selection - > unselect_all ( ) ;
2008-09-17 08:56:00 -04:00
} else {
2020-11-18 13:26:45 -05:00
for ( it = list - > children ( ) . begin ( ) ; it ! = list - > children ( ) . end ( ) ; + + it ) {
2008-09-17 08:56:00 -04:00
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 " ) ;
}
2020-11-18 13:26:45 -05:00
template < typename T , typename ColsT >
2008-09-17 08:56:00 -04:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : change_compatibility ( bool compatibility , std : : weak_ptr < T > w_ptr , Glib : : RefPtr < Gtk : : ListStore > & list , ColsT & cols ,
2020-11-18 13:26:45 -05:00
std : : string const & c_incompatible , std : : string const & c_compatible )
2008-09-17 08:56:00 -04:00
{
2023-02-16 18:33:28 -05:00
std : : 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 ;
2020-11-18 13:26:45 -05:00
for ( it = list - > children ( ) . begin ( ) ; it ! = list - > children ( ) . end ( ) ; + + it ) {
2008-09-17 08:56:00 -04:00
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 ( )
{
2020-11-18 13:26:45 -05:00
manager . select_with_cue ( with_cue . get_active ( ) ) ;
2012-01-18 16:56:06 -05:00
}
void
ExportFormatDialog : : update_with_toc ( )
{
2020-11-18 13:26:45 -05:00
manager . select_with_toc ( with_toc . get_active ( ) ) ;
2012-01-18 16:56:06 -05:00
}
2015-04-12 08:26:39 -04:00
void
ExportFormatDialog : : update_with_mp4chaps ( )
{
2020-11-18 13:26:45 -05:00
manager . select_with_mp4chaps ( with_mp4chaps . get_active ( ) ) ;
2015-04-12 08:26:39 -04:00
}
2013-10-07 15:22:56 -04:00
2013-10-07 15:28:13 -04:00
void
ExportFormatDialog : : update_command ( )
{
2020-11-18 13:26:45 -05:00
manager . set_command ( command_entry . get_text ( ) ) ;
2013-10-07 15:28:13 -04:00
}
void
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : update_description ( )
2012-06-24 07:36:33 -04:00
{
2020-11-18 13:26:45 -05:00
std : : string text = " : " + format - > description ( false ) ;
name_generated_part . set_text ( text ) ;
2012-06-24 07:36:33 -04:00
}
2008-09-17 08:56:00 -04:00
void
ExportFormatDialog : : update_name ( )
{
2020-11-18 13:26:45 -05:00
manager . set_name ( name_entry . get_text ( ) ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : update_trim_start_selection ( )
{
2020-11-18 13:26:45 -05:00
manager . select_trim_beginning ( trim_start_checkbox . get_active ( ) ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : update_trim_end_selection ( )
{
2020-11-18 13:26:45 -05:00
manager . select_trim_end ( trim_end_checkbox . get_active ( ) ) ;
2008-09-17 08:56:00 -04:00
}
2016-05-02 09:43:22 -04:00
void
ExportFormatDialog : : update_normalize_sensitivity ( )
{
2020-11-18 13:26:45 -05:00
bool en = normalize_checkbox . get_active ( ) ;
bool loudness = normalize_loudness_rb . get_active ( ) ;
2021-04-08 15:21:33 -04:00
normalize_tp_limiter . set_sensitive ( loudness & & en ) ;
2016-05-02 09:43:22 -04:00
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 ( )
{
2020-11-18 13:26:45 -05:00
manager . select_normalize ( normalize_checkbox . get_active ( ) ) ;
manager . select_normalize_loudness ( normalize_loudness_rb . get_active ( ) ) ;
2016-05-02 09:43:22 -04:00
manager . select_normalize_dbfs ( normalize_dbfs_spinbutton . get_value ( ) ) ;
2021-04-08 15:21:33 -04:00
manager . select_tp_limiter ( normalize_tp_limiter . get_active_row_number ( ) = = 0 ) ;
2016-05-02 09:43:22 -04:00
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 ;
2020-11-18 13:26:45 -05:00
manager . select_silence_beginning ( silence_start_checkbox . get_active ( ) ? silence_start : zero ) ;
2008-09-17 08:56:00 -04:00
}
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 ;
2020-11-18 13:26:45 -05:00
manager . select_silence_end ( silence_end_checkbox . get_active ( ) ? silence_end : zero ) ;
2008-09-17 08:56:00 -04:00
}
void
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : update_clock ( AudioClock & clock , ARDOUR : : AnyTime const & time )
2008-09-17 08:56:00 -04:00
{
2023-03-13 19:34:43 -04:00
clock . set_duration ( timecnt_t ( _session - > convert_to_samples ( time ) ) ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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 ) {
2020-11-18 13:26:45 -05:00
case AnyTime : : Timecode :
mode = AudioClock : : Timecode ;
break ;
case AnyTime : : BBT :
mode = AudioClock : : BBT ;
break ;
case AnyTime : : Samples :
mode = AudioClock : : Samples ;
break ;
case AnyTime : : Seconds :
mode = AudioClock : : MinSec ;
break ;
2008-09-17 08:56:00 -04:00
}
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
clock . set_mode ( mode ) ;
}
void
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : update_time ( AnyTime & time , AudioClock const & clock )
2008-09-17 08:56:00 -04:00
{
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
2020-10-19 14:37:54 -04:00
samplecnt_t samples = clock . current_duration ( ) . samples ( ) ;
2020-11-18 13:26:45 -05:00
switch ( clock . mode ( ) ) {
2020-10-19 14:37:54 -04:00
case AudioClock : : Timecode :
time . type = AnyTime : : Timecode ;
_session - > timecode_time ( samples , time . timecode ) ;
break ;
case AudioClock : : BBT :
time . type = AnyTime : : BBT ;
2021-12-14 15:23:19 -05:00
time . bbt = Temporal : : TempoMap : : use ( ) - > bbt_at ( timepos_t ( samples ) ) ;
2020-10-19 14:37:54 -04:00
break ;
case AudioClock : : Seconds :
case AudioClock : : MinSec :
time . type = AnyTime : : Seconds ;
time . seconds = ( double ) samples / _session - > sample_rate ( ) ;
break ;
case AudioClock : : Samples :
time . type = AnyTime : : Samples ;
time . samples = samples ;
break ;
2008-09-17 08:56:00 -04:00
}
}
void
ExportFormatDialog : : update_src_quality_selection ( )
{
2020-11-18 13:26:45 -05:00
Gtk : : TreeModel : : const_iterator iter = src_quality_combo . get_active ( ) ;
ExportFormatBase : : SRCQuality quality = iter - > get_value ( src_quality_cols . id ) ;
2008-09-17 08:56:00 -04:00
manager . select_src_quality ( quality ) ;
}
2020-06-04 21:10:20 -04:00
void
ExportFormatDialog : : update_demo_noise_sensitivity ( )
{
2020-11-18 13:26:45 -05:00
Gtk : : TreeModel : : const_iterator iter = demo_noise_combo . get_active ( ) ;
2020-06-04 21:10:20 -04:00
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 ( )
{
2020-11-18 13:26:45 -05:00
Gtk : : TreeModel : : const_iterator iter = demo_noise_combo . get_active ( ) ;
2020-06-04 21:10:20 -04:00
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 ) ;
2020-11-18 13:26:45 -05:00
int level = demo_noise_dbfs_spinbutton . get_value ( ) ;
2020-06-04 21:10:20 -04:00
demo_noise_dbfs_spinbutton . set_sensitive ( interval ! = 0 & & duration ! = 0 ) ;
manager . select_demo_noise_duration ( duration ) ;
manager . select_demo_noise_interval ( interval ) ;
2020-11-18 13:26:45 -05:00
manager . select_demo_noise_level ( level ) ;
2020-06-04 21:10:20 -04:00
}
2018-11-19 17:45:26 -05:00
void
ExportFormatDialog : : update_codec_quality_selection ( )
{
2020-11-18 13:26:45 -05:00
Gtk : : TreeModel : : const_iterator iter = codec_quality_combo . get_active ( ) ;
2018-11-19 17:45:26 -05:00
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 ( )
{
2020-11-18 13:26:45 -05:00
manager . select_tagging ( tag_checkbox . get_active ( ) ) ;
2008-09-17 08:56:00 -04:00
}
void
2011-06-11 10:14:24 -04:00
ExportFormatDialog : : change_encoding_options ( ExportFormatPtr ptr )
2008-09-17 08:56:00 -04:00
{
2022-12-06 00:17:13 -05:00
fill_sample_rate_lists ( ptr ) ;
2008-09-17 08:56:00 -04:00
empty_encoding_option_table ( ) ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < ARDOUR : : ExportFormatLinear > linear_ptr ;
std : : shared_ptr < ARDOUR : : ExportFormatOggVorbis > ogg_ptr ;
std : : shared_ptr < ARDOUR : : ExportFormatFLAC > flac_ptr ;
std : : shared_ptr < ARDOUR : : ExportFormatOggOpus > opus_ptr ;
std : : shared_ptr < ARDOUR : : ExportFormatBWF > bwf_ptr ;
std : : shared_ptr < ARDOUR : : ExportFormatMPEG > mpeg_ptr ;
std : : shared_ptr < ARDOUR : : ExportFormatFFMPEG > ffmpeg_ptr ;
2008-09-17 08:56:00 -04:00
2023-02-16 18:33:28 -05:00
if ( ( linear_ptr = std : : dynamic_pointer_cast < ExportFormatLinear > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_linear_enconding_options ( linear_ptr ) ;
2023-02-16 18:33:28 -05:00
} else if ( ( ogg_ptr = std : : dynamic_pointer_cast < ExportFormatOggVorbis > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_ogg_enconding_options ( ogg_ptr ) ;
2023-02-16 18:33:28 -05:00
} else if ( ( opus_ptr = std : : dynamic_pointer_cast < ExportFormatOggOpus > ( ptr ) ) ) {
2022-12-05 17:43:50 -05:00
show_opus_enconding_options ( opus_ptr ) ;
2023-02-16 18:33:28 -05:00
} else if ( ( flac_ptr = std : : dynamic_pointer_cast < ExportFormatFLAC > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_flac_enconding_options ( flac_ptr ) ;
2023-02-16 18:33:28 -05:00
} else if ( ( bwf_ptr = std : : dynamic_pointer_cast < ExportFormatBWF > ( ptr ) ) ) {
2008-09-17 08:56:00 -04:00
show_bwf_enconding_options ( bwf_ptr ) ;
2023-02-16 18:33:28 -05:00
} else if ( ( mpeg_ptr = std : : dynamic_pointer_cast < ExportFormatMPEG > ( ptr ) ) ) {
2022-11-04 16:22:34 -04:00
show_mpeg_enconding_options ( mpeg_ptr ) ;
2023-02-16 18:33:28 -05:00
} else if ( ( ffmpeg_ptr = std : : dynamic_pointer_cast < ExportFormatFFMPEG > ( ptr ) ) ) {
2018-11-19 17:45:26 -05:00
show_ffmpeg_enconding_options ( ffmpeg_ptr ) ;
2008-09-17 08:56:00 -04:00
} else {
std : : cout < < " Unrecognized format! " < < std : : endl ;
}
2020-11-18 13:26:32 -05:00
tag_checkbox . set_sensitive ( ptr - > supports_tagging ( ) ) ;
2008-09-17 08:56:00 -04:00
}
void
ExportFormatDialog : : empty_encoding_option_table ( )
{
encoding_options_table . foreach ( sigc : : bind ( sigc : : mem_fun ( * this , & ExportFormatDialog : : remove_widget ) , & encoding_options_table ) ) ;
}
void
2020-11-18 13:26:45 -05:00
ExportFormatDialog : : remove_widget ( Gtk : : Widget & to_remove , Gtk : : Container * remove_from )
2008-09-17 08:56:00 -04:00
{
remove_from - > remove ( to_remove ) ;
}
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_linear_enconding_options ( std : : shared_ptr < ARDOUR : : ExportFormatLinear > ptr )
2008-09-17 08:56:00 -04:00
{
/* 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
2023-02-16 18:33:28 -05:00
fill_sample_format_lists ( std : : 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
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_ogg_enconding_options ( std : : 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 ) ;
fill_codec_quality_lists ( ptr ) ;
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
}
2022-12-05 17:43:50 -05:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_opus_enconding_options ( std : : shared_ptr < ARDOUR : : ExportFormatOggOpus > ptr )
2022-12-05 17:43:50 -05:00
{
encoding_options_label . set_label ( _ ( " OPUS options " ) ) ;
encoding_options_table . resize ( 1 , 1 ) ;
encoding_options_table . attach ( codec_quality_combo , 0 , 1 , 0 , 1 ) ;
fill_codec_quality_lists ( ptr ) ;
show_all_children ( ) ;
}
2008-09-17 08:56:00 -04:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_flac_enconding_options ( std : : shared_ptr < ARDOUR : : ExportFormatFLAC > ptr )
2008-09-17 08:56:00 -04:00
{
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 ) ;
2009-10-14 12:10:01 -04:00
2023-02-16 18:33:28 -05:00
fill_sample_format_lists ( std : : 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
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_bwf_enconding_options ( std : : shared_ptr < ARDOUR : : ExportFormatBWF > ptr )
2008-09-17 08:56:00 -04:00
{
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
2023-02-16 18:33:28 -05:00
fill_sample_format_lists ( std : : dynamic_pointer_cast < HasSampleFormat > ( ptr ) ) ;
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
show_all_children ( ) ;
}
2022-11-04 16:22:34 -04:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_mpeg_enconding_options ( std : : shared_ptr < ARDOUR : : ExportFormatMPEG > ptr )
2022-11-04 16:22:34 -04:00
{
encoding_options_label . set_label ( _ ( " Variable bit rate quality " ) ) ;
encoding_options_table . resize ( 1 , 1 ) ;
encoding_options_table . attach ( codec_quality_combo , 0 , 1 , 0 , 1 ) ;
fill_codec_quality_lists ( ptr ) ;
show_all_children ( ) ;
}
2018-11-19 17:45:26 -05:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : show_ffmpeg_enconding_options ( std : : shared_ptr < ARDOUR : : ExportFormatFFMPEG > ptr )
2018-11-19 17:45:26 -05:00
{
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 ) ;
2018-11-19 21:35:25 -05:00
fill_codec_quality_lists ( ptr ) ;
2018-11-19 17:45:26 -05:00
show_all_children ( ) ;
}
2022-12-06 00:17:13 -05:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : fill_sample_rate_lists ( std : : shared_ptr < ARDOUR : : ExportFormat > ptr )
2022-12-06 00:17:13 -05:00
{
Gtk : : TreeModel : : iterator iter ;
Gtk : : TreeModel : : Row row ;
sample_rate_list - > clear ( ) ;
ExportFormatManager : : SampleRateList const & rates = manager . get_sample_rates ( ) ;
for ( ExportFormatManager : : SampleRateList : : const_iterator it = rates . begin ( ) ; it ! = rates . end ( ) ; + + it ) {
if ( ! ptr - > has_sample_rate ( ( * it ) - > rate ) ) {
continue ;
}
iter = sample_rate_list - > append ( ) ;
row = * iter ;
row [ sample_rate_cols . ptr ] = * it ;
row [ sample_rate_cols . color ] = " white " ;
row [ sample_format_cols . color ] = ( * it ) - > compatible ( ) ? " white " : " red " ;
row [ sample_rate_cols . label ] = ( * it ) - > name ( ) ;
WeakSampleRatePtr ptr ( * it ) ;
2024-10-18 19:51:44 -04:00
( * it ) - > SelectChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_sample_rate_selection , this , _1 , ptr ) , gui_context ( ) ) ;
( * it ) - > CompatibleChanged . connect ( * this , invalidator ( * this ) , std : : bind ( & ExportFormatDialog : : change_sample_rate_compatibility , this , _1 , ptr ) , gui_context ( ) ) ;
2022-12-06 00:17:13 -05:00
}
}
2008-09-17 08:56:00 -04:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : fill_sample_format_lists ( std : : shared_ptr < ARDOUR : : HasSampleFormat > ptr )
2008-09-17 08:56:00 -04:00
{
/* Fill lists */
2009-10-14 12:10:01 -04:00
2008-09-17 08:56:00 -04:00
Gtk : : TreeModel : : iterator iter ;
2020-11-18 13:26:45 -05:00
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
2020-11-18 13:26:45 -05:00
HasSampleFormat : : SampleFormatList const & formats = ptr - > get_sample_formats ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
if ( ( * it ) - > selected ( ) ) {
sample_format_view . get_selection ( ) - > select ( iter ) ;
2008-09-17 08:56:00 -04:00
}
}
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
2020-11-18 13:26:45 -05:00
HasSampleFormat : : DitherTypeList const & types = ptr - > get_dither_types ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05: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
2020-11-18 13:26:45 -05:00
row [ dither_type_cols . ptr ] = * it ;
2008-09-17 08:56:00 -04:00
row [ dither_type_cols . color ] = " white " ;
2020-11-18 13:26:45 -05:00
row [ dither_type_cols . label ] = ( * it ) - > name ( ) ;
2009-10-14 12:10:01 -04:00
2020-11-18 13:26:45 -05:00
if ( ( * it ) - > selected ( ) ) {
dither_type_view . get_selection ( ) - > select ( iter ) ;
2008-09-17 08:56:00 -04:00
}
}
}
2018-11-19 21:35:25 -05:00
void
2023-02-16 18:33:28 -05:00
ExportFormatDialog : : fill_codec_quality_lists ( std : : shared_ptr < ARDOUR : : HasCodecQuality > ptr )
2018-11-19 21:35:25 -05:00
{
2020-11-18 13:26:45 -05:00
HasCodecQuality : : CodecQualityList const & codecs = ptr - > get_codec_qualities ( ) ;
2018-11-19 21:35:25 -05:00
2020-11-18 13:26:45 -05:00
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 ;
2018-11-19 21:35:25 -05:00
row [ codec_quality_cols . quality ] = ( * it ) - > quality ;
2020-11-18 13:26:45 -05:00
row [ codec_quality_cols . label ] = ( * it ) - > name ;
2018-11-19 21:35:25 -05:00
}
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 ( )
{
2020-11-18 13:26:45 -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 ( ) ) {
2018-11-19 21:35:25 -05:00
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 ) ;
2020-11-18 13:26:45 -05:00
compatibility_view . get_selection ( ) - > unselect_all ( ) ;
2008-09-17 08:56:00 -04:00
compatibility_select_connection . block ( false ) ;
}