arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Modules Pages
Public Member Functions | Protected Attributes | List of all members
LinearInterpolator Struct Reference

Linear interpolation between y[0] and y[1]. More...

#include <ResampleStreamT.h>

Inheritance diagram for LinearInterpolator:
BaseInterpolator

Public Member Functions

void addValue (float value)
 Adds a new value to the buffer, discarding the oldest.
 
bool begin ()
 Constructor. Initializes the buffer with four zeros.
 
bool getValue (float &newValue)
 Gets the next interpolated value.
 
 operator bool () const
 Returns true if there are more values to read.
 
void setStepSize (float step)
 Sets the step size for interpolation.
 
float value (float *y, float xf)
 Computes the linear interpolation.
 
float valueExt (float *y, float xf)
 
int vectorSize ()
 Minimum number of values required for interpolation.
 

Protected Attributes

float step = 0
 
float step_size = 1.0f
 Step size for resampling, default is 1.0.
 
SingleBuffer< float > values
 Buffer holding the last 4 values for interpolation.
 

Detailed Description

Linear interpolation between y[0] and y[1].

Valid for xf in [0,1].

Member Function Documentation

◆ addValue()

void addValue ( float  value)
inlineinherited

Adds a new value to the buffer, discarding the oldest.

Parameters
valueThe new sample value to add.

◆ getValue()

bool getValue ( float &  newValue)
inlineinherited

Gets the next interpolated value.

Parameters
newValueReference to store the interpolated value.
Returns
True if a value was produced, false if more input is needed.

◆ setStepSize()

void setStepSize ( float  step)
inlineinherited

Sets the step size for interpolation.

Parameters
stepThe new step size.

◆ value()

float value ( float *  y,
float  xf 
)
inlinevirtual

Computes the linear interpolation.

Parameters
yPointer to at least 2 values.
xfThe fractional index for interpolation.
Returns
Interpolated value.

Implements BaseInterpolator.

◆ vectorSize()

int vectorSize ( )
inlinevirtual

Minimum number of values required for interpolation.

Implements BaseInterpolator.


The documentation for this struct was generated from the following file: