MCPcopy Create free account
hub / github.com/audacity/audacity / StretchLeftTo

Method StretchLeftTo

libraries/lib-wave-track/WaveClip.cpp:569–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569void WaveClip::StretchLeftTo(double to)
570{
571 const auto pet = GetPlayEndTime();
572 if (to >= pet)
573 return;
574 const auto oldPlayDuration = pet - GetPlayStartTime();
575 const auto newPlayDuration = pet - to;
576 const auto ratioChange = newPlayDuration / oldPlayDuration;
577 mSequenceOffset = pet - (pet - mSequenceOffset) * ratioChange;
578 mTrimLeft *= ratioChange;
579 mTrimRight *= ratioChange;
580 mClipStretchRatio *= ratioChange;
581 mEnvelope->SetOffset(mSequenceOffset);
582 mEnvelope->RescaleTimesBy(ratioChange);
583 StretchCutLines(ratioChange);
584 Observer::Publisher<StretchRatioChange>::Publish(
585 StretchRatioChange { GetStretchRatio() });
586}
587
588void WaveClip::StretchRightTo(double to)
589{

Callers 1

StretchLeftToFunction · 0.80

Calls 2

SetOffsetMethod · 0.80
RescaleTimesByMethod · 0.80

Tested by

no test coverage detected