file
dsp.hOptimized DSP functions.
Contents
- Reference
Functions
- auto dsp_fill(float* buf, float val, size_t size) -> HOT NONNULL void
- Fill the buffer with the given value.
- static auto dsp_limit1(float* buf, float minf, float maxf, size_t size) -> NONNULL static HOT void
- Clamp the buffer to min/max.
- auto dsp_mul_k2(float* dest, float k, size_t size) -> NONNULL HOT void
- Scale: dst[i] = dst[i] * k.
- static auto dsp_abs_max(float* buf, size_t size) -> NONNULL static WARN_UNUSED_RESULT float
- Gets the maximum absolute value of the buffer (as amplitude).
- static auto dsp_abs_max_with_existing_peak(float* buf, float* cur_peak, size_t size) -> HOT static NONNULL bool
- Gets the absolute max of the buffer.
- auto dsp_min(float* buf, size_t size) -> NONNULL float
- Gets the minimum of the buffer.
- auto dsp_max(float* buf, size_t size) -> NONNULL float
- Gets the maximum of the buffer.
- auto dsp_add2(float* dest, const float* src, size_t count) -> NONNULL HOT void
- Calculate dst[i] = dst[i] + src[i].
- static auto dsp_mix2(float* dest, const float* src, float k1, float k2, size_t size) -> NONNULL static HOT void
- Calculate dest[i] = dest[i] * k1 + src[i] * k2.
- auto dsp_mix_add2(float* dest, const float* src1, const float* src2, float k1, float k2, size_t size) -> NONNULL void
- Calculate dst[i] = dst[i] + src1[i] * k1 + src2[i] * k2.
- auto dsp_linear_fade_in_from(float* dest, int32_t start_offset, int32_t total_frames_to_fade, size_t size, float fade_from_multiplier) -> NONNULL void
- Calculate linear fade by multiplying from 0 to 1 for.
- auto dsp_linear_fade_out_to(float* dest, int32_t start_offset, int32_t total_frames_to_fade, size_t size, float fade_to_multiplier) -> NONNULL void
- Calculate linear fade by multiplying from 0 to 1 for.
- auto dsp_make_mono(float* l, float* r, size_t size, bool equal_power) -> NONNULL void
- Makes the two signals mono.
Function documentation
static HOT static NONNULL bool dsp_abs_max_with_existing_peak(float* buf, float* cur_peak, size_t size)
Gets the absolute max of the buffer.
Returns | Whether the peak changed. |
---|
NONNULL void dsp_linear_fade_in_from(float* dest, int32_t start_offset, int32_t total_frames_to_fade, size_t size, float fade_from_multiplier)
Calculate linear fade by multiplying from 0 to 1 for.
Parameters | |
---|---|
dest | |
start_offset | Start offset in the fade interval. |
total_frames_to_fade | Total frames that should be faded. |
size | Number of frames to process. |
fade_from_multiplier | Multiplier to fade from (0 to fade from silence.) |
NONNULL void dsp_linear_fade_out_to(float* dest, int32_t start_offset, int32_t total_frames_to_fade, size_t size, float fade_to_multiplier)
Calculate linear fade by multiplying from 0 to 1 for.
Parameters | |
---|---|
dest | |
start_offset | Start offset in the fade interval. |
total_frames_to_fade | Total frames that should be faded. |
size | Number of frames to process. |
fade_to_multiplier | Multiplier to fade to (0 to fade to silence.) |
NONNULL void dsp_make_mono(float* l, float* r, size_t size, bool equal_power)
Makes the two signals mono.
Parameters | |
---|---|
l | |
r | |
size | |
equal_power | True for equal power, false for equal amplitude. |