/*
Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
- This program is free software; you can redistribute it and/or modify
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic 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,
+ DCP-o-matic 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.
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
*/
#include "content_panel.h"
#include "audio_dialog.h"
#include "lib/config.h"
+#include "lib/ffmpeg_audio_stream.h"
#include "lib/ffmpeg_content.h"
#include "lib/cinema_sound_processor.h"
#include "lib/job_manager.h"
_gain = new ContentSpinCtrlDouble<AudioContent> (
this,
new wxSpinCtrlDouble (this),
- AudioContentProperty::AUDIO_GAIN,
+ AudioContentProperty::GAIN,
&Content::audio,
- boost::mem_fn (&AudioContent::audio_gain),
- boost::mem_fn (&AudioContent::set_audio_gain)
+ boost::mem_fn (&AudioContent::gain),
+ boost::mem_fn (&AudioContent::set_gain)
);
_gain->add (grid, wxGBPosition (r, 1));
_delay = new ContentSpinCtrl<AudioContent> (
this,
new wxSpinCtrl (this),
- AudioContentProperty::AUDIO_DELAY,
+ AudioContentProperty::DELAY,
&Content::audio,
- boost::mem_fn (&AudioContent::audio_delay),
- boost::mem_fn (&AudioContent::set_audio_delay)
+ boost::mem_fn (&AudioContent::delay),
+ boost::mem_fn (&AudioContent::set_delay)
);
_delay->add (grid, wxGBPosition (r, 1));
AudioPanel::film_content_changed (int property)
{
ContentList ac = _parent->selected_audio ();
- if (property == AudioContentProperty::AUDIO_STREAMS) {
+ if (property == AudioContentProperty::STREAMS) {
if (ac.size() == 1) {
- _mapping->set (ac.front()->audio->audio_mapping());
- _mapping->set_input_channels (ac.front()->audio->audio_channel_names ());
+ _mapping->set (ac.front()->audio->mapping());
+ _mapping->set_input_channels (ac.front()->audio->channel_names ());
+
+ vector<AudioMappingView::Group> groups;
+ int c = 0;
+ BOOST_FOREACH (shared_ptr<const AudioStream> i, ac.front()->audio->streams()) {
+ shared_ptr<const FFmpegAudioStream> f = dynamic_pointer_cast<const FFmpegAudioStream> (i);
+ string name = "";
+ if (f) {
+ name = f->name;
+ if (f->codec_name) {
+ name += " (" + f->codec_name.get() + ")";
+ }
+ }
+ groups.push_back (AudioMappingView::Group (c, c + i->channels() - 1, name));
+ c += i->channels ();
+ }
+ _mapping->set_input_groups (groups);
+
} else {
_mapping->set (AudioMapping ());
}
setup_description ();
setup_peak ();
_sizer->Layout ();
- } else if (property == AudioContentProperty::AUDIO_GAIN) {
+ } else if (property == AudioContentProperty::GAIN) {
setup_peak ();
} else if (property == DCPContentProperty::REFERENCE_AUDIO) {
if (ac.size() == 1) {
}
setup_sensitivity ();
- } else if (property == AudioContentProperty::AUDIO_VIDEO_FRAME_RATE) {
+ } else if (property == ContentProperty::VIDEO_FRAME_RATE) {
setup_description ();
}
}
{
ContentList c = _parent->selected_audio ();
if (c.size() == 1) {
- c.front()->audio->set_audio_mapping (m);
+ c.front()->audio->set_mapping (m);
}
}
_gain->set_content (sel);
_delay->set_content (sel);
- film_content_changed (AudioContentProperty::AUDIO_STREAMS);
+ film_content_changed (AudioContentProperty::STREAMS);
film_content_changed (DCPContentProperty::REFERENCE_AUDIO);
setup_sensitivity ();
d->set_reference_audio (_reference->GetValue ());
}
+
+void
+AudioPanel::set_film (shared_ptr<Film>)
+{
+ /* We are changing film, so destroy any audio dialog for the old one */
+ if (_audio_dialog) {
+ _audio_dialog->Destroy ();
+ _audio_dialog = 0;
+ }
+}