|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Optimized DSP functions. More...
#include <cstdint>#include <span>
Go to the source code of this file.
Namespaces | |
| namespace | zrythm::utils |
| String utilities. | |
Functions | |
| void | zrythm::utils::float_ranges::fill (std::span< float > buf, float val) |
| Fill the buffer with the given value. | |
| void | zrythm::utils::float_ranges::clip (std::span< float > buf, float minf, float maxf) |
| Clamp the buffer to min/max. | |
| void | zrythm::utils::float_ranges::copy (std::span< float > dest, std::span< const float > src) |
| Compute dest[i] = src[i]. | |
| void | zrythm::utils::float_ranges::mul_k2 (std::span< float > dest, float k) |
| Scale: dst[i] = dst[i] * k. | |
| float | zrythm::utils::float_ranges::abs_max (std::span< const float > buf) |
| Gets the maximum absolute value of the buffer (as amplitude). | |
| float | zrythm::utils::float_ranges::min (std::span< const float > buf) |
| Gets the minimum of the buffer. | |
| float | zrythm::utils::float_ranges::max (std::span< const float > buf) |
| Gets the maximum of the buffer. | |
| void | zrythm::utils::float_ranges::add2 (std::span< float > dest, std::span< const float > src) |
| Calculate dst[i] = dst[i] + src[i]. | |
| void | zrythm::utils::float_ranges::product (std::span< float > dest, std::span< const float > src, float k) |
| Calculate dest[i] = src[i] * k. | |
| void | zrythm::utils::float_ranges::mix_product (std::span< float > dest, std::span< const float > src, float k) |
| Calculate dest[i] = dest[i] + src[i] * k. | |
| void | zrythm::utils::float_ranges::reverse (std::span< float > dest, std::span< const float > src) |
| Reverse the order of samples: dst[i] <=> src[count - i - 1]. | |
| void | zrythm::utils::float_ranges::normalize (std::span< float > dest, std::span< const float > src) |
| Calculate normalized values: dst[i] = src[i] / (max { abs(src) }). | |
| void | zrythm::utils::float_ranges::linear_fade_in_from (std::span< float > dest, int32_t start_offset, int32_t total_frames_to_fade, float fade_from_multiplier) |
| Calculate linear fade by multiplying from 0 to 1 for total_frames_to_fade samples. | |
| void | zrythm::utils::float_ranges::linear_fade_out_to (std::span< float > dest, int32_t start_offset, int32_t total_frames_to_fade, float fade_to_multiplier) |
| Calculate linear fade by multiplying from 1 to 0 for total_frames_to_fade samples. | |
| void | zrythm::utils::float_ranges::make_mono (std::span< float > l, std::span< float > r, bool equal_power) |
| Makes the two signals mono. | |
Optimized DSP functions.
Definition in file float_ranges.h.
| void zrythm::utils::float_ranges::linear_fade_in_from | ( | std::span< float > | dest, |
| int32_t | start_offset, | ||
| int32_t | total_frames_to_fade, | ||
| float | fade_from_multiplier ) |
Calculate linear fade by multiplying from 0 to 1 for total_frames_to_fade samples.
| dest | Span of frames to process (size is the number of frames). |
| start_offset | Start offset in the fade interval. |
| total_frames_to_fade | Total frames that should be faded. |
| fade_from_multiplier | Multiplier to fade from (0 to fade from silence.) |
| void zrythm::utils::float_ranges::linear_fade_out_to | ( | std::span< float > | dest, |
| int32_t | start_offset, | ||
| int32_t | total_frames_to_fade, | ||
| float | fade_to_multiplier ) |
Calculate linear fade by multiplying from 1 to 0 for total_frames_to_fade samples.
| dest | Span of frames to process (size is the number of frames). |
| start_offset | Start offset in the fade interval. |
| total_frames_to_fade | Total frames that should be faded. |
| fade_to_multiplier | Multiplier to fade to (0 to fade to silence.) |
| void zrythm::utils::float_ranges::make_mono | ( | std::span< float > | l, |
| std::span< float > | r, | ||
| bool | equal_power ) |
Makes the two signals mono.
| equal_power | True for equal power, false for equal amplitude. |