Fix audio display to only offer available channels.
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Apr 2013 20:01:46 +0000 (21:01 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 11 Apr 2013 20:01:46 +0000 (21:01 +0100)
src/wx/audio_dialog.cc

index bfd92f0b65e8db97508cb61ee775e75121086662..bed7aac6d179730e072469ccbb5a0b432f8519d5 100644 (file)
@@ -43,7 +43,6 @@ AudioDialog::AudioDialog (wxWindow* parent)
                wxStaticText* m = new wxStaticText (this, wxID_ANY, _("Channels"));
                side->Add (m, 1, wxALIGN_CENTER_VERTICAL | wxTOP, 16);
        }
-       
 
        for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
                _channel_checkbox[i] = new wxCheckBox (this, wxID_ANY, std_to_wx (audio_channel_name (i)));
@@ -91,6 +90,10 @@ AudioDialog::set_film (shared_ptr<Film> f)
        
        _film = f;
 
+       for (int i = 0; i < MAX_AUDIO_CHANNELS; ++i) {
+               _channel_checkbox[i]->Show (!_film->audio_mapping().dcp_to_content (static_cast<libdcp::Channel> (i)).empty());
+       }
+
        try_to_load_analysis ();
        _plot->set_gain (_film->audio_gain ());
 
@@ -116,7 +119,9 @@ AudioDialog::try_to_load_analysis ()
                
        _plot->set_analysis (a);
 
-       _channel_checkbox[0]->SetValue (true);
+       if (_channel_checkbox[0]) {
+               _channel_checkbox[0]->SetValue (true);
+       }
        _plot->set_channel_visible (0, true);
 
        for (int i = 0; i < AudioPoint::COUNT; ++i) {