arduino-audio-tools
Loading...
Searching...
No Matches
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< floatvalues
 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.

◆ begin()

bool begin ( )
inlineinherited

Constructor. Initializes the buffer with four zeros.

◆ 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.

◆ operator bool()

operator bool ( ) const
inlineinherited

Returns true if there are more values to read.

◆ 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.

◆ valueExt()

float valueExt ( float y,
float  xf 
)
inlineinherited

◆ vectorSize()

int vectorSize ( )
inlinevirtual

Minimum number of values required for interpolation.

Implements BaseInterpolator.

Member Data Documentation

◆ step

float step = 0
protectedinherited

◆ step_size

float step_size = 1.0f
protectedinherited

Step size for resampling, default is 1.0.

◆ values

SingleBuffer<float> values
protectedinherited

Buffer holding the last 4 values for interpolation.


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