1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-20 14:20:06 +02:00

Cut then paste has no net effect on envelope in some more cases...

... whereas before, some incorrect disconituities could remain near the start
of the selection.

To find reproducible cases before this commit might involve varying the left
edge of the selection by small amounts, because this problem depended on
little roundoff errors.
This commit is contained in:
Paul Licameli 2017-06-26 12:04:21 -04:00
parent 6373a5085c
commit bbab89b52c

View File

@ -717,7 +717,13 @@ void Envelope::CollapseRegion( double t0, double t1, double sampleDur )
auto len = mEnv.size();
for ( size_t i = begin; i < len; ++i ) {
auto &point = mEnv[i];
point.SetT( point.GetT() - (t1 - t0) );
if (rightPoint && i == begin)
// Avoid roundoff error.
// Make exactly equal times of neighboring points so that we have
// a real discontinuity.
point.SetT( t0 );
else
point.SetT( point.GetT() - (t1 - t0) );
}
// See if the discontinuity is removable.