, _automatable (other->session())
, _fade_in (new AutomationList (*other->_fade_in))
, _fade_out (new AutomationList (*other->_fade_out))
- /* XXX is this guaranteed to work for all values of offset+offset_relative? */
- , _envelope (new AutomationList (*other->_envelope, _start, _start + _length))
+ /* As far as I can see, the _envelope's times are relative to region position, and have nothing
+ to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset.
+ */
+ , _envelope (new AutomationList (*other->_envelope, offset, other->_length))
, _fade_in_suspended (0)
, _fade_out_suspended (0)
{
}
XMLNode&
-AudioRegion::state (bool full)
+AudioRegion::state ()
{
- XMLNode& node (Region::state (full));
+ XMLNode& node (Region::state ());
XMLNode *child;
char buf[64];
LocaleGuard lg (X_("POSIX"));
snprintf (buf, sizeof (buf), "%u", (uint32_t) _sources.size());
node.add_property ("channels", buf);
- if (full) {
- Stateful::add_properties (node);
- }
+ Stateful::add_properties (node);
child = node.add_child ("Envelope");
- if (full) {
- bool default_env = false;
-
- // If there are only two points, the points are in the start of the region and the end of the region
- // so, if they are both at 1.0f, that means the default region.
-
- if (_envelope->size() == 2 &&
- _envelope->front()->value == 1.0f &&
- _envelope->back()->value==1.0f) {
- if (_envelope->front()->when == 0 && _envelope->back()->when == _length) {
- default_env = true;
- }
+ bool default_env = false;
+
+ // If there are only two points, the points are in the start of the region and the end of the region
+ // so, if they are both at 1.0f, that means the default region.
+
+ if (_envelope->size() == 2 &&
+ _envelope->front()->value == 1.0f &&
+ _envelope->back()->value==1.0f) {
+ if (_envelope->front()->when == 0 && _envelope->back()->when == _length) {
+ default_env = true;
}
+ }
+
+ if (default_env) {
+ child->add_property ("default", "yes");
+ } else {
+ child->add_child_nocopy (_envelope->get_state ());
+ }
- if (default_env) {
- child->add_property ("default", "yes");
- } else {
- child->add_child_nocopy (_envelope->get_state ());
- }
+ child = node.add_child (X_("FadeIn"));
+ if (_default_fade_in) {
+ child->add_property ("default", "yes");
} else {
+ child->add_child_nocopy (_fade_in->get_state ());
+ }
+
+ child = node.add_child (X_("FadeOut"));
+
+ if (_default_fade_out) {
child->add_property ("default", "yes");
+ } else {
+ child->add_child_nocopy (_fade_out->get_state ());
}
return node;