Gin
Loading...
Searching...
No Matches
Functions
math Namespace Reference

SIMD-accelerated math utilities for audio DSP. More...

Functions

float pow2 (float v)
 Computes the square of a value (v²).
 
float pow4 (float v)
 Computes the fourth power of a value (v⁴).
 
float pow8 (float v)
 Computes the eighth power of a value (v⁸).
 
float lerp (float a, float b, float t)
 Linear interpolation between two values.
 
float min (float a, float b)
 Returns the minimum of two values.
 
float max (float a, float b)
 Returns the maximum of two values.
 
float minVal (float a)
 Returns the minimum value (scalar version just returns the input).
 
float maxVal (float a)
 Returns the maximum value (scalar version just returns the input).
 

Detailed Description

SIMD-accelerated math utilities for audio DSP.

The math namespace provides optimized mathematical functions with both scalar (single float) and SIMD (vectorized) implementations. When SIMD is available (GIN_HAS_SIMD), the same function names work with both float and mipp::Reg<float> types, automatically selecting the appropriate implementation.

Available Functions:

All functions are inlined for maximum performance. SIMD versions process 4 floats simultaneously on SSE/AVX systems.

See also
mipp::Reg

Function Documentation

◆ pow2()

float math::pow2 ( float  v)

Computes the square of a value (v²).

Parameters
vInput value
Returns
v * v

Referenced by WTOscillator::postProcess().

◆ pow4()

float math::pow4 ( float  v)

Computes the fourth power of a value (v⁴).

Parameters
vInput value
Returns
v * v * v * v

Referenced by WTOscillator::postProcess().

◆ pow8()

float math::pow8 ( float  v)

Computes the eighth power of a value (v⁸).

Parameters
vInput value
Returns
v⁸

◆ lerp()

float math::lerp ( float  a,
float  b,
float  t 
)

Linear interpolation between two values.

Parameters
aStart value (when t=0)
bEnd value (when t=1)
tInterpolation factor (typically 0.0 to 1.0)
Returns
Interpolated value: a + t * (b - a)

Referenced by WTOscillator::postProcess().

◆ min()

float math::min ( float  a,
float  b 
)

Returns the minimum of two values.

Parameters
aFirst value
bSecond value
Returns
The smaller of a and b

Referenced by WTOscillator::postProcess(), WTOscillator::processAddingComplex(), WTOscillator::processAddingCrossfadeComplex(), and WTOscillator::processAddingSimple().

◆ max()

float math::max ( float  a,
float  b 
)

Returns the maximum of two values.

Parameters
aFirst value
bSecond value
Returns
The larger of a and b

Referenced by WTOscillator::postProcess().

◆ minVal()

float math::minVal ( float  a)

Returns the minimum value (scalar version just returns the input).

Parameters
aInput value
Returns
a

◆ maxVal()

float math::maxVal ( float  a)

Returns the maximum value (scalar version just returns the input).

Parameters
aInput value
Returns
a