summaryrefslogtreecommitdiff
path: root/src/lib/audio_mapping.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-05-10 14:13:10 +0100
committerCarl Hetherington <cth@carlh.net>2014-05-10 14:13:10 +0100
commitcfdd68eb5fb0ef8423e860103ad4e5510994f1da (patch)
tree9ea43b250723775329741e59d5bc2dd861bcb7be /src/lib/audio_mapping.cc
parent1dcfb3a26085ebb3703f40e2f51e43ce3d98be50 (diff)
parent5575a950f13dbed1e60d733aee71b316c3429ae0 (diff)
Merge master.
Diffstat (limited to 'src/lib/audio_mapping.cc')
-rw-r--r--src/lib/audio_mapping.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/audio_mapping.cc b/src/lib/audio_mapping.cc
index f6d747b9b..969397b0b 100644
--- a/src/lib/audio_mapping.cc
+++ b/src/lib/audio_mapping.cc
@@ -28,6 +28,7 @@ using std::cout;
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;
@@ -53,7 +54,7 @@ AudioMapping::setup (int c)
_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);
}
}
@@ -61,7 +62,7 @@ void
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;
}
}
@@ -71,7 +72,7 @@ AudioMapping::make_default ()
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);
}
}
@@ -117,7 +118,7 @@ AudioMapping::as_xml (xmlpp::Node* node) const
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));