return _set_state (node, version, what_changed, true);
}
+void
+AudioRegion::fade_range (framepos_t start, framepos_t end)
+{
+ framepos_t s, e;
+
+ switch (coverage (start, end)) {
+ case Evoral::OverlapStart:
+ s = _position;
+ e = end;
+ set_fade_in (FadeConstantPower, e - s);
+ break;
+ case Evoral::OverlapEnd:
+ s = start;
+ e = _position + _length;
+ set_fade_out (FadeConstantPower, e - s);
+ break;
+ case Evoral::OverlapInternal:
+ /* needs addressing, perhaps. Difficult to do if we can't
+ * control one edge of the fade relative to the relevant edge
+ * of the region, which we cannot - fades are currently assumed
+ * to start/end at the start/end of the region
+ */
+ break;
+ default:
+ return;
+ }
+}
+
void
AudioRegion::set_fade_in_shape (FadeShape shape)
{
_fade_in->clear ();
_inverse_fade_in->clear ();
- const int num_steps = min((framecnt_t)256, max ((framecnt_t) 16, len / 512));
+ const int num_steps = 32;
switch (shape) {
case FadeLinear:
_fade_in->fast_simple_add (0.5 * len, 0.6);
//now generate a fade-out curve by successively applying a gain drop
const double breakpoint = 0.7; //linear for first 70%
- for (int i = 2; i < num_steps; i++) {
- const double offset = 1.0 - breakpoint;
- float coeff = 1.0 - breakpoint;
- for (int j = 0; j < i; j++) {
- coeff *= 0.5; //6dB drop per step
- }
- _fade_in->fast_simple_add (len * (breakpoint + (offset * (double)i / (double)num_steps)), coeff);
+ for (int i = 2; i < 9; ++i) {
+ const float coeff = (1.f - breakpoint) * powf (0.5, i);
+ _fade_in->fast_simple_add (len * (breakpoint + ((1.0 - breakpoint) * (double)i / 9.0)), coeff);
}
_fade_in->fast_simple_add (len, VERY_SMALL_SIGNAL);
reverse_curve (c3, _fade_in.val());
break;
}
+ _fade_in->set_interpolation(Evoral::ControlList::Curved);
+ _inverse_fade_in->set_interpolation(Evoral::ControlList::Curved);
+
_default_fade_in = false;
_fade_in->thaw ();
send_change (PropertyChange (Properties::fade_in));
_fade_out->clear ();
_inverse_fade_out->clear ();
- const int num_steps = min((framecnt_t)256, max ((framecnt_t) 16, len / 512));
+ const int num_steps = 32;
switch (shape) {
case FadeLinear:
//start with a nearly linear cuve
_fade_out->fast_simple_add (0, 1);
_fade_out->fast_simple_add (0.5 * len, 0.6);
-
//now generate a fade-out curve by successively applying a gain drop
const double breakpoint = 0.7; //linear for first 70%
- for (int i = 2; i < num_steps; i++) {
- const double offset = 1.0 - breakpoint;
- float coeff = 1.0 - breakpoint;
- for (int j = 0; j < i; j++) {
- coeff *= 0.5; // 6dB drop per step
- }
- _fade_out->fast_simple_add (len * (breakpoint + (offset * (double)i / (double)num_steps)), coeff);
+ for (int i = 2; i < 9; ++i) {
+ const float coeff = (1.f - breakpoint) * powf (0.5, i);
+ _fade_out->fast_simple_add (len * (breakpoint + ((1.0 - breakpoint) * (double)i / 9.0)), coeff);
}
_fade_out->fast_simple_add (len, VERY_SMALL_SIGNAL);
reverse_curve (_inverse_fade_out.val(), _fade_out.val());
break;
}
+ _fade_out->set_interpolation(Evoral::ControlList::Curved);
+ _inverse_fade_out->set_interpolation(Evoral::ControlList::Curved);
+
_default_fade_out = false;
_fade_out->thaw ();
send_change (PropertyChange (Properties::fade_out));