|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Math utils. More...
Functions | |
| template<std::floating_point T> | |
| constexpr bool | floats_near (T a, T b, T e) |
| Returns whether 2 floating point numbers are equal. | |
| template<std::floating_point T> | |
| constexpr bool | floats_equal (T a, T b) |
| Checks if 2 floating point numbers are equal. | |
| template<std::floating_point T> | |
| constexpr long | round_to_signed_32 (T x) |
| Rounds a double to a (minimum) signed 32-bit integer. | |
| template<std::floating_point T> | |
| constexpr long long | round_to_signed_64 (T x) |
| Rounds a double to a (minimum) signed 64-bit integer. | |
| constexpr float | fast_log2 (float val) |
| Fast log calculation to be used where precision is not required (like log curves). | |
| constexpr auto | fast_log (const float val) |
| constexpr auto | fast_log10 (const float val) |
| float | calculate_rms_amp (const float *buf, nframes_t nframes) |
| Gets the RMS of the given signal as amplitude (0-2). | |
| bool | assert_nonnann (float x) |
| Asserts that the value is non-nan. | |
| bool | is_string_valid_float (const std::string &str, float *ret) |
| Returns whether the given string is a valid float. | |
Variables | |
| constexpr unsigned | RMS_FRAMES = 1 |
| Frames to skip when calculating the RMS. | |
| constexpr float | ALMOST_SILENCE = 0.0000001f |
| Tiny number to be used for denormaml prevention (-140dB). | |
| constexpr auto | MINUS_INFINITY = -HUGE_VAL |
Math utils.
For more, look at libs/pbd/pbd/control_math.h in ardour.
| bool zrythm::utils::math::assert_nonnann | ( | float | x | ) |
Asserts that the value is non-nan.
Not real-time safe.
|
constexpr |
Definition at line 146 of file math_utils.h.
|
constexpr |
Definition at line 153 of file math_utils.h.
|
constexpr |
Fast log calculation to be used where precision is not required (like log curves).
Taken from ardour from code in the public domain.
Definition at line 122 of file math_utils.h.
|
constexpr |
Checks if 2 floating point numbers are equal.
Definition at line 75 of file math_utils.h.
|
constexpr |
Returns whether 2 floating point numbers are equal.
| e | The allowed difference (epsilon). |
Definition at line 65 of file math_utils.h.
| bool zrythm::utils::math::is_string_valid_float | ( | const std::string & | str, |
| float * | ret ) |
Returns whether the given string is a valid float.
| ret | If non-nullptr, the result will be placed here. |
|
constexpr |
Rounds a double to a (minimum) signed 32-bit integer.
Definition at line 85 of file math_utils.h.
|
constexpr |
Rounds a double to a (minimum) signed 64-bit integer.
Definition at line 102 of file math_utils.h.
|
constexpr |
Tiny number to be used for denormaml prevention (-140dB).
Definition at line 54 of file math_utils.h.
|
constexpr |
Definition at line 56 of file math_utils.h.
|
constexpr |
Frames to skip when calculating the RMS.
The lower the more CPU intensive.
Definition at line 50 of file math_utils.h.