--- /dev/null
+/*
+ Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/lexical_cast.hpp>
+#include <wx/spinctrl.h>
+#include "lib/config.h"
+#include "lib/sound_processor.h"
+#include "audio_dialog.h"
+#include "audio_panel.h"
+#include "audio_mapping_view.h"
+#include "wx_util.h"
+#include "gain_calculator_dialog.h"
+#include "film_editor.h"
+
+using std::vector;
+using std::string;
+using boost::dynamic_pointer_cast;
+using boost::lexical_cast;
+using boost::shared_ptr;
+
+AudioPanel::AudioPanel (FilmEditor* e)
+ : FilmEditorPanel (e, _("Audio"))
+ , _audio_dialog (0)
+{
+ wxFlexGridSizer* grid = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+ _sizer->Add (grid, 0, wxALL, 8);
+
+ _show = new wxButton (this, wxID_ANY, _("Show Audio..."));
+ grid->Add (_show, 1);
+ grid->AddSpacer (0);
+ grid->AddSpacer (0);
+
+ add_label_to_sizer (grid, this, _("Audio Gain"), true);
+ {
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _gain = new wxSpinCtrl (this);
+ s->Add (_gain, 1);
+ add_label_to_sizer (s, this, _("dB"), false);
+ grid->Add (s, 1);
+ }
+
+ _gain_calculate_button = new wxButton (this, wxID_ANY, _("Calculate..."));
+ grid->Add (_gain_calculate_button);
+
+ add_label_to_sizer (grid, this, _("Audio Delay"), false);
+ {
+ wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+ _delay = new wxSpinCtrl (this);
+ s->Add (_delay, 1);
+ /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time
+ add_label_to_sizer (s, this, _("ms"), false);
+ grid->Add (s);
+ }
+
+ grid->AddSpacer (0);
+
+ add_label_to_sizer (grid, this, _("Audio Stream"), true);
+ _stream = new wxChoice (this, wxID_ANY);
+ grid->Add (_stream, 1, wxEXPAND);
+ _description = new wxStaticText (this, wxID_ANY, wxT (""));
+ grid->AddSpacer (0);
+
+ grid->Add (_description, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
+ grid->AddSpacer (0);
+ grid->AddSpacer (0);
+
+ _mapping = new AudioMappingView (this);
+ _sizer->Add (_mapping, 1, wxEXPAND | wxALL, 6);
+
+ _gain->SetRange (-60, 60);
+ _delay->SetRange (-1000, 1000);
+
+ _delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (AudioPanel::delay_changed), 0, this);
+ _stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (AudioPanel::stream_changed), 0, this);
+ _show->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (AudioPanel::show_clicked), 0, this);
+ _gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (AudioPanel::gain_changed), 0, this);
+ _gain_calculate_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (AudioPanel::gain_calculate_button_clicked), 0, this);
+ _mapping->Changed.connect (boost::bind (&AudioPanel::mapping_changed, this, _1));
+}
+
+
+void
+AudioPanel::film_changed (Film::Property property)
+{
+ switch (property) {
+ case Film::CONTENT:
+ setup_sensitivity ();
+ break;
+ case Film::DCP_AUDIO_CHANNELS:
+ _mapping->set_channels (_editor->film()->dcp_audio_channels ());
+ break;
+ default:
+ break;
+ }
+}
+
+void
+AudioPanel::film_content_changed (
+ shared_ptr<Content>,
+ shared_ptr<AudioContent> audio_content,
+ shared_ptr<SubtitleContent>,
+ shared_ptr<FFmpegContent> ffmpeg_content,
+ int property
+ )
+{
+ if (property == AudioContentProperty::AUDIO_GAIN) {
+ checked_set (_gain, audio_content ? audio_content->audio_gain() : 0);
+ } else if (property == AudioContentProperty::AUDIO_DELAY) {
+ checked_set (_delay, audio_content ? audio_content->audio_delay() : 0);
+ } else if (property == AudioContentProperty::AUDIO_MAPPING) {
+ _mapping->set (audio_content ? audio_content->audio_mapping () : AudioMapping ());
+ } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
+ _stream->Clear ();
+ if (ffmpeg_content) {
+ vector<shared_ptr<FFmpegAudioStream> > a = ffmpeg_content->audio_streams ();
+ for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
+ _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
+ }
+
+ if (ffmpeg_content->audio_stream()) {
+ checked_set (_stream, lexical_cast<string> (ffmpeg_content->audio_stream()->id));
+ }
+ }
+ setup_sensitivity ();
+ } else if (property == FFmpegContentProperty::AUDIO_STREAM) {
+ setup_sensitivity ();
+ }
+}
+
+void
+AudioPanel::gain_changed (wxCommandEvent &)
+{
+ shared_ptr<AudioContent> ac = _editor->selected_audio_content ();
+ if (!ac) {
+ return;
+ }
+
+ ac->set_audio_gain (_gain->GetValue ());
+}
+
+void
+AudioPanel::delay_changed (wxCommandEvent &)
+{
+ shared_ptr<AudioContent> ac = _editor->selected_audio_content ();
+ if (!ac) {
+ return;
+ }
+
+ ac->set_audio_delay (_delay->GetValue ());
+}
+
+void
+AudioPanel::gain_calculate_button_clicked (wxCommandEvent &)
+{
+ GainCalculatorDialog* d = new GainCalculatorDialog (this);
+ d->ShowModal ();
+
+ if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
+ d->Destroy ();
+ return;
+ }
+
+ _gain->SetValue (
+ Config::instance()->sound_processor()->db_for_fader_change (
+ d->wanted_fader (),
+ d->actual_fader ()
+ )
+ );
+
+ /* This appears to be necessary, as the change is not signalled,
+ I think.
+ */
+ wxCommandEvent dummy;
+ gain_changed (dummy);
+
+ d->Destroy ();
+}
+
+void
+AudioPanel::show_clicked (wxCommandEvent &)
+{
+ if (_audio_dialog) {
+ _audio_dialog->Destroy ();
+ _audio_dialog = 0;
+ }
+
+ shared_ptr<Content> c = _editor->selected_content ();
+ if (!c) {
+ return;
+ }
+
+ shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (c);
+ if (!ac) {
+ return;
+ }
+
+ _audio_dialog = new AudioDialog (this);
+ _audio_dialog->Show ();
+ _audio_dialog->set_content (ac);
+}
+
+
+void
+AudioPanel::setup_sensitivity ()
+{
+ _show->Enable (_editor->film ());
+ _gain->Enable (_editor->generally_sensitive ());
+ _gain_calculate_button->Enable (_editor->generally_sensitive ());
+ _delay->Enable (_editor->generally_sensitive ());
+}
+
+void
+AudioPanel::content_selection_changed ()
+{
+ if (_audio_dialog && _editor->selected_audio_content()) {
+ _audio_dialog->set_content (_editor->selected_audio_content ());
+ }
+}
+
+void
+AudioPanel::stream_changed (wxCommandEvent &)
+{
+ shared_ptr<Content> c = _editor->selected_content ();
+ if (!c) {
+ return;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
+ if (!fc) {
+ return;
+ }
+
+ vector<shared_ptr<FFmpegAudioStream> > a = fc->audio_streams ();
+ vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin ();
+ string const s = string_client_data (_stream->GetClientObject (_stream->GetSelection ()));
+ while (i != a.end() && lexical_cast<string> ((*i)->id) != s) {
+ ++i;
+ }
+
+ if (i != a.end ()) {
+ fc->set_audio_stream (*i);
+ }
+
+ if (!fc->audio_stream ()) {
+ _description->SetLabel (wxT (""));
+ } else {
+ wxString s;
+ if (fc->audio_channels() == 1) {
+ s << _("1 channel");
+ } else {
+ s << fc->audio_channels() << wxT (" ") << _("channels");
+ }
+ s << wxT (", ") << fc->content_audio_frame_rate() << _("Hz");
+ _description->SetLabel (s);
+ }
+}
+
+void
+AudioPanel::mapping_changed (AudioMapping m)
+{
+ shared_ptr<AudioContent> c = _editor->selected_audio_content ();
+ if (!c) {
+ return;
+ }
+
+ c->set_audio_mapping (m);
+}
+
--- /dev/null
+/*
+ Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "film_editor_panel.h"
+
+class wxSpinCtrl;
+class wxButton;
+class wxChoice;
+class wxStaticText;
+class AudioMappingView;
+class AudioDialog;
+
+class AudioPanel : public FilmEditorPanel
+{
+public:
+ AudioPanel (FilmEditor *);
+
+ void film_changed (Film::Property);
+ void film_content_changed (
+ boost::shared_ptr<Content>,
+ boost::shared_ptr<AudioContent>,
+ boost::shared_ptr<SubtitleContent>,
+ boost::shared_ptr<FFmpegContent>,
+ int);
+ void content_selection_changed ();
+
+ void setup_sensitivity ();
+
+private:
+ void gain_changed (wxCommandEvent &);
+ void gain_calculate_button_clicked (wxCommandEvent &);
+ void show_clicked (wxCommandEvent &);
+ void delay_changed (wxCommandEvent &);
+ void stream_changed (wxCommandEvent &);
+ void mapping_changed (AudioMapping);
+
+ wxSpinCtrl* _gain;
+ wxButton* _gain_calculate_button;
+ wxButton* _show;
+ wxSpinCtrl* _delay;
+ wxChoice* _stream;
+ wxStaticText* _description;
+ AudioMappingView* _mapping;
+ AudioDialog* _audio_dialog;
+};
#include "filter_dialog.h"
#include "wx_util.h"
#include "film_editor.h"
-#include "gain_calculator_dialog.h"
#include "dci_metadata_dialog.h"
-#include "audio_dialog.h"
#include "timeline_dialog.h"
-#include "audio_mapping_view.h"
#include "timing_panel.h"
#include "subtitle_panel.h"
+#include "audio_panel.h"
using std::string;
using std::cout;
: wxPanel (parent)
, _menu (f, this)
, _generally_sensitive (true)
- , _audio_dialog (0)
, _timeline_dialog (0)
{
wxBoxSizer* s = new wxBoxSizer (wxVERTICAL);
_best_dcp_frame_rate->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::best_dcp_frame_rate_clicked), 0, this);
_dcp_audio_channels->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_audio_channels_changed), 0, this);
_j2k_bandwidth->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::j2k_bandwidth_changed), 0, this);
- _audio_gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
- _audio_gain_calculate_button->Connect (
- wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::audio_gain_calculate_button_clicked), 0, this
- );
- _show_audio->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::show_audio_clicked), 0, this);
- _audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
- _audio_stream->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::audio_stream_changed), 0, this);
_dcp_resolution->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (FilmEditor::dcp_resolution_changed), 0, this);
_sequence_video->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::sequence_video_changed), 0, this);
-
- _audio_mapping->Changed.connect (boost::bind (&FilmEditor::audio_mapping_changed, this, _1));
}
void
make_video_panel ();
_content_notebook->AddPage (_video_panel, _("Video"), false);
- make_audio_panel ();
- _content_notebook->AddPage (_audio_panel, _("Audio"), false);
+ _audio_panel = new AudioPanel (this);
_subtitle_panel = new SubtitlePanel (this);
_timing_panel = new TimingPanel (this);
}
-void
-FilmEditor::make_audio_panel ()
-{
- _audio_panel = new wxPanel (_content_notebook);
- wxBoxSizer* audio_sizer = new wxBoxSizer (wxVERTICAL);
- _audio_panel->SetSizer (audio_sizer);
-
- wxFlexGridSizer* grid = new wxFlexGridSizer (3, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
- audio_sizer->Add (grid, 0, wxALL, 8);
-
- _show_audio = new wxButton (_audio_panel, wxID_ANY, _("Show Audio..."));
- grid->Add (_show_audio, 1);
- grid->AddSpacer (0);
- grid->AddSpacer (0);
-
- add_label_to_sizer (grid, _audio_panel, _("Audio Gain"), true);
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_gain = new wxSpinCtrl (_audio_panel);
- s->Add (_audio_gain, 1);
- add_label_to_sizer (s, _audio_panel, _("dB"), false);
- grid->Add (s, 1);
- }
-
- _audio_gain_calculate_button = new wxButton (_audio_panel, wxID_ANY, _("Calculate..."));
- grid->Add (_audio_gain_calculate_button);
-
- add_label_to_sizer (grid, _audio_panel, _("Audio Delay"), false);
- {
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _audio_delay = new wxSpinCtrl (_audio_panel);
- s->Add (_audio_delay, 1);
- /// TRANSLATORS: this is an abbreviation for milliseconds, the unit of time
- add_label_to_sizer (s, _audio_panel, _("ms"), false);
- grid->Add (s);
- }
-
- grid->AddSpacer (0);
-
- add_label_to_sizer (grid, _audio_panel, _("Audio Stream"), true);
- _audio_stream = new wxChoice (_audio_panel, wxID_ANY);
- grid->Add (_audio_stream, 1, wxEXPAND);
- _audio_description = new wxStaticText (_audio_panel, wxID_ANY, wxT (""));
- grid->AddSpacer (0);
-
- grid->Add (_audio_description, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, 8);
- grid->AddSpacer (0);
- grid->AddSpacer (0);
-
- _audio_mapping = new AudioMappingView (_audio_panel);
- audio_sizer->Add (_audio_mapping, 1, wxEXPAND | wxALL, 6);
-
- _audio_gain->SetRange (-60, 60);
- _audio_delay->SetRange (-1000, 1000);
-}
-
/** Called when the left crop widget has been changed */
void
FilmEditor::left_crop_changed (wxCommandEvent &)
stringstream s;
+ _audio_panel->film_changed (p);
_subtitle_panel->film_changed (p);
_timing_panel->film_changed (p);
break;
case Film::CONTENT:
setup_content ();
- setup_show_audio_sensitivity ();
break;
case Film::CONTAINER:
setup_container ();
}
case Film::DCP_AUDIO_CHANNELS:
_dcp_audio_channels->SetValue (_film->dcp_audio_channels ());
- _audio_mapping->set_channels (_film->dcp_audio_channels ());
setup_dcp_name ();
break;
case Film::SEQUENCE_VIDEO:
ffmpeg_content = dynamic_pointer_cast<FFmpegContent> (content);
}
- _subtitle_panel->film_content_changed (content, subtitle_content, ffmpeg_content, property);
- _timing_panel->film_content_changed (content, subtitle_content, ffmpeg_content, property);
+ _audio_panel->film_content_changed (content, audio_content, subtitle_content, ffmpeg_content, property);
+ _subtitle_panel->film_content_changed (content, audio_content, subtitle_content, ffmpeg_content, property);
+ _timing_panel->film_content_changed (content, audio_content, subtitle_content, ffmpeg_content, property);
/* We can't use case {} here */
checked_set (_ratio, -1);
}
setup_scaling_description ();
- } else if (property == AudioContentProperty::AUDIO_GAIN) {
- checked_set (_audio_gain, audio_content ? audio_content->audio_gain() : 0);
- } else if (property == AudioContentProperty::AUDIO_DELAY) {
- checked_set (_audio_delay, audio_content ? audio_content->audio_delay() : 0);
- } else if (property == AudioContentProperty::AUDIO_MAPPING) {
- _audio_mapping->set (audio_content ? audio_content->audio_mapping () : AudioMapping ());
- } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
- _audio_stream->Clear ();
- if (ffmpeg_content) {
- vector<shared_ptr<FFmpegAudioStream> > a = ffmpeg_content->audio_streams ();
- for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
- _audio_stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx (lexical_cast<string> ((*i)->id))));
- }
-
- if (ffmpeg_content->audio_stream()) {
- checked_set (_audio_stream, lexical_cast<string> (ffmpeg_content->audio_stream()->id));
- }
- }
- setup_show_audio_sensitivity ();
} else if (property == FFmpegContentProperty::AUDIO_STREAM) {
setup_dcp_name ();
- setup_show_audio_sensitivity ();
} else if (property == FFmpegContentProperty::FILTERS) {
if (ffmpeg_content) {
pair<string, string> p = Filter::ffmpeg_strings (ffmpeg_content->filters ());
_name->Enable (s);
_use_dci_name->Enable (s);
_edit_dci_button->Enable (s);
- _ratio->Enable (s);
_content->Enable (s);
- _left_crop->Enable (s);
- _right_crop->Enable (s);
- _top_crop->Enable (s);
- _bottom_crop->Enable (s);
- _filters_button->Enable (s);
- _scaler->Enable (s);
_dcp_content_type->Enable (s);
_dcp_frame_rate->Enable (s);
_dcp_audio_channels->Enable (s);
_j2k_bandwidth->Enable (s);
- _audio_gain->Enable (s);
- _audio_gain_calculate_button->Enable (s);
- _show_audio->Enable (s);
- _audio_delay->Enable (s);
_container->Enable (s);
_subtitle_panel->setup_control_sensitivity ();
- setup_show_audio_sensitivity ();
+ _audio_panel->setup_sensitivity ();
setup_content_sensitivity ();
_best_dcp_frame_rate->Enable (s && _film && _film->best_dcp_video_frame_rate () != _film->dcp_video_frame_rate ());
}
}
}
-void
-FilmEditor::audio_gain_changed (wxCommandEvent &)
-{
- shared_ptr<AudioContent> ac = selected_audio_content ();
- if (!ac) {
- return;
- }
-
- ac->set_audio_gain (_audio_gain->GetValue ());
-}
-
-void
-FilmEditor::audio_delay_changed (wxCommandEvent &)
-{
- shared_ptr<AudioContent> ac = selected_audio_content ();
- if (!ac) {
- return;
- }
-
- ac->set_audio_delay (_audio_delay->GetValue ());
-}
-
-void
-FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
-{
- GainCalculatorDialog* d = new GainCalculatorDialog (this);
- d->ShowModal ();
-
- if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
- d->Destroy ();
- return;
- }
-
- _audio_gain->SetValue (
- Config::instance()->sound_processor()->db_for_fader_change (
- d->wanted_fader (),
- d->actual_fader ()
- )
- );
-
- /* This appears to be necessary, as the change is not signalled,
- I think.
- */
- wxCommandEvent dummy;
- audio_gain_changed (dummy);
-
- d->Destroy ();
-}
-
void
FilmEditor::setup_ratios ()
{
}
}
-void
-FilmEditor::show_audio_clicked (wxCommandEvent &)
-{
- if (_audio_dialog) {
- _audio_dialog->Destroy ();
- _audio_dialog = 0;
- }
-
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return;
- }
-
- shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (c);
- if (!ac) {
- return;
- }
-
- _audio_dialog = new AudioDialog (this);
- _audio_dialog->Show ();
- _audio_dialog->set_content (ac);
-}
-
void
FilmEditor::best_dcp_frame_rate_clicked (wxCommandEvent &)
{
_film->set_dcp_video_frame_rate (_film->best_dcp_video_frame_rate ());
}
-void
-FilmEditor::setup_show_audio_sensitivity ()
-{
- _show_audio->Enable (_film);
-}
-
void
FilmEditor::setup_content ()
{
{
setup_content_sensitivity ();
shared_ptr<Content> s = selected_content ();
-
- if (_audio_dialog && s && dynamic_pointer_cast<AudioContent> (s)) {
- _audio_dialog->set_content (dynamic_pointer_cast<AudioContent> (s));
- }
+ _audio_panel->content_selection_changed ();
+
film_content_changed (s, ContentProperty::START);
film_content_changed (s, ContentProperty::LENGTH);
film_content_changed (s, VideoContentProperty::VIDEO_CROP);
_timeline_dialog->Show ();
}
-void
-FilmEditor::audio_stream_changed (wxCommandEvent &)
-{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return;
- }
-
- shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c);
- if (!fc) {
- return;
- }
-
- vector<shared_ptr<FFmpegAudioStream> > a = fc->audio_streams ();
- vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin ();
- string const s = string_client_data (_audio_stream->GetClientObject (_audio_stream->GetSelection ()));
- while (i != a.end() && lexical_cast<string> ((*i)->id) != s) {
- ++i;
- }
-
- if (i != a.end ()) {
- fc->set_audio_stream (*i);
- }
-
- if (!fc->audio_stream ()) {
- _audio_description->SetLabel (wxT (""));
- } else {
- wxString s;
- if (fc->audio_channels() == 1) {
- s << _("1 channel");
- } else {
- s << fc->audio_channels() << wxT (" ") << _("channels");
- }
- s << wxT (", ") << fc->content_audio_frame_rate() << _("Hz");
- _audio_description->SetLabel (s);
- }
-}
-
-void
-FilmEditor::audio_mapping_changed (AudioMapping m)
-{
- shared_ptr<Content> c = selected_content ();
- if (!c) {
- return;
- }
-
- shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (c);
- if (!ac) {
- return;
- }
-
- ac->set_audio_mapping (m);
-}
-
void
FilmEditor::set_selection (weak_ptr<Content> wc)
{
class wxListCtrl;
class wxListEvent;
class Film;
-class AudioDialog;
class TimelineDialog;
-class AudioMappingView;
class Ratio;
class Timecode;
class TimingPanel;
class SubtitlePanel;
+class AudioPanel;
/** @class FilmEditor
* @brief A wx widget to edit a film's metadata, and perform various functions.
}
boost::shared_ptr<Content> selected_content ();
+ boost::shared_ptr<VideoContent> selected_video_content ();
+ boost::shared_ptr<AudioContent> selected_audio_content ();
boost::shared_ptr<SubtitleContent> selected_subtitle_content ();
bool generally_sensitive () const {
void make_dcp_panel ();
void make_content_panel ();
void make_video_panel ();
- void make_audio_panel ();
void connect_to_widgets ();
/* Handle changes to the view */
void container_changed (wxCommandEvent &);
void dcp_content_type_changed (wxCommandEvent &);
void scaler_changed (wxCommandEvent &);
- void audio_gain_changed (wxCommandEvent &);
- void audio_gain_calculate_button_clicked (wxCommandEvent &);
- void show_audio_clicked (wxCommandEvent &);
- void audio_delay_changed (wxCommandEvent &);
void j2k_bandwidth_changed (wxCommandEvent &);
void dcp_frame_rate_changed (wxCommandEvent &);
void best_dcp_frame_rate_clicked (wxCommandEvent &);
void edit_filters_clicked (wxCommandEvent &);
void content_timeline_clicked (wxCommandEvent &);
- void audio_stream_changed (wxCommandEvent &);
- void audio_mapping_changed (AudioMapping);
- void start_changed ();
- void length_changed ();
void ratio_changed (wxCommandEvent &);
void dcp_audio_channels_changed (wxCommandEvent &);
void dcp_resolution_changed (wxCommandEvent &);
void set_things_sensitive (bool);
void setup_ratios ();
void setup_dcp_name ();
- void setup_show_audio_sensitivity ();
void setup_scaling_description ();
void setup_content ();
void setup_container ();
void setup_content_sensitivity ();
void active_jobs_changed (bool);
- boost::shared_ptr<VideoContent> selected_video_content ();
- boost::shared_ptr<AudioContent> selected_audio_content ();
+ AudioPanel* _audio_panel;
SubtitlePanel* _subtitle_panel;
TimingPanel* _timing_panel;
wxPanel* _content_panel;
wxSizer* _content_sizer;
wxPanel* _video_panel;
- wxPanel* _audio_panel;
/** The film we are editing */
boost::shared_ptr<Film> _film;
wxStaticText* _filters;
wxButton* _filters_button;
wxChoice* _scaler;
- wxSpinCtrl* _audio_gain;
- wxButton* _audio_gain_calculate_button;
- wxButton* _show_audio;
- wxSpinCtrl* _audio_delay;
- wxSpinCtrl* _j2k_bandwidth;
+ wxSpinCtrl* _j2k_bandwidth;
wxChoice* _dcp_content_type;
wxChoice* _dcp_frame_rate;
wxSpinCtrl* _dcp_audio_channels;
wxButton* _best_dcp_frame_rate;
- wxChoice* _audio_stream;
- wxStaticText* _audio_description;
- AudioMappingView* _audio_mapping;
wxChoice* _dcp_resolution;
ContentMenu _menu;
std::vector<Ratio const *> _ratios;
bool _generally_sensitive;
- AudioDialog* _audio_dialog;
TimelineDialog* _timeline_dialog;
};
virtual void film_changed (Film::Property) {}
virtual void film_content_changed (
boost::shared_ptr<Content>,
+ boost::shared_ptr<AudioContent>,
boost::shared_ptr<SubtitleContent>,
boost::shared_ptr<FFmpegContent>,
int) = 0;
+ virtual void content_selection_changed () {}
protected:
FilmEditor* _editor;
void
SubtitlePanel::film_content_changed (
shared_ptr<Content>,
+ shared_ptr<AudioContent>,
shared_ptr<SubtitleContent> subtitle_content,
shared_ptr<FFmpegContent> ffmpeg_content,
int property
void film_changed (Film::Property);
void film_content_changed (
boost::shared_ptr<Content>,
+ boost::shared_ptr<AudioContent>,
boost::shared_ptr<SubtitleContent>,
boost::shared_ptr<FFmpegContent>,
int);
}
void
-TimingPanel::film_content_changed (shared_ptr<Content> content, shared_ptr<SubtitleContent>, shared_ptr<FFmpegContent>, int property)
+TimingPanel::film_content_changed (
+ shared_ptr<Content> content,
+ shared_ptr<AudioContent>,
+ shared_ptr<SubtitleContent>,
+ shared_ptr<FFmpegContent>,
+ int property
+ )
{
if (property == ContentProperty::START) {
if (content) {
void film_content_changed (
boost::shared_ptr<Content>,
+ boost::shared_ptr<AudioContent>,
boost::shared_ptr<SubtitleContent>,
boost::shared_ptr<FFmpegContent>,
int);
about_dialog.cc
audio_dialog.cc
audio_mapping_view.cc
+ audio_panel.cc
audio_plot.cc
config_dialog.cc
content_menu.cc