OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::one_pole_filter< T > Struct Template Reference

First-order low-pass. The building block for everything below. More...

Detailed Description

template<typename T = float>
struct ossia::one_pole_filter< T >

First-order low-pass. The building block for everything below.

The coefficient is passed per-sample instead of being stored, so that the same filter can be driven by a varying dt or a varying cutoff without recomputing any internal state.

Public Types

using value_type = T
 

Public Member Functions

OSSIA_INLINE void reset () noexcept
 Forget the history: the next sample restarts the filter.
 
OSSIA_INLINE void reset (T x) noexcept
 Restart the filter as if x had just been output.
 
OSSIA_INLINE void assign_parameters (const one_pole_filter &) noexcept
 No runtime parameters: the coefficient is passed per-sample.
 
OSSIA_INLINE T operator() (T x, T alpha) noexcept
 

Public Attributes

y {}
 Last output. Only meaningful once primed.
 
bool primed {}
 

Member Function Documentation

◆ operator()()

template<typename T = float>
OSSIA_INLINE T ossia::one_pole_filter< T >::operator() ( x,
alpha 
)
inlinenoexcept
Parameters
xInput sample.
alphaSmoothing factor in [0, 1], e.g. from lowpass_alpha().

Member Data Documentation

◆ primed

template<typename T = float>
bool ossia::one_pole_filter< T >::primed {}

False until the first sample went through: the first sample is passed along untouched rather than being smoothed from an arbitrary zero.