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

Method CopyRange

libraries/lib-mixer/Envelope.cpp:286–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void Envelope::CopyRange(const Envelope &orig, size_t begin, size_t end)
287{
288 size_t len = orig.mEnv.size();
289 size_t i = begin;
290
291 // Create the point at 0 if it needs interpolated representation
292 if ( i > 0 )
293 AddPointAtEnd(0, orig.GetValue(mOffset));
294
295 // Copy points from inside the copied region
296 for (; i < end; ++i) {
297 const EnvPoint &point = orig[i];
298 const double when = point.GetT() + (orig.mOffset - mOffset);
299 AddPointAtEnd(when, point.GetVal());
300 }
301
302 // Create the final point if it needs interpolated representation
303 // If the last point of e was exactly at t1, this effectively copies it too.
304 if (mTrackLen > 0 && i < len)
305 AddPointAtEnd( mTrackLen, orig.GetValue(mOffset + mTrackLen));
306}
307
308#if 0
309/// Limit() limits a double value to a range.

Callers

nothing calls this directly

Calls 4

GetTMethod · 0.80
GetValMethod · 0.80
sizeMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected