Mozzi  version 2015-05-11-20:23
sound synthesis library for Arduino
 All Classes Functions Typedefs Groups
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.

Examples:
03.Sensors/Knob_LDR_x2_WavePacket/Knob_LDR_x2_WavePacket.ino.

Definition at line 28 of file AutoMap.h.

Constructor & Destructor Documentation

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

int AutoRange< int >::getMax ( )
inlineinherited

Returns the current maximum.

Returns
maximum

Definition at line 57 of file AutoRange.h.

int AutoRange< int >::getMin ( )
inlineinherited

Returns the current minimum.

Returns
minimum

Definition at line 49 of file AutoRange.h.

int AutoRange< int >::getRange ( )
inlineinherited

Returns the current range.

Returns
range

Definition at line 65 of file AutoRange.h.

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.

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 58 of file AutoMap.h.