|
uMIDI
The swiss army knife for quick and easy developement of MIDI applications.
|
API for a small collection of mathematical functions. More...


Go to the source code of this file.
Data Structures | |
| struct | linear_range |
| Configuration for a linear scaling function. More... | |
Macros | |
| #define | FIXED_POINT 16 |
| Width of the fractional part of fixed point numbers. More... | |
Typedefs | |
| typedef uint32_t | fixed_t |
| Datatype for fixed point numbers. More... | |
| typedef uint64_t | fixed_accu_t |
| Datatype for accumulators in fixed point number arithmetic functions. More... | |
Functions | |
| void | init_linear_from_midi (struct linear_range *config) |
| Initializes a linear function to map from MIDI values to an arbitrary integer range. More... | |
| void | init_linear_to_midi (struct linear_range *config) |
| Initializes a linear function to map from an arbitrary integer range to MIDI values. More... | |
| uint16_t | linear_from_midi (const struct linear_range *config, midi_value_t midi_value) |
| Yields an integer in the configured range that corresponds to the given MIDI value. More... | |
| midi_value_t | linear_to_midi (const struct linear_range *config, uint16_t input) |
| Yields the MIDI value [0,127] from a given integer in the configured range. More... | |
| static fixed_t | fixed_from_int (const uint16_t value) |
| Converts an integer to a fixed point number. More... | |
| static fixed_t | fixed_div (const fixed_t a, const fixed_t b) |
| Performs a division of two fixed point numbers. More... | |
| static fixed_t | fixed_mpy (const fixed_t a, const fixed_t b) |
| Multiplies two fixed point numbers. More... | |
| static uint16_t | fixed_to_int (fixed_t value) |
| Converts fixed point number to an integer. More... | |
API for a small collection of mathematical functions.
| #define FIXED_POINT 16 |
Width of the fractional part of fixed point numbers.
| typedef uint64_t fixed_accu_t |
Datatype for accumulators in fixed point number arithmetic functions.
| typedef uint32_t fixed_t |
Datatype for fixed point numbers.
Performs a division of two fixed point numbers.
Note: You do not have to use this function when you want to divide a fixed point number by a "normal" integer, because the division done in this function cancels out the multiplication in fixed_from_int().
| a | the dividend |
| b | the divisor |
|
inlinestatic |
Converts an integer to a fixed point number.
| value | the integer value to convert |
Multiplies two fixed point numbers.
Note: You do not have to use this function when one of the two operands you want to multiply is a "normal" integer, because the division done in this function and the multiplication in fixed_from_int() cancel out.
| a | the first operand |
| b | the second operand |
|
inlinestatic |
Converts fixed point number to an integer.
| value | the fixed point number to convert |
| void init_linear_from_midi | ( | struct linear_range * | config | ) |
Initializes a linear function to map from MIDI values to an arbitrary integer range.
| config | the configuration of the linear function to initialize |
| void init_linear_to_midi | ( | struct linear_range * | config | ) |
Initializes a linear function to map from an arbitrary integer range to MIDI values.
| config | the configuration of the linear function to initialize |
| uint16_t linear_from_midi | ( | const struct linear_range * | config, |
| midi_value_t | midi_value | ||
| ) |
Yields an integer in the configured range that corresponds to the given MIDI value.
| config | the configuration of the linear function |
| midi_value | the MIDI value to convert [0,127] |
| midi_value_t linear_to_midi | ( | const struct linear_range * | config, |
| uint16_t | input | ||
| ) |
Yields the MIDI value [0,127] from a given integer in the configured range.
| config | the configuration of the linear function |
| input | the integer to convert to a MIDI value |
1.8.13