/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2014 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
using std::make_pair;
using std::pair;
using std::string;
+using std::min;
using boost::shared_ptr;
using boost::lexical_cast;
using boost::dynamic_pointer_cast;
}
/** Create a default AudioMapping for a given channel count.
- * @param c Number of channels.
+ * @param channels Number of channels.
*/
-AudioMapping::AudioMapping (int c)
+AudioMapping::AudioMapping (int channels)
{
- setup (c);
+ setup (channels);
}
void
_gain.resize (_content_channels);
for (int i = 0; i < _content_channels; ++i) {
- _gain[i].resize (MAX_AUDIO_CHANNELS);
+ _gain[i].resize (MAX_DCP_AUDIO_CHANNELS);
}
}
AudioMapping::make_default ()
{
for (int i = 0; i < _content_channels; ++i) {
- for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) {
+ for (int j = 0; j < MAX_DCP_AUDIO_CHANNELS; ++j) {
_gain[i][j] = 0;
}
}
set (0, dcp::CENTRE, 1);
} else {
/* 1:1 mapping */
- for (int i = 0; i < _content_channels; ++i) {
+ for (int i = 0; i < min (_content_channels, MAX_DCP_AUDIO_CHANNELS); ++i) {
set (i, static_cast<dcp::Channel> (i), 1);
}
}
node->add_child ("ContentChannels")->add_child_text (lexical_cast<string> (_content_channels));
for (int c = 0; c < _content_channels; ++c) {
- for (int d = 0; d < MAX_AUDIO_CHANNELS; ++d) {
+ for (int d = 0; d < MAX_DCP_AUDIO_CHANNELS; ++d) {
xmlpp::Element* t = node->add_child ("Gain");
t->set_attribute ("Content", lexical_cast<string> (c));
t->set_attribute ("DCP", lexical_cast<string> (d));