Hide the upmixers unless an "advanced" configuration option is ticked. v2.15.22
authorCarl Hetherington <cth@carlh.net>
Sun, 13 Oct 2019 21:47:33 +0000 (23:47 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 13 Oct 2019 21:47:33 +0000 (23:47 +0200)
The upmixers are not of sufficient quality to always be an improvement,
and anecdotally it seems that some users see them and hope one will
be a silver bullet.

src/lib/audio_processor.cc
src/lib/audio_processor.h
src/lib/config.cc
src/lib/config.h
src/lib/film.cc
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/full_config_dialog.cc

index 0d3f2b6d7ecc2b0a0259a8018e2964c1f19ae9fa..6cccbdc80f5842fef0f1cfb4597ac78d00ba0aa0 100644 (file)
 #include "mid_side_decoder.h"
 #include "upmixer_a.h"
 #include "upmixer_b.h"
+#include "config.h"
 
 using std::string;
 using std::list;
 
 list<AudioProcessor const *> AudioProcessor::_all;
+list<AudioProcessor const *> AudioProcessor::_non_experimental;
 
 void
 AudioProcessor::setup_audio_processors ()
 {
-       _all.push_back (new MidSideDecoder ());
+       AudioProcessor* mid_side = new MidSideDecoder ();
+       _all.push_back (mid_side);
+       _non_experimental.push_back (mid_side);
+
        _all.push_back (new UpmixerA (48000));
        _all.push_back (new UpmixerB (48000));
 }
@@ -48,6 +53,16 @@ AudioProcessor::from_id (string id)
        return 0;
 }
 
+list<AudioProcessor const *>
+AudioProcessor::visible ()
+{
+       if (Config::instance()->show_experimental_audio_processors()) {
+               return _all;
+       }
+
+       return _non_experimental;
+}
+
 list<AudioProcessor const *>
 AudioProcessor::all ()
 {
index e10df254cbd18fc7c2a09d73796502f5ebb2fb16..78a3efb58fd6ec0d745b747d7d835628a78e5a25 100644 (file)
@@ -61,11 +61,13 @@ public:
        virtual std::vector<std::string> input_names () const = 0;
 
        static std::list<AudioProcessor const *> all ();
+       static std::list<AudioProcessor const *> visible ();
        static void setup_audio_processors ();
        static AudioProcessor const * from_id (std::string);
 
 private:
        static std::list<AudioProcessor const *> _all;
+       static std::list<AudioProcessor const *> _non_experimental;
 };
 
 #endif
index 1d2ef1e40d25f343c8135cfc88f7eb915f7c9f3e..581620f832846f8a2f8e7418478fb43666dbc5ab 100644 (file)
@@ -94,6 +94,7 @@ Config::set_defaults ()
        _tms_password = "";
        _allow_any_dcp_frame_rate = false;
        _allow_any_container = false;
+       _show_experimental_audio_processors = false;
        _language = optional<string> ();
        _default_still_length = 10;
        _default_container = Ratio::from_id ("185");
@@ -384,6 +385,7 @@ try
        _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
        _allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate").get_value_or (false);
        _allow_any_container = f.optional_bool_child ("AllowAnyContainer").get_value_or (false);
+       _show_experimental_audio_processors = f.optional_bool_child ("ShowExperimentalAudioProcessors").get_value_or (false);
 
        _log_types = f.optional_number_child<int> ("LogTypes").get_value_or (LogEntry::TYPE_GENERAL | LogEntry::TYPE_WARNING | LogEntry::TYPE_ERROR);
        _analyse_ebur128 = f.optional_bool_child("AnalyseEBUR128").get_value_or (true);
@@ -801,6 +803,8 @@ Config::write_config () const
        root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
        /* [XML] AllowAnyContainer 1 to allow users to user any container ratio for their DCP, 0 to limit the GUI to standard containers. */
        root->add_child("AllowAnyContainer")->add_child_text (_allow_any_container ? "1" : "0");
+       /* [XML] ShowExperimentalAudioProcessors 1 to offer users the (experimental) audio upmixer processors, 0 to hide them */
+       root->add_child("ShowExperimentalAudioProcessors")->add_child_text (_show_experimental_audio_processors ? "1" : "0");
        /* [XML] LogTypes Types of logging to write; a bitfield where 1 is general notes, 2 warnings, 4 errors, 8 debug information related
           to encoding, 16 debug information related to encoding, 32 debug information for timing purposes, 64 debug information related
           to sending email.
index 9a57b1b484624b36a73055911944e1ae374a78d1..ff7a0fe396f9af9ac7e91d914d692ab870ff8381 100644 (file)
@@ -82,6 +82,7 @@ public:
                PLAYER_PLAYLIST_DIRECTORY,
                PLAYER_DEBUG_LOG,
                HISTORY,
+               SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
 #ifdef DCPOMATIC_VARIANT_SWAROOP
                PLAYER_BACKGROUND_IMAGE,
 #endif
@@ -157,6 +158,10 @@ public:
                return _allow_any_container;
        }
 
+       bool show_experimental_audio_processors () const {
+               return _show_experimental_audio_processors;
+       }
+
        ISDCFMetadata default_isdcf_metadata () const {
                return _default_isdcf_metadata;
        }
@@ -620,6 +625,10 @@ public:
                maybe_set (_allow_any_container, a);
        }
 
+       void set_show_experimental_audio_processors (bool e) {
+               maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
+       }
+
        void set_default_isdcf_metadata (ISDCFMetadata d) {
                maybe_set (_default_isdcf_metadata, d);
        }
@@ -1177,6 +1186,8 @@ private:
            https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
        */
        bool _allow_any_container;
+       /** Offer the upmixers in the audio processor settings */
+       bool _show_experimental_audio_processors;
        /** Default ISDCF metadata for newly-created Films */
        ISDCFMetadata _default_isdcf_metadata;
        boost::optional<std::string> _language;
index e85543b807e9f4165fbfbafc53a7ed2bde40e8b9..93459661be39463c8cd257ee3ac3611ea85e33f1 100644 (file)
@@ -93,6 +93,7 @@ using std::copy;
 using std::back_inserter;
 using std::map;
 using std::exception;
+using std::find;
 using boost::shared_ptr;
 using boost::weak_ptr;
 using boost::dynamic_pointer_cast;
@@ -542,6 +543,13 @@ Film::read_metadata (optional<boost::filesystem::path> path)
                _audio_processor = 0;
        }
 
+       if (_audio_processor && !Config::instance()->show_experimental_audio_processors()) {
+               list<AudioProcessor const *> ap = AudioProcessor::visible();
+               if (find(ap.begin(), ap.end(), _audio_processor) == ap.end()) {
+                       Config::instance()->set_show_experimental_audio_processors(true);
+               }
+       }
+
        _reel_type = static_cast<ReelType> (f.optional_number_child<int>("ReelType").get_value_or (static_cast<int>(REELTYPE_SINGLE)));
        _reel_length = f.optional_number_child<int64_t>("ReelLength").get_value_or (2000000000);
        _upload_after_make_dcp = f.optional_bool_child("UploadAfterMakeDCP").get_value_or (false);
index a7f4f45e9f88b6e68055aecfa3c55fbcc9dc443a..c4a14a58b3a118bec1c36c4356aea4a1d1c84632 100644 (file)
@@ -783,6 +783,12 @@ DCPPanel::config_changed (Config::Property p)
                _audio_grid->Clear ();
                add_audio_panel_to_grid ();
                _audio_grid->Layout ();
+       } else if (p == Config::SHOW_EXPERIMENTAL_AUDIO_PROCESSORS) {
+               _audio_processor->Clear ();
+               add_audio_processors ();
+               if (_film) {
+                       film_changed (Film::AUDIO_PROCESSOR);
+               }
        }
 }
 
@@ -931,10 +937,10 @@ wxPanel *
 DCPPanel::make_audio_panel ()
 {
        wxPanel* panel = new wxPanel (_notebook);
-       wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+       _audio_panel_sizer = new wxBoxSizer (wxVERTICAL);
        _audio_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
-       sizer->Add (_audio_grid, 0, wxALL, 8);
-       panel->SetSizer (sizer);
+       _audio_panel_sizer->Add (_audio_grid, 0, wxALL, 8);
+       panel->SetSizer (_audio_panel_sizer);
 
        _channels_label = create_label (panel, _("Channels"), true);
        _audio_channels = new wxChoice (panel, wxID_ANY);
@@ -942,10 +948,7 @@ DCPPanel::make_audio_panel ()
 
        _processor_label = create_label (panel, _("Processor"), true);
        _audio_processor = new wxChoice (panel, wxID_ANY);
-       _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
-       BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
-               _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
-       }
+       add_audio_processors ();
 
        _show_audio = new Button (panel, _("Show audio..."));
 
@@ -1040,3 +1043,13 @@ DCPPanel::reel_length_changed ()
 
        _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
 }
+
+void
+DCPPanel::add_audio_processors ()
+{
+       _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
+       BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::visible()) {
+               _audio_processor->Append (std_to_wx(ap->name()), new wxStringClientData(std_to_wx(ap->id())));
+       }
+       _audio_panel_sizer->Layout();
+}
index f717e83273c2219285ecfbc8b10441004ceb3bb6..887ae7c77e552c81aad307deb7a963f58fbbca08 100644 (file)
@@ -90,6 +90,7 @@ private:
        void add_to_grid ();
        void add_video_panel_to_grid ();
        void add_audio_panel_to_grid ();
+       void add_audio_processors ();
 
        int minimum_allowed_audio_channels () const;
 
@@ -151,6 +152,7 @@ private:
        wxCheckBox* _upload_after_make_dcp;
        wxButton* _markers;
        wxButton* _metadata;
+       wxSizer* _audio_panel_sizer;
 
        AudioDialog* _audio_dialog;
        MarkersDialog* _markers_dialog;
index ffe7b4749c67c22a9fce59281c8ff8fceb3e7c5c..f6dd783bd9f5baaff64d40107c93cdd0a48b2426 100644 (file)
@@ -1368,6 +1368,7 @@ public:
                , _maximum_j2k_bandwidth (0)
                , _allow_any_dcp_frame_rate (0)
                , _allow_any_container (0)
+               , _show_experimental_audio_processors (0)
                , _only_servers_encode (0)
                , _log_general (0)
                , _log_warning (0)
@@ -1428,6 +1429,10 @@ private:
                restart->SetFont (font);
                table->AddSpacer (0);
 
+               _show_experimental_audio_processors = new CheckBox (_panel, _("Show experimental audio processors"));
+               table->Add (_show_experimental_audio_processors, 1, wxEXPAND | wxALL);
+               table->AddSpacer (0);
+
                _only_servers_encode = new CheckBox (_panel, _("Only servers encode"));
                table->Add (_only_servers_encode, 1, wxEXPAND | wxALL);
                table->AddSpacer (0);
@@ -1504,6 +1509,7 @@ private:
                _video_display_mode->Bind (wxEVT_CHOICE, boost::bind(&AdvancedPage::video_display_mode_changed, this));
                _allow_any_dcp_frame_rate->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_dcp_frame_rate_changed, this));
                _allow_any_container->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::allow_any_container_changed, this));
+               _show_experimental_audio_processors->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::show_experimental_audio_processors_changed, this));
                _only_servers_encode->Bind (wxEVT_CHECKBOX, boost::bind (&AdvancedPage::only_servers_encode_changed, this));
                _frames_in_memory_multiplier->Bind (wxEVT_SPINCTRL, boost::bind(&AdvancedPage::frames_in_memory_multiplier_changed, this));
                _dcp_metadata_filename_format->Changed.connect (boost::bind (&AdvancedPage::dcp_metadata_filename_format_changed, this));
@@ -1535,6 +1541,7 @@ private:
                }
                checked_set (_allow_any_dcp_frame_rate, config->allow_any_dcp_frame_rate ());
                checked_set (_allow_any_container, config->allow_any_container ());
+               checked_set (_show_experimental_audio_processors, config->show_experimental_audio_processors ());
                checked_set (_only_servers_encode, config->only_servers_encode ());
                checked_set (_log_general, config->log_types() & LogEntry::TYPE_GENERAL);
                checked_set (_log_warning, config->log_types() & LogEntry::TYPE_WARNING);
@@ -1578,6 +1585,11 @@ private:
                Config::instance()->set_allow_any_container (_allow_any_container->GetValue ());
        }
 
+       void show_experimental_audio_processors_changed ()
+       {
+               Config::instance()->set_show_experimental_audio_processors (_show_experimental_audio_processors->GetValue ());
+       }
+
        void only_servers_encode_changed ()
        {
                Config::instance()->set_only_servers_encode (_only_servers_encode->GetValue ());
@@ -1632,6 +1644,7 @@ private:
        wxSpinCtrl* _frames_in_memory_multiplier;
        wxCheckBox* _allow_any_dcp_frame_rate;
        wxCheckBox* _allow_any_container;
+       wxCheckBox* _show_experimental_audio_processors;
        wxCheckBox* _only_servers_encode;
        NameFormatEditor* _dcp_metadata_filename_format;
        NameFormatEditor* _dcp_asset_filename_format;