Basic template support (#485).
[dcpomatic.git] / src / lib / audio_content.cc
index e66b8b998ded170d9ec2d56df47417c278c653b7..5d89719f77d49214dc230dac66afb9f80f941a65 100644 (file)
@@ -379,3 +379,19 @@ AudioContent::set_stream (AudioStreamPtr stream)
 
        _parent->signal_changed (AudioContentProperty::STREAMS);
 }
+
+void
+AudioContent::use_template (shared_ptr<const AudioContent> c)
+{
+       _gain = c->_gain;
+       _delay = c->_delay;
+
+       size_t i = 0;
+       size_t j = 0;
+
+       while (i < _streams.size() && j < c->_streams.size()) {
+               _streams[i]->set_mapping (c->_streams[j]->mapping());
+               ++i;
+               ++j;
+       }
+}