From da517ed4bc00b2cdf7e1f0c7546c7a9fa0a4e8fc Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Tue, 8 Aug 2023 10:46:05 +0200 Subject: [PATCH] using size_t and improved bw_common --- TODO | 7 +- examples/common/ios/platform.h | 5 ++ examples/common/web/platform.h | 1 + examples/common/web/web.mk | 2 +- include/bw_ap1.h | 8 +- include/bw_ap2.h | 8 +- include/bw_balance.h | 8 +- include/bw_bd_reduce.h | 8 +- include/bw_buf.h | 80 ++++++++++--------- include/bw_chorus.h | 12 ++- include/bw_clip.h | 8 +- include/bw_comb.h | 24 +++--- include/bw_common.h | 141 ++++++++++++++++++++++----------- include/bw_comp.h | 8 +- include/bw_delay.h | 46 ++++++----- include/bw_dist.h | 8 +- include/bw_drive.h | 8 +- include/bw_drywet.h | 8 +- include/bw_env_follow.h | 8 +- include/bw_env_gen.h | 8 +- include/bw_fuzz.h | 8 +- include/bw_gain.h | 8 +- include/bw_hp1.h | 8 +- include/bw_hs1.h | 8 +- include/bw_hs2.h | 8 +- include/bw_lp1.h | 8 +- include/bw_ls1.h | 8 +- include/bw_ls2.h | 8 +- include/bw_mm1.h | 8 +- include/bw_mm2.h | 8 +- include/bw_noise_gate.h | 8 +- include/bw_noise_gen.h | 8 +- include/bw_notch.h | 8 +- include/bw_one_pole.h | 100 ++++++++++++----------- include/bw_osc_filt.h | 8 +- include/bw_osc_pulse.h | 8 +- include/bw_osc_saw.h | 8 +- include/bw_osc_sin.h | 8 +- include/bw_osc_tri.h | 8 +- include/bw_pan.h | 8 +- include/bw_peak.h | 8 +- include/bw_phase_gen.h | 8 +- include/bw_phaser.h | 8 +- include/bw_pink_filt.h | 8 +- include/bw_ppm.h | 8 +- include/bw_reverb.h | 112 +++++++++++++------------- include/bw_ringmod.h | 8 +- include/bw_satur.h | 8 +- include/bw_slew_lim.h | 8 +- include/bw_sr_reduce.h | 8 +- include/bw_src.h | 8 +- include/bw_src_int.h | 8 +- include/bw_svf.h | 8 +- include/bw_trem.h | 8 +- include/bw_voice_alloc.h | 22 +++-- include/bw_wah.h | 8 +- include/bwpp_ap1.h | 16 ++-- include/bwpp_ap2.h | 18 ++--- include/bwpp_balance.h | 12 +-- include/bwpp_bd_reduce.h | 10 +-- include/bwpp_buf.h | 24 +++--- include/bwpp_chorus.h | 32 ++++---- include/bwpp_clip.h | 20 ++--- include/bwpp_comb.h | 30 +++---- include/bwpp_comp.h | 28 +++---- include/bwpp_delay.h | 40 +++++----- include/bwpp_dist.h | 20 ++--- include/bwpp_drive.h | 20 ++--- include/bwpp_drywet.h | 14 ++-- include/bwpp_env_follow.h | 24 +++--- include/bwpp_env_gen.h | 34 ++++---- include/bwpp_fuzz.h | 18 ++--- include/bwpp_gain.h | 18 ++--- include/bwpp_hp1.h | 16 ++-- include/bwpp_hs1.h | 20 ++--- include/bwpp_hs2.h | 22 ++--- include/bwpp_lp1.h | 20 ++--- include/bwpp_ls1.h | 20 ++--- include/bwpp_ls2.h | 22 ++--- include/bwpp_mm1.h | 24 +++--- include/bwpp_mm2.h | 30 +++---- include/bwpp_noise_gate.h | 24 +++--- include/bwpp_noise_gen.h | 12 +-- include/bwpp_notch.h | 18 ++--- include/bwpp_one_pole.h | 36 ++++----- include/bwpp_osc_filt.h | 12 +-- include/bwpp_osc_pulse.h | 14 ++-- include/bwpp_osc_saw.h | 8 +- include/bwpp_osc_sin.h | 4 +- include/bwpp_osc_tri.h | 14 ++-- include/bwpp_pan.h | 12 +-- include/bwpp_peak.h | 26 +++--- include/bwpp_phase_gen.h | 18 ++--- include/bwpp_phaser.h | 20 ++--- include/bwpp_pink_filt.h | 18 ++--- include/bwpp_ppm.h | 22 ++--- include/bwpp_reverb.h | 30 +++---- include/bwpp_ringmod.h | 12 +-- include/bwpp_satur.h | 20 ++--- include/bwpp_slew_lim.h | 26 +++--- include/bwpp_sr_reduce.h | 14 ++-- include/bwpp_src.h | 12 +-- include/bwpp_src_int.h | 12 +-- include/bwpp_svf.h | 22 ++--- include/bwpp_trem.h | 18 ++--- include/bwpp_wah.h | 16 ++-- 106 files changed, 1124 insertions(+), 772 deletions(-) diff --git a/TODO b/TODO index 1bc11ac..be5821e 100644 --- a/TODO +++ b/TODO @@ -8,8 +8,7 @@ code: * audio rate optional pulse width/slope inputs? * should rather use backward Euler in bw_onepole? * one pole process const input? (return also if const out) -* check const restrict etc. -* define BW_RESTRICT to __restrict or similar when the compiler supports it +* check const restrict size_t etc. * empty functions etc. to keep consistency and forward compatibility? * float in [-1,1] for velocity, pitch bend, mod wheel * should clip slope in triangle? @@ -19,7 +18,6 @@ code: * pan process with no out: should just reset coeffs? * get_y_z1, common strategy? * sqrt(0) and corner cases, common strategy? -* use BW_SIZE_T, check constant types * bw_satur gain compensation to divide by actual gain (derivative) rather than gain parameter? * cite papers, thank authors * add initial state (x0) to reset state of lp1, ap1, mm1, hs1, ls1, others? all? @@ -50,9 +48,6 @@ code: * bw_buf invert src dest order? * check unititialized warnings * voice alloc mode -> voice alloc priority -* should remove bw_config? -* use custom NDEBUG? -* NULL (C) vs BW_SIZE_T (non-C)...? * clearly specify that state is tied to a particular set of coeffs (1:N) * modulation vs process (multi) no update (post 1.0.0)??? diff --git a/examples/common/ios/platform.h b/examples/common/ios/platform.h index 8b13789..962b66f 100644 --- a/examples/common/ios/platform.h +++ b/examples/common/ios/platform.h @@ -1 +1,6 @@ +#ifndef PLATFORM_H +#define PLATFORM_H +#define NDEBUG + +#endif diff --git a/examples/common/web/platform.h b/examples/common/web/platform.h index 8483823..43bd66a 100644 --- a/examples/common/web/platform.h +++ b/examples/common/web/platform.h @@ -1,6 +1,7 @@ #ifndef PLATFORM_H #define PLATFORM_H +#define BW_NO_MATH_H #define INFINITY (__builtin_inff()) #endif diff --git a/examples/common/web/web.mk b/examples/common/web/web.mk index 50f433d..ce47d05 100644 --- a/examples/common/web/web.mk +++ b/examples/common/web/web.mk @@ -1,6 +1,6 @@ CC := clang CFLAGS := \ - -DNDEBUG \ + -DBW_NO_DEBUG \ -I${ROOT_DIR}/../src \ -I${ROOT_DIR}/../../common/web \ -I${ROOT_DIR}/../../../include \ diff --git a/include/bw_ap1.h b/include/bw_ap1.h index ac512c7..4d5eb39 100644 --- a/include/bw_ap1.h +++ b/include/bw_ap1.h @@ -20,7 +20,7 @@ /*! * module_type {{{ dsp }}} - * version {{{ 0.6.0 }}} + * version {{{ 1.0.0 }}} * requires {{{ bw_common bw_lp1 bw_math bw_one_pole }}} * description {{{ * First-order allpass filter (90° shift at cutoff, approaching 180° shift @@ -28,6 +28,12 @@ * }}} * changelog {{{ *