summaryrefslogtreecommitdiff
path: root/src/lib/audio_content.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-07-21 21:47:25 +0100
committerCarl Hetherington <cth@carlh.net>2018-07-21 21:47:25 +0100
commit6199e090dc1e32d3753ba7e7d7ea8c5f0d79f046 (patch)
treeb09d9b6b19dadb694590981775a61f829b6f3622 /src/lib/audio_content.cc
parentcbd4450197a083bf58bda510e626f73ba583cb66 (diff)
Revert "Remove join function; the code is long and I don't think anybody"
It turns out Carsten uses it :) This reverts commit bd5e8b83a3a18787241982efdae809d4db21f65d.
Diffstat (limited to 'src/lib/audio_content.cc')
-rw-r--r--src/lib/audio_content.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index d4ce6c243..a252e4b5a 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -91,6 +91,27 @@ AudioContent::AudioContent (Content* parent, cxml::ConstNodePtr node)
}
}
+AudioContent::AudioContent (Content* parent, vector<shared_ptr<Content> > c)
+ : ContentPart (parent)
+{
+ shared_ptr<AudioContent> ref = c[0]->audio;
+ DCPOMATIC_ASSERT (ref);
+
+ for (size_t i = 1; i < c.size(); ++i) {
+ if (c[i]->audio->gain() != ref->gain()) {
+ throw JoinError (_("Content to be joined must have the same audio gain."));
+ }
+
+ if (c[i]->audio->delay() != ref->delay()) {
+ throw JoinError (_("Content to be joined must have the same audio delay."));
+ }
+ }
+
+ _gain = ref->gain ();
+ _delay = ref->delay ();
+ _streams = ref->streams ();
+}
+
void
AudioContent::as_xml (xmlpp::Node* node) const
{