using std::vector;
using std::setfill;
using std::min;
+using std::max;
using std::make_pair;
using std::endl;
using std::cout;
{
_audio_processor = processor;
signal_changed (AUDIO_PROCESSOR);
+ signal_changed (AUDIO_CHANNELS);
}
void
return vector<string> (n.begin(), n.begin() + audio_channels ());
}
+
+int
+Film::audio_channels () const
+{
+ int minimum = 0;
+ if (_audio_processor) {
+ minimum = _audio_processor->out_channels ();
+ }
+
+ if (minimum % 2 == 1) {
+ ++minimum;
+ }
+
+ return max (minimum, _audio_channels);
+}
return _video_frame_rate;
}
- int audio_channels () const {
- return _audio_channels;
- }
+ int audio_channels () const;
bool three_d () const {
return _three_d;
int _video_frame_rate;
/** The date that we should use in a ISDCF name */
boost::gregorian::date _isdcf_date;
- /** Number of audio channels to put in the DCP */
+ /** Number of audio channels requested for the DCP; this will be overridden
+ if we are using an audio processor which outputs more channels.
+ */
int _audio_channels;
/** If true, the DCP will be written in 3D mode; otherwise in 2D.
This will be regardless of what content is on the playlist.
#include "lib/ffmpeg_content.h"
#include "lib/audio_processor.h"
#include <dcp/key.h>
+#include <dcp/raw_convert.h>
#include <wx/wx.h>
#include <wx/notebook.h>
#include <wx/gbsizer.h>
using std::list;
using std::string;
using std::vector;
+using std::pair;
+using std::make_pair;
using boost::lexical_cast;
using boost::shared_ptr;
return;
}
- _film->set_audio_channels ((_audio_channels->GetSelection () + 1) * 2);
+ _film->set_audio_channels (dcp::raw_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
}
void
break;
}
case Film::AUDIO_CHANNELS:
- checked_set (_audio_channels, (_film->audio_channels () / 2) - 1);
+ checked_set (_audio_channels, dcp::raw_convert<string> (_film->audio_channels ()));
setup_dcp_name ();
break;
case Film::THREE_D:
} else {
checked_set (_audio_processor, 0);
}
+ setup_audio_channels_choice ();
+ film_changed (Film::AUDIO_CHANNELS);
break;
default:
break;
return panel;
}
+void
+DCPPanel::setup_audio_channels_choice ()
+{
+ int min = 2;
+ if (_film && _film->audio_processor ()) {
+ min = _film->audio_processor()->out_channels ();
+ }
+
+ if (min % 2 == 1) {
+ ++min;
+ }
+
+ vector<pair<string, string> > items;
+ for (int i = min; i <= 12; i += 2) {
+ items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
+ }
+
+ checked_set (_audio_channels, items);
+}
+
wxPanel *
DCPPanel::make_audio_panel ()
{
add_label_to_grid_bag_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
_audio_channels = new wxChoice (panel, wxID_ANY);
- for (int i = 2; i <= 12; i += 2) {
- _audio_channels->Append (wxString::Format ("%d", i));
- }
+ setup_audio_channels_choice ();
grid->Add (_audio_channels, wxGBPosition (r, 1));
++r;