file
math.hMath utils.
For more, look at libs/pbd/pbd/control_math.h in ardour.
Functions
- static auto math_fast_log2(float val) -> CONST float
- Fast log calculation to be used where precision is not required (like log curves).
-
static auto math_get_fader_val_from_amp(sample_
t amp) -> CONST sample_ t - Returns fader value 0.0 to 1.0 from amp value 0.0 to 2.0 (+6 dbFS).
-
static auto math_get_amp_val_from_fader(sample_
t fader) -> CONST sample_ t - Returns amp value 0.0 to 2.0 (+6 dbFS) from fader value 0.0 to 1.0.
-
static auto math_amp_to_dbfs(sample_
t amp) -> CONST sample_ t - Convert from amplitude 0.0 to 2.0 to dbFS.
-
auto math_calculate_max_amp(sample_
t* buf, const nframes_ t nframes) -> sample_ t - Gets the digital peak of the given signal as amplitude (0-2).
-
auto math_calculate_rms_db(sample_
t* buf, const nframes_ t nframes) -> sample_ t - Calculate db using RMS method.
-
static auto math_dbfs_to_amp(sample_
t dbfs) -> CONST sample_ t - Convert form dbFS to amplitude 0.0 to 2.0.
-
static auto math_dbfs_to_fader_val(sample_
t dbfs) -> CONST sample_ t - Convert form dbFS to fader val 0.0 to 1.0.
- auto math_assert_nonnann(float x) -> bool
- Asserts that the value is non-nan.
Defines
- #define MATH_RMS_FRAMES
- Frames to skip when calculating the RMS.
- #define MATH_TINY_NUMBER
- Tiny number to be used for denormaml prevention (-140dB).
- #define math_floats_equal_epsilon(a, b, e)
- Checks if 2 doubles are equal.
- #define math_floats_equal(a, b)
- Checks if 2 doubles are equal.
- #define math_round_double_to_type(x, type)
- Rounds a double to an int.
- #define math_round_double_to_int(x)
- Rounds a double to an int.
- #define math_round_double_to_size_t(x)
- Rounds a double to a size_t.
- #define math_round_double_to_long(x)
- Rounds a double to a long.
- #define math_round_float_to_type(x, type)
- Rounds a float to a given type.
- #define math_round_float_to_int(x)
- Rounds a float to an int.
- #define math_round_float_to_long(x)
- Rounds a float to a long.