Hide audio sample rate option in DCP panel unless the advanced option is enabled.
authorCarl Hetherington <cth@carlh.net>
Thu, 26 May 2022 07:53:55 +0000 (09:53 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 26 May 2022 07:53:55 +0000 (09:53 +0200)
src/wx/dcp_panel.cc
src/wx/dcp_panel.h

index e4cc0c558626b646a3209bdde7445d31306125a7..8a3e57304e91233ca6e540ebbfdce8a6180be3ef 100644 (file)
@@ -480,7 +480,9 @@ DCPPanel::film_changed (Film::Property p)
                break;
        }
        case Film::Property::AUDIO_FRAME_RATE:
-               checked_set (_audio_sample_rate, _film->audio_frame_rate() == 48000 ? 0 : 1);
+               if (_audio_sample_rate) {
+                       checked_set (_audio_sample_rate, _film->audio_frame_rate() == 48000 ? 0 : 1);
+               }
                break;
        case Film::Property::CONTENT_VERSIONS:
        case Film::Property::VERSION_NUMBER:
@@ -896,8 +898,10 @@ DCPPanel::make_audio_panel ()
        _audio_channels = new wxChoice (panel, wxID_ANY);
        setup_audio_channels_choice (_audio_channels, minimum_allowed_audio_channels ());
 
-       _audio_sample_rate_label = create_label (panel, _("Sample rate"), true);
-       _audio_sample_rate = new wxChoice (panel, wxID_ANY);
+       if (Config::instance()->allow_96khz_audio()) {
+               _audio_sample_rate_label = create_label (panel, _("Sample rate"), true);
+               _audio_sample_rate = new wxChoice (panel, wxID_ANY);
+       }
 
        _processor_label = create_label (panel, _("Processor"), true);
        _audio_processor = new wxChoice (panel, wxID_ANY);
@@ -906,12 +910,16 @@ DCPPanel::make_audio_panel ()
        _show_audio = new Button (panel, _("Show graph of audio levels..."));
 
        _audio_channels->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_channels_changed, this));
-       _audio_sample_rate->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::audio_sample_rate_changed, this));
+       if (_audio_sample_rate) {
+               _audio_sample_rate->Bind (wxEVT_CHOICE, boost::bind(&DCPPanel::audio_sample_rate_changed, this));
+       }
        _audio_processor->Bind (wxEVT_CHOICE, boost::bind (&DCPPanel::audio_processor_changed, this));
        _show_audio->Bind (wxEVT_BUTTON, boost::bind (&DCPPanel::show_audio_clicked, this));
 
-       _audio_sample_rate->Append (_("48kHz"));
-       _audio_sample_rate->Append (_("96kHz"));
+       if (_audio_sample_rate) {
+               _audio_sample_rate->Append (_("48kHz"));
+               _audio_sample_rate->Append (_("96kHz"));
+       }
 
        add_audio_panel_to_grid ();
 
@@ -928,9 +936,11 @@ DCPPanel::add_audio_panel_to_grid ()
        _audio_grid->Add (_audio_channels, wxGBPosition (r, 1));
        ++r;
 
-       add_label_to_sizer (_audio_grid, _audio_sample_rate_label, true, wxGBPosition(r, 0));
-       _audio_grid->Add (_audio_sample_rate, wxGBPosition(r, 1));
-       ++r;
+       if (_audio_sample_rate_label && _audio_sample_rate) {
+               add_label_to_sizer (_audio_grid, _audio_sample_rate_label, true, wxGBPosition(r, 0));
+               _audio_grid->Add (_audio_sample_rate, wxGBPosition(r, 1));
+               ++r;
+       }
 
        add_label_to_sizer (_audio_grid, _processor_label, true, wxGBPosition (r, 0));
        _audio_grid->Add (_audio_processor, wxGBPosition (r, 1));
@@ -1038,6 +1048,8 @@ DCPPanel::edit_audio_language_clicked ()
 void
 DCPPanel::audio_sample_rate_changed ()
 {
-       _film->set_audio_frame_rate (_audio_sample_rate->GetSelection() == 0 ? 48000 : 96000);
+       if (_audio_sample_rate) {
+               _film->set_audio_frame_rate (_audio_sample_rate->GetSelection() == 0 ? 48000 : 96000);
+       }
 }
 
index 2e7555487d5a273a5ff0b88f8d8b2849adc53fdd..37bc20aa39f68b25a6b085fe5e7559a3a022819b 100644 (file)
@@ -137,8 +137,8 @@ private:
        wxSizer* _frame_rate_sizer;
        wxStaticText* _channels_label;
        wxChoice* _audio_channels;
-       wxStaticText* _audio_sample_rate_label;
-       wxChoice* _audio_sample_rate;
+       wxStaticText* _audio_sample_rate_label = nullptr;
+       wxChoice* _audio_sample_rate = nullptr;
        wxStaticText* _processor_label;
        wxChoice* _audio_processor;
        wxButton* _show_audio;