21#define PI_F 3.1415927410125732421875f
22#define TWOPI_F (2.0f * PI_F)
23#define HALFPI_F (PI_F * 0.5f)
24#define DSY_MIN(in, mn) (in < mn ? in : mn)
25#define DSY_MAX(in, mx) (in > mx ? in : mx)
26#define DSY_CLAMP(in, mn, mx) (DSY_MIN(DSY_MAX(in, mn), mx))
27#define DSY_COUNTOF(_arr) (sizeof(_arr) / sizeof(_arr[0]))
32static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
35static constexpr float kOneTwelfth = 1.f / 12.f;
44 asm(
"vmaxnm.f32 %[d], %[n], %[m]" : [
d]
"=t"(
r) : [
n]
"t"(
a), [
m]
"t"(
b) :);
51inline float fmin(
float a,
float b)
55 asm(
"vminnm.f32 %[d], %[n], %[m]" : [d]
"=t"(r) : [n]
"t"(a), [m]
"t"(b) :);
85inline float fastroot(
float f,
int n)
102 return x -
static_cast<int>(
x);
110 return expf(2.302585092994046f *
f);
116inline float fastlog2f(
float f)
120 frac = frexpf(fabsf(f), &exp);
121 f = 1.23149591368684f;
123 f += -4.11852516267426f;
125 f += 6.02197014179219f;
127 f += -3.13396450166353f;
132inline float fastlog10f(
float f)
134 return fastlog2f(f) * 0.3010299956639812f;
141 return powf(2, (
m - 69.0f) / 12.0f) * 440.0f;
188 case Mapping::LINEAR:
199 return (
b <
a) ? (
b <
c) ? (
c <
a) ?
c :
a :
b
200 : (
a <
c) ? (
c <
b) ?
c :
b :
a;
215 return -0.5f *
t *
t;
222 const float t1 = 0.5f *
t;
225 return 0.1875f -
t1 + 1.5f *
t2 -
t4;
238 return x * (27.f +
x *
x) / (27.f + 9.f *
x *
x);
260 if(!std::isnormal(
x) &&
x != 0)
262#if defined(__arm__) && defined(DEBUG)
319constexpr bool is_power2(uint32_t x)
321 return ((x - 1) & x) == 0;
329#if __cplusplus <= 201103L
351#include "custom_dsp.h"
Definition delayline.h:29
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
uint32_t get_next_power2(uint32_t x)
Definition dsp.h:330
float fastpower(float f, int n)
Definition dsp.h:73
Mapping
Definition dsp.h:158
float mtof(float m)
Definition dsp.h:139
float ThisBlepSample(float t)
Definition dsp.h:205
float fastmod1f(float x)
Definition dsp.h:100
float pow10f(float f)
Definition dsp.h:108
T median(T a, T b, T c)
Definition dsp.h:197
float fclamp(float in, float min, float max)
Definition dsp.h:64
float NextIntegratedBlepSample(float t)
Definition dsp.h:220
float soft_saturate(float in, float thresh)
Definition dsp.h:282
float fmax(float a, float b)
Definition dsp.h:40
float SoftLimit(float x)
Definition dsp.h:236
float NextBlepSample(float t)
Definition dsp.h:212
float fmap(float in, float min, float max, Mapping curve=Mapping::LINEAR)
Definition dsp.h:177
void TestFloat(float &x, float y=0.f)
Definition dsp.h:258
float ThisIntegratedBlepSample(float t)
Definition dsp.h:230
float SoftClip(float x)
Definition dsp.h:242
void fonepole(float &out, float in, float coeff)
Definition dsp.h:151