class
LookupTable
Contains a set of samples resulting from sampling some function at equal intervals.
The table can then be used for sampling that function at arbitrary time intervals. The sampling is fast but precision is limited to the number of samples.
Public
Constructors
LookupTable
LookupTable(Vector<float> values, float startTime = 0.F, float endTime = 1.F, uint32_t sampleSize = 1)
Constructs a lookup table from the provided set of values.
- values
- Buffer containing information about all the samples. Total buffer size must be divisble by .
- startTime
- Time at which the first provided sample has been evaluated at.
- endTime
- Time at which the last provided sample has been evaluate at. All samples in-between first and last are assumed to be evaluated to equal intervals in the [startTime, endTime] range.
- sampleSize
- Number of 'float's each sample requires. This number must divide the number of elements in the buffer.
Methods
Evaluate
void Evaluate(float t, const float *&outLeft, const float *&outRight, float &outFraction) const
Evaluates the lookup table at the specified time.
- t
- Time to evaluate the lookup table at.
- outLeft
- Pointer to the set of values contained in the sample left to the time value.
- outRight
- Pointer to the set of values contained in the sample right to the time value.
- outFraction
- Fraction that determines how to interpolate between and values, where 0 corresponds to the value, 1 to the value and values in-between interpolate linearly between the two.
GetSample
const float *GetSample(uint32_t index) const
Returns a sample at the specified index.
Returns last available sample if index is out of range.
Private
Fields
mValues
Vector<float> mValues
mSampleSize
uint32_t mSampleSize
mSampleCount
uint32_t mSampleCount
mTimeStart
float mTimeStart
mTimeScale
float mTimeScale