mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 14:02:57 +02:00
Bug842: rescale clip offsets, envelope times when setting track rate
This commit is contained in:
@@ -1038,6 +1038,21 @@ void Envelope::SetTrackLen(double trackLen)
|
||||
}
|
||||
}
|
||||
|
||||
void Envelope::RescaleTimes( double newLength )
|
||||
// NOFAIL-GUARANTEE
|
||||
{
|
||||
if ( mTrackLen == 0 ) {
|
||||
for ( auto &point : mEnv )
|
||||
point.SetT( 0 );
|
||||
}
|
||||
else {
|
||||
auto ratio = newLength / mTrackLen;
|
||||
for ( auto &point : mEnv )
|
||||
point.SetT( point.GetT() * ratio );
|
||||
}
|
||||
mTrackLen = newLength;
|
||||
}
|
||||
|
||||
// Accessors
|
||||
double Envelope::GetValue(double t) const
|
||||
{
|
||||
|
Reference in New Issue
Block a user