ape  0.5.0
Audio Programming Environment
Public Types | Public Member Functions | Friends | List of all members
ape::Range Class Reference

Represents a mapping function in a interval, suitable for evaluation between 0 .. 1 inclusive, and inversely evaluatable given original interval. Useful for transforming normalized ranges back and forth between a semantic mapping. More...

#include <parameter.h>

Public Types

enum  Mapping { Lin, Exp }
 Different curve mappings for the interval More...
 

Public Member Functions

 Range ()
 Construct a default linear range from 0 to 1 More...
 
 Range (PFloat minValue, PFloat maxValue, Mapping parameterMapping=Lin)
 Constructs a range from minValue to maxValue with parameterMapping mapping. More...
 
PFloat operator() (PFloat value) const noexcept
 Evaluate the range as a f(x) function, where value is x

See also
inverse()
More...
 
PFloat inverse (bool quantized, PFloat value) const noexcept
 Normalizes value back to a 0 .. 1 range.

See also
operator()()
More...
 
APE_Transformer getTransformer (bool quantized) const noexcept
 Retrieve a function pointer with appropriate Mapping and selectively quantized . More...
 
APE_Normalizer getNormalizer (bool quantized) const noexcept
 Retrieve a function pointer with appropriate Mapping and selectively quantized , for inverse transformation More...
 
auto getMapping () const noexcept
 Returns the Mapping this range was constructed with More...
 
auto getMin () const noexcept
 return the minimum of the constructed range More...
 
auto getMax () const noexcept
 Returns the maximum of the constructed range More...
 

Friends

template<class Type , typename Select >
class Param
 

Detailed Description

Represents a mapping function in a interval, suitable for evaluation between 0 .. 1 inclusive, and inversely evaluatable given original interval. Useful for transforming normalized ranges back and forth between a semantic mapping.

Member Enumeration Documentation

◆ Mapping

Different curve mappings for the interval

Enumerator
Lin 

Maps linearly from min to max

Exp 

Maps exponentially from min to max.

Min and max cannot be zero in this case

Constructor & Destructor Documentation

◆ Range() [1/2]

ape::Range::Range ( )
inline

Construct a default linear range from 0 to 1

◆ Range() [2/2]

ape::Range::Range ( PFloat  minValue,
PFloat  maxValue,
Mapping  parameterMapping = Lin 
)
inline

Constructs a range from minValue to maxValue with parameterMapping mapping.

Member Function Documentation

◆ getMapping()

auto ape::Range::getMapping ( ) const
inlinenoexcept

Returns the Mapping this range was constructed with

◆ getMax()

auto ape::Range::getMax ( ) const
inlinenoexcept

Returns the maximum of the constructed range

◆ getMin()

auto ape::Range::getMin ( ) const
inlinenoexcept

return the minimum of the constructed range

◆ getNormalizer()

APE_Normalizer ape::Range::getNormalizer ( bool  quantized) const
inlinenoexcept

Retrieve a function pointer with appropriate Mapping and selectively quantized , for inverse transformation

Returns
A function pointer. Invoking this with getMin() and getMax() is equivalent to invoking inverse().

◆ getTransformer()

APE_Transformer ape::Range::getTransformer ( bool  quantized) const
inlinenoexcept

Retrieve a function pointer with appropriate Mapping and selectively quantized .

Returns
A function pointer. Invoking this with getMin() and getMax() is equivalent to invoking operator()().

◆ inverse()

PFloat ape::Range::inverse ( bool  quantized,
PFloat  value 
) const
inlinenoexcept

Normalizes value back to a 0 .. 1 range.

See also
operator()()

Parameters
quantizedOptionally rounds value before inverse transformation

◆ operator()()

PFloat ape::Range::operator() ( PFloat  value) const
inlinenoexcept

Evaluate the range as a f(x) function, where value is x

See also
inverse()

Friends And Related Function Documentation

◆ Param

template<class Type , typename Select >
friend class Param
friend

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