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

Method ProcessWithTimeWarper

libraries/lib-builtin-effects/SoundTouchBase.cpp:73–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71#endif
72
73bool SoundTouchBase::ProcessWithTimeWarper(InitFunction initer,
74 const TimeWarper &warper,
75 bool preserveLength)
76{
77 // Assumes that mSoundTouch has already been initialized
78 // by the subclass for subclass-specific parameters. The
79 // time warper should also be set.
80
81 // Check if this effect will alter the selection length; if so, we need
82 // to operate on sync-lock selected tracks.
83 bool mustSync = true;
84 if (mT1 == warper.Warp(mT1)) {
85 mustSync = false;
86 }
87
88 //Iterate over each track
89 // Needs all for sync-lock grouping.
90 EffectOutputTracks outputs { *mTracks, GetType(), { { mT0, mT1 } }, true };
91 bool bGoodResult = true;
92
93 mPreserveLength = preserveLength;
94 mCurTrackNum = 0;
95 m_maxNewLength = 0.0;
96
97 outputs.Get().Any().VisitWhile(bGoodResult,
98 [&](auto &&fallthrough){ return [&](LabelTrack &lt) {
99 if ( !(lt.GetSelected() ||
100 (mustSync && SyncLock::IsSyncLockSelected(lt))) )
101 return fallthrough();
102 if (!ProcessLabelTrack(&lt, warper))
103 bGoodResult = false;
104 }; },
105#ifdef USE_MIDI
106 [&](auto &&fallthrough){ return [&](NoteTrack &nt) {
107 if (!(nt.GetSelected() ||
108 (mustSync && SyncLock::IsSyncLockSelected(nt))))
109 return fallthrough();
110 if (!ProcessNoteTrack(&nt, warper))
111 bGoodResult = false;
112 }; },
113#endif
114 [&](auto &&fallthrough){ return [&](WaveTrack &orig) {
115 if (!orig.GetSelected())
116 return fallthrough();
117
118 if (!orig.NIntervals())
119 return fallthrough();
120
121 // Process only if the right marker is to the right of the left marker
122 if (mT1 > mT0) {
123 //Transform the marker timepoints to samples
124 const auto start = orig.TimeToLongSamples(mT0);
125 const auto end = orig.TimeToLongSamples(mT1);
126
127 const auto tempTrack = orig.EmptyCopy();
128 auto &out = *tempTrack;
129
130 const auto pSoundTouch = std::make_unique<soundtouch::SoundTouch>();

Callers

nothing calls this directly

Calls 15

ProcessOneFunction · 0.85
VisitWhileMethod · 0.80
TimeToLongSamplesMethod · 0.80
EmptyCopyMethod · 0.80
ChannelsMethod · 0.80
WarpMethod · 0.45
AnyMethod · 0.45
GetMethod · 0.45
GetSelectedMethod · 0.45
NIntervalsMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected