| 284 | } |
| 285 | |
| 286 | void 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. |