From: Carl Hetherington Date: Wed, 7 Nov 2012 13:11:05 +0000 (+0000) Subject: GUI basics for external audio specification. X-Git-Tag: v2.0.48~1551 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=f33a8b9412e8d0f62b4c63b881ff25c00f0aa162 GUI basics for external audio specification. --- diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 2ee7d45da..be96285e4 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -190,6 +190,8 @@ FilmEditor::connect_to_widgets () wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::audio_gain_calculate_button_clicked), 0, this ); _audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this); + _use_source_audio->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (FilmEditor::use_audio_changed), 0, this); + _use_external_audio->Connect (wxID_ANY, wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler (FilmEditor::use_audio_changed), 0, this); } void @@ -261,16 +263,6 @@ FilmEditor::make_audio_panel () _audio_sizer = new wxFlexGridSizer (2, 4, 4); _audio_panel->SetSizer (_audio_sizer); - { - video_control (add_label_to_sizer (_audio_sizer, _audio_panel, "Audio Stream")); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _audio_stream = new wxComboBox (_audio_panel, wxID_ANY); - s->Add (video_control (_audio_stream), 1); - _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT ("")); - s->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8); - _audio_sizer->Add (s, 1, wxEXPAND); - } - { video_control (add_label_to_sizer (_audio_sizer, _audio_panel, "Audio Gain")); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); @@ -292,6 +284,36 @@ FilmEditor::make_audio_panel () _audio_sizer->Add (s); } + { + _use_source_audio = new wxRadioButton (_audio_panel, wxID_ANY, _("Use source audio"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); + _audio_sizer->Add (video_control (_use_source_audio)); + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _audio_stream = new wxComboBox (_audio_panel, wxID_ANY); + s->Add (video_control (_audio_stream), 1); + _audio = new wxStaticText (_audio_panel, wxID_ANY, wxT ("")); + s->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8); + _audio_sizer->Add (s, 1, wxEXPAND); + } + + _use_external_audio = new wxRadioButton (_audio_panel, wxID_ANY, _("Use external audio")); + _audio_sizer->Add (video_control (_use_external_audio)); + _audio_sizer->AddSpacer (0); + + char const * channels[] = { + "L", + "R", + "C", + "Lfe", + "Ls", + "Rs" + }; + + for (int i = 0; i < 6; ++i) { + add_label_to_sizer (_audio_sizer, _audio_panel, channels[i]); + _external_audio_channel[i] = new wxFilePickerCtrl (_audio_panel, wxID_ANY, wxT (""), wxT ("Select Audio File"), wxT ("*.wav")); + _audio_sizer->Add (video_control (_external_audio_channel[i]), 1, wxEXPAND); + } + _audio_gain->SetRange (-60, 60); _audio_delay->SetRange (-1000, 1000); } @@ -685,6 +707,7 @@ FilmEditor::set_things_sensitive (bool s) _still_duration->Enable (s); setup_subtitle_control_sensitivity (); + setup_audio_control_sensitivity (); } /** Called when the `Edit filters' button has been clicked */ @@ -874,6 +897,21 @@ FilmEditor::setup_subtitle_control_sensitivity () _subtitle_scale->Enable (h); } +void +FilmEditor::setup_audio_control_sensitivity () +{ + _use_source_audio->Enable (_generally_sensitive); + _use_external_audio->Enable (_generally_sensitive); + + bool const source = _generally_sensitive && _use_source_audio->GetValue(); + bool const external = _generally_sensitive && _use_external_audio->GetValue(); + + _audio_stream->Enable (source); + for (int i = 0; i < 6; ++i) { + _external_audio_channel[i]->Enable (external); + } +} + void FilmEditor::use_dci_name_toggled (wxCommandEvent &) { @@ -951,3 +989,9 @@ FilmEditor::active_jobs_changed (bool a) { set_things_sensitive (!a); } + +void +FilmEditor::use_audio_changed (wxCommandEvent &) +{ + setup_audio_control_sensitivity (); +} diff --git a/src/wx/film_editor.h b/src/wx/film_editor.h index 91bb761e3..f0c1c6384 100644 --- a/src/wx/film_editor.h +++ b/src/wx/film_editor.h @@ -76,17 +76,18 @@ private: void still_duration_changed (wxCommandEvent &); void audio_stream_changed (wxCommandEvent &); void subtitle_stream_changed (wxCommandEvent &); + void use_audio_changed (wxCommandEvent &); /* Handle changes to the model */ void film_changed (Film::Property); /* Button clicks */ void edit_filters_clicked (wxCommandEvent &); - void change_dcp_range_clicked (wxCommandEvent &); void set_things_sensitive (bool); void setup_formats (); void setup_subtitle_control_sensitivity (); + void setup_audio_control_sensitivity (); void setup_streams (); void setup_audio_details (); @@ -130,7 +131,10 @@ private: wxButton* _filters_button; /** The Film's scaler */ wxComboBox* _scaler; + wxRadioButton* _use_source_audio; wxComboBox* _audio_stream; + wxRadioButton* _use_external_audio; + wxFilePickerCtrl* _external_audio_channel[6]; /** The Film's audio gain */ wxSpinCtrl* _audio_gain; /** A button to open the gain calculation dialogue */