NAP
Public Types | Public Member Functions | Static Public Member Functions | List of all members
TableTranslator< T > Class Template Reference

#include <audio/utility/translator.h>

Public Types

using FillFunction = std::function< T(T)>
 

Public Member Functions

 TableTranslator (unsigned int size)
 
translate (const T &inputValue) override final
 
void fill (FillFunction fillFunction)
 
- Public Member Functions inherited from Translator< T >
virtual ~Translator ()
 

Static Public Member Functions

static T translate (const T &inputValue, const std::vector< T > &inTable)
 

Description

template<typename T>
class nap::audio::TableTranslator< T >

Translates one value to another using a vector of values as a lookup table, the input has to be between 0 and 1.

Inheritance diagram for TableTranslator< T >:
[legend]
Collaboration diagram for TableTranslator< T >:
[legend]

Member Typedef Documentation

◆ FillFunction

using FillFunction = std::function<T(T)>

a FillFunction takes a fractional index in range 0..1 as argument and returns the value of the curve at this index

Constructor & Destructor Documentation

◆ TableTranslator()

TableTranslator ( unsigned int  size)

default constructor

Member Function Documentation

◆ fill()

void fill ( FillFunction  fillFunction)

fills the table with the result of a fill function with input values spaced between 0 and 1.

◆ translate() [1/2]

T translate ( const T &  inputValue)
finaloverridevirtual

perform the translation, input is clipped between 0 and 1. and spread across the size of the table, interpolating between the values

Implements Translator< T >.

◆ translate() [2/2]

static T translate ( const T &  inputValue,
const std::vector< T > &  inTable 
)
static

perform the translation static, input is clipped between 0 and 1. and spread across the size of the table, interpolatinf between the values