From 5316032fee3794b16e64ecc287eebfee3c6d8c80 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 9 Jun 2015 11:42:38 -0400 Subject: [PATCH] An overload of Envelope::GetValues for nonuniform time steps, taking ZoomInfo --- src/Envelope.cpp | 7 +++++++ src/Envelope.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/src/Envelope.cpp b/src/Envelope.cpp index b570f1cba..1a13e8e4a 100644 --- a/src/Envelope.cpp +++ b/src/Envelope.cpp @@ -1180,6 +1180,13 @@ void Envelope::GetValues(double *buffer, int bufferLen, } } +void Envelope::GetValues + (double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) const +{ + for (int xx = 0; xx < bufferLen; ++xx) + buffer[xx] = GetValue(zoomInfo.PositionToTime(xx, -leftOffset)); +} + int Envelope::NumberOfPointsAfter(double t) { if( t >= mEnv[mEnv.Count()-1]->GetT() ) diff --git a/src/Envelope.h b/src/Envelope.h index f1fdb102f..3d49197e0 100644 --- a/src/Envelope.h +++ b/src/Envelope.h @@ -160,6 +160,11 @@ class Envelope : public XMLTagHandler { * more than one value in a row. */ void GetValues(double *buffer, int len, double t0, double tstep) const; + /** \brief Get many envelope points at once, but don't assume uniform time step. + */ + void GetValues + (double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) const; + int NumberOfPointsAfter(double t); double NextPointAfter(double t);