Audacity 3.2.0
Functions | Variables
TimeStretching Namespace Reference

Functions

WAVE_TRACK_API bool HasPitchOrSpeed (const WaveTrack &track, double t0, double t1)
 
WAVE_TRACK_API void WithClipRenderingProgress (std::function< void(const ProgressReporter &)> action, TranslatableString title=defaultStretchRenderingTitle)
 
WAVE_TRACK_API bool SetClipStretchRatio (const WaveTrack &track, WaveTrack::Interval &interval, double stretchRatio)
 

Variables

WAVE_TRACK_API const TranslatableString defaultStretchRenderingTitle
 

Function Documentation

◆ HasPitchOrSpeed()

bool TimeStretching::HasPitchOrSpeed ( const WaveTrack track,
double  t0,
double  t1 
)

Whether any clips, whose play regions intersect the interval, have non-unit stretch ratio

Definition at line 23 of file TimeStretching.cpp.

25{
26 auto clips = track.Intervals();
27 return std::any_of(clips.begin(), clips.end(), [&](auto pClip) {
28 return pClip->IntersectsPlayRegion(t0, t1) && pClip->HasPitchOrSpeed();
29 });
30}
auto Intervals()
Definition: WaveTrack.h:671

References WaveTrack::Intervals().

Referenced by EffectOutputTracks::EffectOutputTracks(), AmplifyBase::Init(), AutoDuckBase::Process(), and Repair::Process().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetClipStretchRatio()

bool TimeStretching::SetClipStretchRatio ( const WaveTrack track,
WaveTrack::Interval interval,
double  stretchRatio 
)

Definition at line 40 of file TimeStretching.cpp.

42{
43 const auto nextClip =
45 const auto maxEndTime = nextClip != nullptr ?
46 nextClip->Start() :
47 std::numeric_limits<double>::infinity();
48
49 const auto start = interval.Start();
50 const auto end = interval.End();
51
52 const auto expectedEndTime =
53 start + (end - start) * stretchRatio / interval.GetStretchRatio();
54
55 if (expectedEndTime > maxEndTime)
56 return false;
57
58 interval.StretchRightTo(expectedEndTime);
59 return true;
60}
double GetStretchRatio() const override
Definition: WaveClip.cpp:625
double Start() const override
Definition: WaveClip.cpp:340
double End() const override
Definition: WaveClip.cpp:345
void StretchRightTo(double to)
Sets from the right to the absolute time (if in expected range)
Definition: WaveClip.cpp:588
IntervalConstHolder GetNextInterval(const Interval &interval, PlaybackDirection searchDirection) const
Definition: WaveTrack.cpp:173
const char * end(const char *str) noexcept
Definition: StringUtils.h:106

References WaveClip::End(), details::end(), forward, WaveTrack::GetNextInterval(), WaveClip::GetStretchRatio(), WaveClip::Start(), and WaveClip::StretchRightTo().

Referenced by ClipPitchAndSpeedButtonHandle::DoRelease(), and PitchAndSpeedDialog::SetClipSpeed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WithClipRenderingProgress()

void TimeStretching::WithClipRenderingProgress ( std::function< void(const ProgressReporter &)>  action,
TranslatableString  title = defaultStretchRenderingTitle 
)

Definition at line 32 of file TimeStretching.cpp.

35{
37 std::move(title), XO("Rendering Clip"));
38}
XO("Cut/Copy/Paste")
static const auto title
static void WithCancellableProgress(std::function< void(const ProgressReporter &)> action, TranslatableString title, TranslatableString message)
A frequently useful convenience wraps a lambda and may throw this type.

References title, UserException::WithCancellableProgress(), and XO().

Referenced by EffectOutputTracks::EffectOutputTracks(), anonymous_namespace{EditMenus.cpp}::OnJoin(), anonymous_namespace{LabelMenus.cpp}::OnJoinLabels(), WaveTrackAffordanceControls::OnRenderClipStretching(), and anonymous_namespace{EditMenus.cpp}::OnSilence().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ defaultStretchRenderingTitle

const TranslatableString TimeStretching::defaultStretchRenderingTitle
extern
Initial value:
=
XO("Pre-processing")

Audacity: A Digital Audio Editor

TimeStretching.cpp

Paul Licameli

Definition at line 20 of file TimeStretching.cpp.

Referenced by AutoDuckBase::Process().