From e7b0df0231c74aa41b42bf93491fde2dd65913aa Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 6 Dec 2022 06:17:13 +0100 Subject: [PATCH] Export Format Dialog: constrain sample-rates --- gtk2_ardour/export_format_dialog.cc | 29 +++++++++++++++++++++++++++++ gtk2_ardour/export_format_dialog.h | 1 + 2 files changed, 30 insertions(+) diff --git a/gtk2_ardour/export_format_dialog.cc b/gtk2_ardour/export_format_dialog.cc index 78af60ab6f..7d40c76a51 100644 --- a/gtk2_ardour/export_format_dialog.cc +++ b/gtk2_ardour/export_format_dialog.cc @@ -1110,6 +1110,7 @@ ExportFormatDialog::update_tagging_selection () void ExportFormatDialog::change_encoding_options (ExportFormatPtr ptr) { + fill_sample_rate_lists (ptr); empty_encoding_option_table (); boost::shared_ptr linear_ptr; @@ -1245,6 +1246,34 @@ ExportFormatDialog::show_ffmpeg_enconding_options (boost::shared_ptr ptr) +{ + 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; + printf ("SR %d\n", (*it)->rate); + + 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); + (*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 ()); + } + +} void ExportFormatDialog::fill_sample_format_lists (boost::shared_ptr ptr) { diff --git a/gtk2_ardour/export_format_dialog.h b/gtk2_ardour/export_format_dialog.h index 5f97f9dbfc..81a6e2e749 100644 --- a/gtk2_ardour/export_format_dialog.h +++ b/gtk2_ardour/export_format_dialog.h @@ -174,6 +174,7 @@ private: void fill_sample_format_lists (boost::shared_ptr ptr); void fill_codec_quality_lists (boost::shared_ptr ptr); + void fill_sample_rate_lists (boost::shared_ptr ptr); /*** GUI components ***/