Define private Envelope evaluator functions taking relative time...

... To be very sure we can avoid roundoff errors from adding mOffset and
subtracting it again; so that evaluation exactly at a control point time gives
the exact value of that point.
This commit is contained in:
Paul Licameli 2017-05-07 19:18:12 -04:00
parent 01b99f2849
commit f5a7e4ce7c
2 changed files with 16 additions and 0 deletions

View File

@ -1060,6 +1060,14 @@ double Envelope::GetValue(double t) const
return temp;
}
double Envelope::GetValueRelative(double t) const
{
double temp;
GetValuesRelative(&temp, 1, t, 1.0);
return temp;
}
// relative time
/// @param Lo returns last index at or before this time, maybe -1
/// @param Hi returns first index after this time, maybe past the end
@ -1126,7 +1134,12 @@ void Envelope::GetValues(double *buffer, int bufferLen,
{
// Convert t0 from absolute to clip-relative time
t0 -= mOffset;
GetValuesRelative( buffer, bufferLen, t0, tstep);
}
void Envelope::GetValuesRelative(double *buffer, int bufferLen,
double t0, double tstep) const
{
// JC: If bufferLen ==0 we have probably just allocated a zero sized buffer.
// wxASSERT( bufferLen > 0 );

View File

@ -145,6 +145,9 @@ public:
(double *buffer, int bufferLen, int leftOffset, const ZoomInfo &zoomInfo) const;
private:
double GetValueRelative(double t) const;
void GetValuesRelative
(double *buffer, int len, double t0, double tstep) const;
// relative time
int NumberOfPointsAfter(double t) const;
// relative time