-/** Create a new AudioRegion, that is part of an existing one */
-AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
- : Region (other, offset, length, name, layer, flags)
- , _automatable(other->session())
- , _fade_in (new AutomationList(*other->_fade_in, offset, offset + length))
- , _fade_out (new AutomationList(*other->_fade_out, offset, offset + length))
- , _envelope (new AutomationList(*other->_envelope, offset, offset + length))
-{
- set<boost::shared_ptr<Source> > unique_srcs;
-
- for (SourceList::const_iterator i= other->_sources.begin(); i != other->_sources.end(); ++i) {
- _sources.push_back (*i);
-
- pair<set<boost::shared_ptr<Source> >::iterator,bool> result;
-
- result = unique_srcs.insert (*i);
-
- if (result.second) {
- boost::shared_ptr<AudioFileSource> afs = boost::dynamic_pointer_cast<AudioFileSource> (*i);
- if (afs) {
- afs->HeaderPositionOffsetChanged.connect (mem_fun (*this, &AudioRegion::source_offset_changed));
- }
- }
- }
-
- /* return to default fades if the existing ones are too long */
-
- if (_flags & LeftOfSplit) {
- if (_fade_in->back()->when >= _length) {
- set_default_fade_in ();
- } else {
- _fade_in_disabled = other->_fade_in_disabled;
- }
- set_default_fade_out ();
- _flags = Flag (_flags & ~Region::LeftOfSplit);
- }
-
- if (_flags & RightOfSplit) {
- if (_fade_out->back()->when >= _length) {
- set_default_fade_out ();
- } else {
- _fade_out_disabled = other->_fade_out_disabled;
- }
- set_default_fade_in ();
- _flags = Flag (_flags & ~Region::RightOfSplit);
- }
-
- _scale_amplitude = other->_scale_amplitude;
-
- assert(_type == DataType::AUDIO);
-
- listen_to_my_curves ();
- listen_to_my_sources ();
-}
-
-AudioRegion::AudioRegion (boost::shared_ptr<const AudioRegion> other)
- : Region (other)