set_default_fade_in ();
_right_of_split = false;
}
+
+ /* If _length changed, adjust our gain envelope accordingly */
+ _envelope->truncate_end (_length);
}
void
return _read_at (_sources, _length, buf, 0, 0, _position + timeline_position, cnt, channel, 0, 0, ReadOps (0));
}
-framecnt_t
-AudioRegion::read_with_ops (Sample* buf, framepos_t file_position, framecnt_t cnt, int channel, ReadOps rops) const
-{
- return _read_at (_sources, _length, buf, 0, 0, file_position, cnt, channel, 0, 0, rops);
-}
-
framecnt_t
AudioRegion::read_at (Sample *buf, Sample *mixdown_buffer, float *gain_buffer,
framepos_t file_position, framecnt_t cnt, uint32_t chan_n,
return 0;
}
-bool
-AudioRegion::set_property (const PropertyBase& prop)
-{
- DEBUG_TRACE (DEBUG::Properties, string_compose ("audio region %1 set property %2\n", _name.val(), prop.property_name()));
-
- if (prop == Properties::envelope_active.property_id) {
- bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
- if (val != _envelope_active) {
- _envelope_active = val;
- return true;
- }
- } else if (prop == Properties::default_fade_in.property_id) {
- bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
- if (val != _default_fade_in) {
- _default_fade_in = val;
- return true;
- }
- } else if (prop == Properties::default_fade_out.property_id) {
- bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
- if (val != _default_fade_out) {
- _default_fade_out = val;
- return true;
- }
- } else if (prop == Properties::fade_in_active.property_id) {
- bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
- if (val != _fade_in_active) {
- _fade_in_active = val;
- return true;
- }
- } else if (prop == Properties::fade_out_active.property_id) {
- bool val = dynamic_cast<const PropertyTemplate<bool>*>(&prop)->val();
- if (val != _fade_out_active) {
- _fade_out_active = val;
- return true;
- }
- } else if (prop == Properties::scale_amplitude.property_id) {
- gain_t val = dynamic_cast<const PropertyTemplate<gain_t>*>(&prop)->val();
- if (val != _scale_amplitude) {
- _scale_amplitude = val;
- return true;
- }
- } else {
- return Region::set_property (prop);
- }
-
- return false;
-}
-
int
AudioRegion::set_state (const XMLNode& node, int version)
{
_envelope->set_max_xval (_length);
_envelope->thaw ();
+ if (_left_of_split) {
+ set_default_fade_out ();
+ _left_of_split = false;
+ } else if (_fade_out->back()->when > _length) {
+ _fade_out->extend_to (_length);
+ send_change (PropertyChange (Properties::fade_out));
+ }
+
if (_fade_in->back()->when > _length) {
_fade_in->extend_to (_length);
send_change (PropertyChange (Properties::fade_in));
}
-
- if (_fade_out->back()->when > _length) {
- _fade_out->extend_to (_length);
- send_change (PropertyChange (Properties::fade_out));
- }
}
void
_envelope->truncate_start (_length);
- if (_fade_in->back()->when > _length) {
+ if (_right_of_split) {
+ set_default_fade_in ();
+ _right_of_split = false;
+ } else if (_fade_in->back()->when > _length) {
_fade_in->extend_to (_length);
send_change (PropertyChange (Properties::fade_in));
}