Mozzi  version v1.1.0
sound synthesis library for Arduino
AutoMap Class Reference

Automatically map an input value to an output range without knowing the precise range of inputs beforehand. More...

#include <AutoMap.h>

+ Inheritance diagram for AutoMap:

Public Member Functions

 AutoMap (int min_expected, int max_expected, int map_to_min, int map_to_max)
 Constructor. More...
 
int next (int n)
 Process the next value and return it mapped to the range which was set in the constructor. More...
 
int operator() (int n)
 Process the next value and return it mapped to the range which was set in the constructor. More...
 
int getMin ()
 Returns the current minimum. More...
 
int getMax ()
 Returns the current maximum. More...
 
int getRange ()
 Returns the current range. More...
 

Detailed Description

Automatically map an input value to an output range without knowing the precise range of inputs beforehand.

Definition at line 28 of file AutoMap.h.

Constructor & Destructor Documentation

◆ AutoMap()

AutoMap::AutoMap ( int  min_expected,
int  max_expected,
int  map_to_min,
int  map_to_max 
)
inline

Constructor.

Parameters
min_expectedthe minimum possible input value.
max_expectedthe maximum possible input value.

Definition at line 35 of file AutoMap.h.

Member Function Documentation

◆ getMax()

int AutoRange< int >::getMax ( )
inlineinherited

Returns the current maximum.

Returns
maximum

Definition at line 64 of file AutoRange.h.

◆ getMin()

int AutoRange< int >::getMin ( )
inlineinherited

Returns the current minimum.

Returns
minimum

Definition at line 55 of file AutoRange.h.

◆ getRange()

int AutoRange< int >::getRange ( )
inlineinherited

Returns the current range.

Returns
range

Definition at line 73 of file AutoRange.h.

◆ next()

int AutoMap::next ( int  n)
inline

Process the next value and return it mapped to the range which was set in the constructor.

Can use the operator instead if you prefer, eg. myMap(n) instead of myMap.next(n).

Parameters
nthe next value to process.
Returns
the input value mapped to the range which was set in the constructor.

Definition at line 47 of file AutoMap.h.

◆ operator()()

int AutoMap::operator() ( int  n)
inline

Process the next value and return it mapped to the range which was set in the constructor.

This is an alternative to next() if you prefer, eg. myMap(n) instead of myMap.next(n).

Parameters
nthe next value to process.
Returns
the input value mapped to the range which was set in the constructor.

Definition at line 59 of file AutoMap.h.