OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
ossia::multi_filter< Filter, N > Struct Template Reference

Applies one independent Filter per component of a vector-valued signal. More...

Detailed Description

template<typename Filter, std::size_t N = 4>
struct ossia::multi_filter< Filter, N >

Applies one independent Filter per component of a vector-valued signal.

The filters are owned per-component so that, for instance, the x of a tracked point never bleeds into its y - and, when used per tracked object, so that one object's history never bleeds into another's.

Template Parameters
NHow many components fit without allocating.

Public Types

using filter_type = Filter
 
using value_type = typename Filter::value_type
 

Public Member Functions

OSSIA_INLINE void ensure (std::size_t n)
 Make sure there are exactly n components.
 
OSSIA_INLINE void configure () noexcept
 Push the prototype's tuning onto the live filters, keeping their history.
 
void reset () noexcept
 Forget every component's history, keeping the component count.
 
void clear () noexcept
 Drop every component.
 
template<typename... Args>
OSSIA_INLINE void operator() (value_type *v, std::size_t n, Args... args) noexcept
 Filter n components in place.
 

Public Attributes

Filter prototype {}
 
ossia::small_vector< Filter, N > filters {}
 One filter per component.
 

Member Function Documentation

◆ ensure()

template<typename Filter , std::size_t N = 4>
OSSIA_INLINE void ossia::multi_filter< Filter, N >::ensure ( std::size_t  n)
inline

Make sure there are exactly n components.

A change of component count resets the temporal state: there is no meaningful way to map an old component onto a new one.

◆ operator()()

template<typename Filter , std::size_t N = 4>
template<typename... Args>
OSSIA_INLINE void ossia::multi_filter< Filter, N >::operator() ( value_type *  v,
std::size_t  n,
Args...  args 
)
inlinenoexcept

Filter n components in place.

Parameters
vComponents, modified in place.
nHow many.
argsForwarded to each filter, e.g. the dt of a one_euro_filter.

Member Data Documentation

◆ prototype

template<typename Filter , std::size_t N = 4>
Filter ossia::multi_filter< Filter, N >::prototype {}

Copied into every new component. Set the parameters here, then call configure() to push them onto the components already in flight.