This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
Modules | Classes | Functions
Utilities

All kinds of utility and helper classes that are used throughout the library, such as containers and filters. More...

Collaboration diagram for Utilities:

Modules

 Containers
 Containers like Array, BitArray and DoublyLinkedList.
 

Classes

class  EMA< K, uint_t >
 A class for single-pole infinite impulse response filters or exponential moving average filters. More...
 
class  EMA_f
 A class for single-pole infinite impulse response filters or exponential moving average filters. More...
 
class  Hysteresis< BITS, T_in, T_out >
 A class for applying hysteresis to a given input. More...
 
class  Timer< time >
 A class for easily managing timed events. More...
 
class  unique_ptr< T >
 Very basic smart pointer. More...
 

Functions

template<size_t Bits_out, size_t Bits_in, class T_out , class T_in >
T_out increaseBitDepth (T_in in)
 Increase the bit depth of the given value from Bits_in bits wide to Bits_out bits wide, evenly distributing the error across the entire range, such that the error for each element is between -0.5 and +0.5. More...
 
template<typename T , typename... Args>
unique_ptr< T > make_unique (Args &&... args)
 

Detailed Description

All kinds of utility and helper classes that are used throughout the library, such as containers and filters.

Function Documentation

◆ increaseBitDepth()

template<size_t Bits_out, size_t Bits_in, class T_out , class T_in >
T_out increaseBitDepth ( T_in  in)

Increase the bit depth of the given value from Bits_in bits wide to Bits_out bits wide, evenly distributing the error across the entire range, such that the error for each element is between -0.5 and +0.5.

For example, converting 3-bit numbers to 7-bit numbers would result in the following:

in (dec) in (bin) out (bin) out (dec) exact error
0 000 000'0000 0 0.00 +0.00
1 001 001'0010 18 18.14 +0.14
2 010 010'0100 36 36.29 +0.29
3 011 011'0110 54 54.43 +0.43
4 100 100'1001 73 72.57 -0.43
5 101 101'1011 91 90.71 -0.29
6 110 110'1101 109 108.86 -0.14
7 111 111'1111 127 127.00 +0.00
Template Parameters
Bits_outThe number of bits of the output range.
Bits_inThe number of bits of the input range.
T_outThe type of the output (return type).
T_inThe type of the input.
Parameters
inThe value to scale up.
Returns
The scaled up value.

Definition at line 60 of file IncreaseBitDepth.hpp.

◆ make_unique()

template<typename T , typename... Args>
unique_ptr<T> make_unique ( Args &&...  args)

Definition at line 105 of file unique_ptr.hpp.