From 12a574c07d86061fa722dd034613941856349ae8 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Mon, 14 Aug 2023 09:57:06 +0200 Subject: [PATCH] restrict qualified everything --- TODO | 6 ++++-- include/bw_ap1.h | 10 +++++----- include/bw_ap2.h | 10 +++++----- include/bw_buf.h | 20 ++++++++++---------- include/bw_chorus.h | 17 ++++++++--------- include/bw_clip.h | 10 +++++----- include/bw_comb.h | 16 ++++++++-------- include/bw_common.h | 18 ++++++++++-------- include/bw_comp.h | 10 +++++----- include/bw_delay.h | 18 +++++++++--------- include/bw_dist.h | 10 +++++----- include/bw_drive.h | 10 +++++----- include/bw_env_follow.h | 10 +++++----- include/bw_env_gen.h | 34 +++++++++++++++++----------------- include/bw_fuzz.h | 10 +++++----- include/bw_hp1.h | 10 +++++----- include/bw_hs1.h | 10 +++++----- include/bw_hs2.h | 10 +++++----- include/bw_lp1.h | 10 +++++----- include/bw_ls1.h | 10 +++++----- include/bw_ls2.h | 10 +++++----- include/bw_math.h | 10 ++++++++-- include/bw_mm1.h | 10 +++++----- include/bw_mm2.h | 10 +++++----- include/bw_noise_gate.h | 22 +++++++++++----------- include/bw_noise_gen.h | 18 +++++++++--------- include/bw_notch.h | 10 +++++----- include/bw_one_pole.h | 10 +++++----- include/bw_osc_filt.h | 10 +++++----- include/bw_peak.h | 10 +++++----- include/bw_phase_gen.h | 10 +++++----- include/bw_phaser.h | 10 +++++----- include/bw_pink_filt.h | 10 +++++----- include/bw_ppm.h | 10 +++++----- include/bw_reverb.h | 16 ++++++++-------- include/bw_satur.h | 10 +++++----- include/bw_slew_lim.h | 10 +++++----- include/bw_sr_reduce.h | 10 +++++----- include/bw_src.h | 22 +++++++++++----------- include/bw_src_int.h | 10 +++++----- include/bw_svf.h | 10 +++++----- include/bw_trem.h | 12 ++++++------ include/bw_voice_alloc.h | 7 ++++--- include/bw_wah.h | 10 +++++----- 44 files changed, 273 insertions(+), 263 deletions(-) diff --git a/TODO b/TODO index b60e0c0..41deb1a 100644 --- a/TODO +++ b/TODO @@ -2,13 +2,12 @@ ----- code: -* debugging +* debugging - also check outputs different (incl bw_buf) * check all examples again * osc post filter (and one pole init, slew rate, etc.) val from input? set state instead? * 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 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? @@ -40,6 +39,7 @@ code: * check assumptions w.r.t. usage of math functions * sample rate-constant coeffs? (pan case) * sr-dependent vs cr-dependent coeffs? see synth poly example +* src x != y? build system: * single header generation (vs modules in bwp... to think about) @@ -71,6 +71,8 @@ code: * bw_math: review types in implementation * way to detect extern "C"? perhaps hidden "trap" preprocessor definition? * any chance to avoid casts in C for const X * const * input arguments? +* heavy debug (e.g. also stripping restrict) vs light debug vs release vs optimized makefile rules +* smaller optimized modules (e.g., simple one pole) build system: * make makefiles handle paths with spaces etc diff --git a/include/bw_ap1.h b/include/bw_ap1.h index a57b8f0..64749f9 100644 --- a/include/bw_ap1.h +++ b/include/bw_ap1.h @@ -33,8 +33,8 @@ *
  • bw_ap1_process() and * bw_ap1_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -145,7 +145,7 @@ static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_stat * * #### bw_ap1_process_multi() * ```>>> */ -static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -222,7 +222,7 @@ static inline void bw_ap1_process(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_stat } } -static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_ap1_process_multi(bw_ap1_coeffs *BW_RESTRICT coeffs, bw_ap1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_ap1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_ap1_update_coeffs_audio(coeffs); @@ -277,7 +277,7 @@ public: private: bw_ap1_coeffs coeffs; bw_ap1_state states[N_CHANNELS]; - bw_ap1_state *statesP[N_CHANNELS]; + bw_ap1_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_ap2.h b/include/bw_ap2.h index a870018..1980ba7 100644 --- a/include/bw_ap2.h +++ b/include/bw_ap2.h @@ -33,8 +33,8 @@ *
  • bw_ap2_process() and * bw_ap2_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -143,7 +143,7 @@ static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_stat * * #### bw_ap2_process_multi() * ```>>> */ -static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -232,7 +232,7 @@ static inline void bw_ap2_process(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_stat } } -static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_ap2_process_multi(bw_ap2_coeffs *BW_RESTRICT coeffs, bw_ap2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_ap2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_ap2_update_coeffs_audio(coeffs); @@ -292,7 +292,7 @@ public: private: bw_ap2_coeffs coeffs; bw_ap2_state states[N_CHANNELS]; - bw_ap2_state *statesP[N_CHANNELS]; + bw_ap2_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_buf.h b/include/bw_buf.h index b1a4449..d2e307c 100644 --- a/include/bw_buf.h +++ b/include/bw_buf.h @@ -32,8 +32,8 @@ *
  • Now using size_t instead of * BW_SIZE_T.
  • *
  • Changed order of arguments to improve consistency.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ functions taking C-style arrays as * arguments.
  • @@ -82,7 +82,7 @@ extern "C" { /*! api {{{ * #### bw_buf_fill() * ```>>> */ -static inline void bw_buf_fill(float k, float *dest, size_t n_elems); +static inline void bw_buf_fill(float k, float *BW_RESTRICT dest, size_t n_elems); /*! <<<``` * Sets the first `n_elems` in `dest` to `k`. * @@ -123,7 +123,7 @@ static inline void bw_buf_mul(const float *src1, const float *src2, float *dest, * * #### bw_buf_fill_multi() * ```>>> */ -static inline void bw_buf_fill_multi(float k, float * const *dest, size_t n_channels, size_t n_elems); +static inline void bw_buf_fill_multi(float k, float *BW_RESTRICT const *BW_RESTRICT dest, size_t n_channels, size_t n_elems); /*! <<<``` * Sets the first `n_elems` in each of the `n_channels` buffers `dest` to * `k`. @@ -182,7 +182,7 @@ static inline void bw_buf_mul_multi(const float * const *src1, const float * con extern "C" { #endif -static inline void bw_buf_fill(float k, float *dest, size_t n_elems) { +static inline void bw_buf_fill(float k, float *BW_RESTRICT dest, size_t n_elems) { BW_ASSERT(!(dest == NULL && n_elems != 0)); BW_ASSERT(!bw_is_nan(k)); @@ -246,7 +246,7 @@ static inline void bw_buf_mul(const float *src1, const float *src2, float *dest, BW_ASSERT_DEEP(!bw_has_nan(dest, n_elems)); } -static inline void bw_buf_fill_multi(float k, float * const *dest, size_t n_channels, size_t n_elems) { +static inline void bw_buf_fill_multi(float k, float *BW_RESTRICT const *BW_RESTRICT dest, size_t n_channels, size_t n_elems) { BW_ASSERT(!(dest == NULL && n_channels != 0)); for (size_t i = 0; i < n_channels; i++) @@ -303,13 +303,13 @@ namespace Brickworks { template inline void bufFill( float k, - float * const * dest, + float *BW_RESTRICT const *BW_RESTRICT dest, int nSamples); template inline void bufFill( float k, - std::array dest, + std::array dest, int nSamples); /*! <<<``` * @@ -405,7 +405,7 @@ inline void bufMul( template inline void bufFill( float k, - float * const * dest, + float *BW_RESTRICT const *BW_RESTRICT dest, int nSamples) { bw_buf_fill_multi(k, dest, N_CHANNELS, nSamples); } @@ -413,7 +413,7 @@ inline void bufFill( template inline void bufFill( float k, - std::array dest, + std::array dest, int nSamples) { bufFill(k, dest.data(), nSamples); } diff --git a/include/bw_chorus.h b/include/bw_chorus.h index 0b060e6..be7d619 100644 --- a/include/bw_chorus.h +++ b/include/bw_chorus.h @@ -43,8 +43,8 @@ *
  • bw_chorus_process() and * bw_chorus_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implmenetation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -117,7 +117,7 @@ static inline size_t bw_chorus_mem_req(const bw_chorus_coeffs *BW_RESTRICT coeff * * #### bw_chorus_mem_set() * ```>>> */ -static inline void bw_chorus_mem_set(const bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state *BW_RESTRICT state, void *mem); +static inline void bw_chorus_mem_set(const bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state *BW_RESTRICT state, void *BW_RESTRICT mem); /*! <<<``` * Associates the contiguous memory block `mem` to the given `state`. * @@ -162,7 +162,7 @@ static inline void bw_chorus_process(bw_chorus_coeffs *BW_RESTRICT coeffs, bw_ch * * #### bw_chorus_process_multi() * ```>>> */ -static inline void bw_chorus_process_multi(bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_chorus_process_multi(bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -267,8 +267,7 @@ static inline size_t bw_chorus_mem_req(const bw_chorus_coeffs *BW_RESTRICT coeff return bw_comb_mem_req(&coeffs->comb_coeffs); } -static inline void bw_chorus_mem_set(const bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state *BW_RESTRICT state, void *mem) { - (void)coeffs; +static inline void bw_chorus_mem_set(const bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state *BW_RESTRICT state, void *BW_RESTRICT mem) { bw_comb_mem_set(&coeffs->comb_coeffs, &state->comb_state, mem); } @@ -310,7 +309,7 @@ static inline void bw_chorus_process(bw_chorus_coeffs *BW_RESTRICT coeffs, bw_ch } } -static inline void bw_chorus_process_multi(bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_chorus_process_multi(bw_chorus_coeffs *BW_RESTRICT coeffs, bw_chorus_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_chorus_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_chorus_update_coeffs_audio(coeffs); @@ -392,8 +391,8 @@ public: private: bw_chorus_coeffs coeffs; bw_chorus_state states[N_CHANNELS]; - bw_chorus_state *statesP[N_CHANNELS]; - void *mem; + bw_chorus_state *BW_RESTRICT statesP[N_CHANNELS]; + void *BW_RESTRICT mem; }; template diff --git a/include/bw_clip.h b/include/bw_clip.h index 08ef9fa..543d56c 100644 --- a/include/bw_clip.h +++ b/include/bw_clip.h @@ -43,8 +43,8 @@ *
  • bw_clip_process() and * bw_clip_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -145,7 +145,7 @@ static inline void bw_clip_process(bw_clip_coeffs *BW_RESTRICT coeffs, bw_clip_s * * #### bw_clip_process_multi() * ```>>> */ -static inline void bw_clip_process_multi(bw_clip_coeffs *BW_RESTRICT coeffs, bw_clip_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_clip_process_multi(bw_clip_coeffs *BW_RESTRICT coeffs, bw_clip_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -293,7 +293,7 @@ static inline void bw_clip_process(bw_clip_coeffs *BW_RESTRICT coeffs, bw_clip_s } } -static inline void bw_clip_process_multi(bw_clip_coeffs *BW_RESTRICT coeffs, bw_clip_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_clip_process_multi(bw_clip_coeffs *BW_RESTRICT coeffs, bw_clip_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { if (coeffs->gain_compensation) for (size_t i = 0; i < n_samples; i++) { bw_clip_update_coeffs_audio(coeffs); @@ -364,7 +364,7 @@ public: private: bw_clip_coeffs coeffs; bw_clip_state states[N_CHANNELS]; - bw_clip_state *statesP[N_CHANNELS]; + bw_clip_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_comb.h b/include/bw_comb.h index 839d816..b537c42 100644 --- a/include/bw_comb.h +++ b/include/bw_comb.h @@ -44,8 +44,8 @@ *
  • bw_comb_process() and * bw_comb_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -118,7 +118,7 @@ static inline size_t bw_comb_mem_req(const bw_comb_coeffs *BW_RESTRICT coeffs); * * #### bw_comb_mem_set() * ```>>> */ -static inline void bw_comb_mem_set(const bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state *BW_RESTRICT state, void *mem); +static inline void bw_comb_mem_set(const bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state *BW_RESTRICT state, void *BW_RESTRICT mem); /*! <<<``` * Associates the contiguous memory block `mem` to the given `state`. * @@ -163,7 +163,7 @@ static inline void bw_comb_process(bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_s * * #### bw_comb_process_multi() * ```>>> */ -static inline void bw_comb_process_multi(bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_comb_process_multi(bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -285,7 +285,7 @@ static inline size_t bw_comb_mem_req(const bw_comb_coeffs *BW_RESTRICT coeffs) { return bw_delay_mem_req(&coeffs->delay_coeffs); } -static inline void bw_comb_mem_set(const bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state *BW_RESTRICT state, void *mem) { +static inline void bw_comb_mem_set(const bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state *BW_RESTRICT state, void *BW_RESTRICT mem) { bw_delay_mem_set(&coeffs->delay_coeffs, &state->delay_state, mem); } @@ -361,7 +361,7 @@ static inline void bw_comb_process(bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_s } } -static inline void bw_comb_process_multi(bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_comb_process_multi(bw_comb_coeffs *BW_RESTRICT coeffs, bw_comb_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_comb_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_comb_update_coeffs_audio(coeffs); @@ -437,8 +437,8 @@ public: private: bw_comb_coeffs coeffs; bw_comb_state states[N_CHANNELS]; - bw_comb_state *statesP[N_CHANNELS]; - void *mem; + bw_comb_state *BW_RESTRICT statesP[N_CHANNELS]; + void *BW_RESTRICT mem; }; template diff --git a/include/bw_common.h b/include/bw_common.h index 5158495..381fde3 100644 --- a/include/bw_common.h +++ b/include/bw_common.h @@ -38,6 +38,8 @@ *
  • Introduced BW_NO_DEBUG to replace * NDEBUG and prevented useless inclusion of * assert.h.
  • + *
  • Added BW_RESTRICT specifiers to input + * arguments.
  • *
  • Removed usage of reserved identifiers.
  • *
  • Added extern "C" to functions.
  • * @@ -225,21 +227,21 @@ static inline char bw_is_finite(float x); * * #### bw_has_inf() * ```>>> */ -static inline char bw_has_inf(const float *x, size_t n_elems); +static inline char bw_has_inf(const float *BW_RESTRICT x, size_t n_elems); /*! <<<``` * Scans the fist `n_elems` in buffer `x` and returns non-`0` if it contains * at least one positive or negative inifinity value, `0` otherwise. * * #### bw_has_nan() * ```>>> */ -static inline char bw_has_nan(const float *x, size_t n_elems); +static inline char bw_has_nan(const float *BW_RESTRICT x, size_t n_elems); /*! <<<``` * Scans the fist `n_elems` in buffer `x` and returns non-`0` if it contains * at least one NaN value, `0` otherwise. * * #### bw_has_only_finite() * ```>>> */ -static inline char bw_has_only_finite(const float *x, size_t n_elems); +static inline char bw_has_only_finite(const float *BW_RESTRICT x, size_t n_elems); /*! <<<``` * Scans the fist `n_elems` in buffer `x` and returns non-`0` if it only * finds finite values (neither NaN nor positive or negative infinity), `0` @@ -247,7 +249,7 @@ static inline char bw_has_only_finite(const float *x, size_t n_elems); * * #### bw_hash_sdbm() * ```>>> */ -static inline uint32_t bw_hash_sdbm(const char *string); +static inline uint32_t bw_hash_sdbm(const char *BW_RESTRICT string); /*! <<<``` * Returns the sdbm hash of the given `string`. * }}} */ @@ -283,28 +285,28 @@ static inline char bw_is_finite(float x) { return (v.u & 0x7f800000) != 0x7f800000; } -static inline char bw_has_inf(const float *x, size_t n_elems) { +static inline char bw_has_inf(const float *BW_RESTRICT x, size_t n_elems) { char ret = 0; for (size_t i = 0; i < n_elems && !ret; i++) ret = bw_is_inf(x[i]); return ret; } -static inline char bw_has_nan(const float *x, size_t n_elems) { +static inline char bw_has_nan(const float *BW_RESTRICT x, size_t n_elems) { char ret = 0; for (size_t i = 0; i < n_elems && !ret; i++) ret = bw_is_nan(x[i]); return ret; } -static inline char bw_has_only_finite(const float *x, size_t n_elems) { +static inline char bw_has_only_finite(const float *BW_RESTRICT x, size_t n_elems) { char ret = 1; for (size_t i = 0; i < n_elems && ret; i++) ret = bw_is_finite(x[i]); return ret; } -static inline uint32_t bw_hash_sdbm(const char *string) { +static inline uint32_t bw_hash_sdbm(const char *BW_RESTRICT string) { uint32_t hash = 0; for (; *string != '\0'; string++) hash = *string + (hash << 6) + (hash << 16) - hash; diff --git a/include/bw_comp.h b/include/bw_comp.h index 0701f6c..6a5304b 100644 --- a/include/bw_comp.h +++ b/include/bw_comp.h @@ -34,8 +34,8 @@ *
  • bw_comp_process() and * bw_comp_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -141,7 +141,7 @@ static inline void bw_comp_process(bw_comp_coeffs *BW_RESTRICT coeffs, bw_comp_s * * #### bw_comp_process_multi() * ```>>> */ -static inline void bw_comp_process_multi(bw_comp_coeffs *BW_RESTRICT coeffs, bw_comp_state * const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_comp_process_multi(bw_comp_coeffs *BW_RESTRICT coeffs, bw_comp_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * the first `n_samples` of the `n_channels` sidechain input buffers `x_sc`, @@ -302,7 +302,7 @@ static inline void bw_comp_process(bw_comp_coeffs *BW_RESTRICT coeffs, bw_comp_s } } -static inline void bw_comp_process_multi(bw_comp_coeffs *BW_RESTRICT coeffs, bw_comp_state * const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_comp_process_multi(bw_comp_coeffs *BW_RESTRICT coeffs, bw_comp_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples) { bw_comp_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_comp_update_coeffs_audio(coeffs); @@ -389,7 +389,7 @@ public: private: bw_comp_coeffs coeffs; bw_comp_state states[N_CHANNELS]; - bw_comp_state *statesP[N_CHANNELS]; + bw_comp_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_delay.h b/include/bw_delay.h index 6de6680..e1dba41 100644 --- a/include/bw_delay.h +++ b/include/bw_delay.h @@ -38,8 +38,8 @@ *
  • bw_delay_process() and * bw_delay_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -111,7 +111,7 @@ static inline size_t bw_delay_mem_req(const bw_delay_coeffs *BW_RESTRICT coeffs) * * #### bw_delay_mem_set() * ```>>> */ -static inline void bw_delay_mem_set(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT state, void *mem); +static inline void bw_delay_mem_set(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT state, void *BW_RESTRICT mem); /*! <<<``` * Associates the contiguous memory block `mem` to the given `state`. * @@ -173,7 +173,7 @@ static inline void bw_delay_process(bw_delay_coeffs *BW_RESTRICT coeffs, bw_dela * * #### bw_delay_process_multi() * ```>>> */ -static inline void bw_delay_process_multi(bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_delay_process_multi(bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -226,7 +226,7 @@ struct bw_delay_coeffs { }; struct bw_delay_state { - float *buf; + float *BW_RESTRICT buf; size_t idx; }; @@ -244,7 +244,7 @@ static inline size_t bw_delay_mem_req(const bw_delay_coeffs *BW_RESTRICT coeffs) return coeffs->len * sizeof(float); } -static inline void bw_delay_mem_set(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT state, void *mem) { +static inline void bw_delay_mem_set(const bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT state, void *BW_RESTRICT mem) { (void)coeffs; state->buf = (float *)mem; } @@ -295,7 +295,7 @@ static inline void bw_delay_process(bw_delay_coeffs *BW_RESTRICT coeffs, bw_dela y[i] = bw_delay_process1(coeffs, state, x[i]); } -static inline void bw_delay_process_multi(bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_delay_process_multi(bw_delay_coeffs *BW_RESTRICT coeffs, bw_delay_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_delay_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) for (size_t j = 0; j < n_channels; j++) @@ -361,8 +361,8 @@ public: private: bw_delay_coeffs coeffs; bw_delay_state states[N_CHANNELS]; - bw_delay_state *statesP[N_CHANNELS]; - void *mem; + bw_delay_state *BW_RESTRICT statesP[N_CHANNELS]; + void *BW_RESTRICT mem; }; template diff --git a/include/bw_dist.h b/include/bw_dist.h index 41eb96f..f1aeb8e 100644 --- a/include/bw_dist.h +++ b/include/bw_dist.h @@ -37,8 +37,8 @@ *
  • bw_dist_process() and * bw_dist_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -134,7 +134,7 @@ static inline void bw_dist_process(bw_dist_coeffs *BW_RESTRICT coeffs, bw_dist_s * * #### bw_dist_process_multi() * ```>>> */ -static inline void bw_dist_process_multi(bw_dist_coeffs *BW_RESTRICT coeffs, bw_dist_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_dist_process_multi(bw_dist_coeffs *BW_RESTRICT coeffs, bw_dist_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -278,7 +278,7 @@ static inline void bw_dist_process(bw_dist_coeffs *BW_RESTRICT coeffs, bw_dist_s } } -static inline void bw_dist_process_multi(bw_dist_coeffs *BW_RESTRICT coeffs, bw_dist_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_dist_process_multi(bw_dist_coeffs *BW_RESTRICT coeffs, bw_dist_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_dist_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_dist_update_coeffs_audio(coeffs); @@ -343,7 +343,7 @@ public: private: bw_dist_coeffs coeffs; bw_dist_state states[N_CHANNELS]; - bw_dist_state *statesP[N_CHANNELS]; + bw_dist_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_drive.h b/include/bw_drive.h index 91a1c8f..8fbfe89 100644 --- a/include/bw_drive.h +++ b/include/bw_drive.h @@ -36,8 +36,8 @@ *
  • bw_drive_process() and * bw_drive_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -133,7 +133,7 @@ static inline void bw_drive_process(bw_drive_coeffs *BW_RESTRICT coeffs, bw_driv * * #### bw_drive_process_multi() * ```>>> */ -static inline void bw_drive_process_multi(bw_drive_coeffs *BW_RESTRICT coeffs, bw_drive_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_drive_process_multi(bw_drive_coeffs *BW_RESTRICT coeffs, bw_drive_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -267,7 +267,7 @@ static inline void bw_drive_process(bw_drive_coeffs *BW_RESTRICT coeffs, bw_driv } } -static inline void bw_drive_process_multi(bw_drive_coeffs *BW_RESTRICT coeffs, bw_drive_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_drive_process_multi(bw_drive_coeffs *BW_RESTRICT coeffs, bw_drive_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_drive_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_drive_update_coeffs_audio(coeffs); @@ -332,7 +332,7 @@ public: private: bw_drive_coeffs coeffs; bw_drive_state states[N_CHANNELS]; - bw_drive_state *statesP[N_CHANNELS]; + bw_drive_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_env_follow.h b/include/bw_env_follow.h index 1a5f418..be5d072 100644 --- a/include/bw_env_follow.h +++ b/include/bw_env_follow.h @@ -33,8 +33,8 @@ *
  • bw_env_follow_process() and * bw_env_follow_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -148,7 +148,7 @@ static inline void bw_env_follow_process(bw_env_follow_coeffs *BW_RESTRICT coeff * * #### bw_env_follow_process_multi() * ```>>> */ -static inline void bw_env_follow_process_multi(bw_env_follow_coeffs *BW_RESTRICT coeffs, bw_env_follow_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_env_follow_process_multi(bw_env_follow_coeffs *BW_RESTRICT coeffs, bw_env_follow_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -250,7 +250,7 @@ static inline void bw_env_follow_process(bw_env_follow_coeffs *BW_RESTRICT coeff } } -static inline void bw_env_follow_process_multi(bw_env_follow_coeffs *BW_RESTRICT coeffs, bw_env_follow_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_env_follow_process_multi(bw_env_follow_coeffs *BW_RESTRICT coeffs, bw_env_follow_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_env_follow_update_coeffs_ctrl(coeffs); if (y != NULL) for (size_t i = 0; i < n_samples; i++) { @@ -326,7 +326,7 @@ public: private: bw_env_follow_coeffs coeffs; bw_env_follow_state states[N_CHANNELS]; - bw_env_follow_state *statesP[N_CHANNELS]; + bw_env_follow_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_env_gen.h b/include/bw_env_gen.h index 7ff18da..1c965f7 100644 --- a/include/bw_env_gen.h +++ b/include/bw_env_gen.h @@ -45,8 +45,8 @@ *
  • bw_env_gen_process() and * bw_env_gen_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -184,7 +184,7 @@ static inline float bw_env_gen_process1(const bw_env_gen_coeffs *BW_RESTRICT coe * * #### bw_env_gen_process() * ```>>> */ -static inline void bw_env_gen_process(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT state, char gate, float *y, size_t n_samples); +static inline void bw_env_gen_process(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT state, char gate, float *BW_RESTRICT y, size_t n_samples); /*! <<<``` * Generates and fills the first `n_samples` of the output buffer `y` using * the given `gate` value (`0` for off, non-`0` for on), while using and @@ -194,7 +194,7 @@ static inline void bw_env_gen_process(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_ * * #### bw_env_gen_process_multi() * ```>>> */ -static inline void bw_env_gen_process_multi(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state * const *BW_RESTRICT state, const char *gate, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_env_gen_process_multi(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT const *BW_RESTRICT state, const char *BW_RESTRICT gate, float *BW_RESTRICT const *BW_RESTRICT y, size_t n_channels, size_t n_samples); /*! <<<``` * Generates and fills the first `n_samples` of the `n_channels` output * buffers `y` using the given `n_channels` `gate` values (`0` for off, @@ -243,13 +243,13 @@ static inline void bw_env_gen_set_release(bw_env_gen_coeffs *BW_RESTRICT coeffs, * * #### bw_env_gen_get_phase() * ```>>> */ -static inline bw_env_gen_phase bw_env_gen_get_phase(const bw_env_gen_state *state); +static inline bw_env_gen_phase bw_env_gen_get_phase(const bw_env_gen_state *BW_RESTRICT state); /*! <<<``` * Returns the current envelope generator phase as stored in `state`. * * #### bw_env_gen_get_y_z1() * ```>>> */ -static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *state); +static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *BW_RESTRICT state); /*! <<<``` * Returns the last output sample as stored in `state`. * }}} */ @@ -389,7 +389,7 @@ static inline float bw_env_gen_process1(const bw_env_gen_coeffs *BW_RESTRICT coe return v; } -static inline void bw_env_gen_process(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT state, char gate, float *y, size_t n_samples) { +static inline void bw_env_gen_process(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT state, char gate, float *BW_RESTRICT y, size_t n_samples) { bw_env_gen_update_coeffs_ctrl(coeffs); bw_env_gen_update_state_ctrl(coeffs, state, gate); if (y != NULL) @@ -400,7 +400,7 @@ static inline void bw_env_gen_process(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_ bw_env_gen_process1(coeffs, state); } -static inline void bw_env_gen_process_multi(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state * const *BW_RESTRICT state, const char *gate, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_env_gen_process_multi(bw_env_gen_coeffs *BW_RESTRICT coeffs, bw_env_gen_state *BW_RESTRICT const *BW_RESTRICT state, const char *BW_RESTRICT gate, float *BW_RESTRICT const *BW_RESTRICT y, size_t n_channels, size_t n_samples) { bw_env_gen_update_coeffs_ctrl(coeffs); for (size_t j = 0; j < n_channels; j++) bw_env_gen_update_state_ctrl(coeffs, state[j], gate[j]); @@ -445,11 +445,11 @@ static inline void bw_env_gen_set_release(bw_env_gen_coeffs *BW_RESTRICT coeffs, } } -static inline bw_env_gen_phase bw_env_gen_get_phase(const bw_env_gen_state *state) { +static inline bw_env_gen_phase bw_env_gen_get_phase(const bw_env_gen_state *BW_RESTRICT state) { return state->phase; } -static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *state) { +static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *BW_RESTRICT state) { return state->y_z1; } @@ -478,12 +478,12 @@ public: void setSampleRate(float sampleRate); void reset(); void process( - const char *gate, - float * const *y, + const char *BW_RESTRICT gate, + float *BW_RESTRICT const *BW_RESTRICT y, size_t nSamples); void process( std::array gate, - std::array y, + std::array y, size_t nSamples); void setAttack(float value); @@ -506,7 +506,7 @@ public: private: bw_env_gen_coeffs coeffs; bw_env_gen_state states[N_CHANNELS]; - bw_env_gen_state *statesP[N_CHANNELS]; + bw_env_gen_state *BW_RESTRICT statesP[N_CHANNELS]; }; template @@ -530,8 +530,8 @@ inline void EnvGen::reset() { template inline void EnvGen::process( - const char *gate, - float * const *y, + const char *BW_RESTRICT gate, + float *BW_RESTRICT const *BW_RESTRICT y, size_t nSamples) { bw_env_gen_process_multi(&coeffs, statesP, gate, y, N_CHANNELS, nSamples); } @@ -539,7 +539,7 @@ inline void EnvGen::process( template inline void EnvGen::process( std::array gate, - std::array y, + std::array y, size_t nSamples) { process(gate.data(), y.data(), nSamples); } diff --git a/include/bw_fuzz.h b/include/bw_fuzz.h index b9680fe..fc94ca8 100644 --- a/include/bw_fuzz.h +++ b/include/bw_fuzz.h @@ -37,8 +37,8 @@ *
  • bw_fuzz_process() and * bw_fuzz_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -134,7 +134,7 @@ static inline void bw_fuzz_process(bw_fuzz_coeffs *BW_RESTRICT coeffs, bw_fuzz_s * * #### bw_fuzz_process_multi() * ```>>> */ -static inline void bw_fuzz_process_multi(bw_fuzz_coeffs *BW_RESTRICT coeffs, bw_fuzz_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_fuzz_process_multi(bw_fuzz_coeffs *BW_RESTRICT coeffs, bw_fuzz_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -260,7 +260,7 @@ static inline void bw_fuzz_process(bw_fuzz_coeffs *BW_RESTRICT coeffs, bw_fuzz_s } } -static inline void bw_fuzz_process_multi(bw_fuzz_coeffs *BW_RESTRICT coeffs, bw_fuzz_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_fuzz_process_multi(bw_fuzz_coeffs *BW_RESTRICT coeffs, bw_fuzz_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_fuzz_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_fuzz_update_coeffs_audio(coeffs); @@ -320,7 +320,7 @@ public: private: bw_fuzz_coeffs coeffs; bw_fuzz_state states[N_CHANNELS]; - bw_fuzz_state *statesP[N_CHANNELS]; + bw_fuzz_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_hp1.h b/include/bw_hp1.h index d341d8c..c97f68f 100644 --- a/include/bw_hp1.h +++ b/include/bw_hp1.h @@ -33,8 +33,8 @@ *
  • bw_hp1_process() and * bw_hp1_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -143,7 +143,7 @@ static inline void bw_hp1_process(bw_hp1_coeffs *BW_RESTRICT coeffs, bw_hp1_stat * * #### bw_hp1_process_multi() * ```>>> */ -static inline void bw_hp1_process_multi(bw_hp1_coeffs *BW_RESTRICT coeffs, bw_hp1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_hp1_process_multi(bw_hp1_coeffs *BW_RESTRICT coeffs, bw_hp1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -220,7 +220,7 @@ static inline void bw_hp1_process(bw_hp1_coeffs *BW_RESTRICT coeffs, bw_hp1_stat } } -static inline void bw_hp1_process_multi(bw_hp1_coeffs *BW_RESTRICT coeffs, bw_hp1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_hp1_process_multi(bw_hp1_coeffs *BW_RESTRICT coeffs, bw_hp1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_hp1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_hp1_update_coeffs_audio(coeffs); @@ -275,7 +275,7 @@ public: private: bw_hp1_coeffs coeffs; bw_hp1_state states[N_CHANNELS]; - bw_hp1_state *statesP[N_CHANNELS]; + bw_hp1_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_hs1.h b/include/bw_hs1.h index 8ad7e5f..31cea33 100644 --- a/include/bw_hs1.h +++ b/include/bw_hs1.h @@ -32,8 +32,8 @@ *
  • bw_hs1_process() and * bw_hs1_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -142,7 +142,7 @@ static inline void bw_hs1_process(bw_hs1_coeffs *BW_RESTRICT coeffs, bw_hs1_stat * * #### bw_hs1_process_multi() * ```>>> */ -static inline void bw_hs1_process_multi(bw_hs1_coeffs *BW_RESTRICT coeffs, bw_hs1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_hs1_process_multi(bw_hs1_coeffs *BW_RESTRICT coeffs, bw_hs1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -261,7 +261,7 @@ static inline void bw_hs1_process(bw_hs1_coeffs *BW_RESTRICT coeffs, bw_hs1_stat } } -static inline void bw_hs1_process_multi(bw_hs1_coeffs *BW_RESTRICT coeffs, bw_hs1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_hs1_process_multi(bw_hs1_coeffs *BW_RESTRICT coeffs, bw_hs1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_hs1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_hs1_update_coeffs_audio(coeffs); @@ -332,7 +332,7 @@ public: private: bw_hs1_coeffs coeffs; bw_hs1_state states[N_CHANNELS]; - bw_hs1_state *statesP[N_CHANNELS]; + bw_hs1_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_hs2.h b/include/bw_hs2.h index 73b8591..ebb2902 100644 --- a/include/bw_hs2.h +++ b/include/bw_hs2.h @@ -32,8 +32,8 @@ *
  • bw_hs2_process() and * bw_hs2_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -142,7 +142,7 @@ static inline void bw_hs2_process(bw_hs2_coeffs *BW_RESTRICT coeffs, bw_hs2_stat * * #### bw_hs2_process_multi() * ```>>> */ -static inline void bw_hs2_process_multi(bw_hs2_coeffs *BW_RESTRICT coeffs, bw_hs2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_hs2_process_multi(bw_hs2_coeffs *BW_RESTRICT coeffs, bw_hs2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -281,7 +281,7 @@ static inline void bw_hs2_process(bw_hs2_coeffs *BW_RESTRICT coeffs, bw_hs2_stat } } -static inline void bw_hs2_process_multi(bw_hs2_coeffs *BW_RESTRICT coeffs, bw_hs2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_hs2_process_multi(bw_hs2_coeffs *BW_RESTRICT coeffs, bw_hs2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_hs2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_hs2_update_coeffs_audio(coeffs); @@ -360,7 +360,7 @@ public: private: bw_hs2_coeffs coeffs; bw_hs2_state states[N_CHANNELS]; - bw_hs2_state *statesP[N_CHANNELS]; + bw_hs2_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_lp1.h b/include/bw_lp1.h index 9e7a96e..89c2640 100644 --- a/include/bw_lp1.h +++ b/include/bw_lp1.h @@ -35,8 +35,8 @@ *
  • bw_lp1_process() and * bw_lp1_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -146,7 +146,7 @@ static inline void bw_lp1_process(bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_stat * * #### bw_lp1_process_multi() * ```>>> */ -static inline void bw_lp1_process_multi(bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_lp1_process_multi(bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -293,7 +293,7 @@ static inline void bw_lp1_process(bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_stat } } -static inline void bw_lp1_process_multi(bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_lp1_process_multi(bw_lp1_coeffs *BW_RESTRICT coeffs, bw_lp1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { for (size_t i = 0; i < n_samples; i++) { bw_lp1_update_coeffs_audio(coeffs); for (size_t j = 0; j < n_channels; j++) @@ -357,7 +357,7 @@ public: private: bw_lp1_coeffs coeffs; bw_lp1_state states[N_CHANNELS]; - bw_lp1_state *statesP[N_CHANNELS]; + bw_lp1_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_ls1.h b/include/bw_ls1.h index 5ae1512..985f88a 100644 --- a/include/bw_ls1.h +++ b/include/bw_ls1.h @@ -33,8 +33,8 @@ *
  • bw_ls1_process() and * bw_ls1_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -143,7 +143,7 @@ static inline void bw_ls1_process(bw_ls1_coeffs *BW_RESTRICT coeffs, bw_ls1_stat * * #### bw_ls1_process_multi() * ```>>> */ -static inline void bw_ls1_process_multi(bw_ls1_coeffs *BW_RESTRICT coeffs, bw_ls1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_ls1_process_multi(bw_ls1_coeffs *BW_RESTRICT coeffs, bw_ls1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -258,7 +258,7 @@ static inline void bw_ls1_process(bw_ls1_coeffs *BW_RESTRICT coeffs, bw_ls1_stat } } -static inline void bw_ls1_process_multi(bw_ls1_coeffs *BW_RESTRICT coeffs, bw_ls1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_ls1_process_multi(bw_ls1_coeffs *BW_RESTRICT coeffs, bw_ls1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_ls1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_ls1_update_coeffs_audio(coeffs); @@ -329,7 +329,7 @@ public: private: bw_ls1_coeffs coeffs; bw_ls1_state states[N_CHANNELS]; - bw_ls1_state *statesP[N_CHANNELS]; + bw_ls1_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_ls2.h b/include/bw_ls2.h index fe50200..ce35fe4 100644 --- a/include/bw_ls2.h +++ b/include/bw_ls2.h @@ -33,8 +33,8 @@ *
  • bw_ls2_process() and * bw_ls2_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -143,7 +143,7 @@ static inline void bw_ls2_process(bw_ls2_coeffs *BW_RESTRICT coeffs, bw_ls2_stat * * #### bw_ls2_process_multi() * ```>>> */ -static inline void bw_ls2_process_multi(bw_ls2_coeffs *BW_RESTRICT coeffs, bw_ls2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_ls2_process_multi(bw_ls2_coeffs *BW_RESTRICT coeffs, bw_ls2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -280,7 +280,7 @@ static inline void bw_ls2_process(bw_ls2_coeffs *BW_RESTRICT coeffs, bw_ls2_stat } } -static inline void bw_ls2_process_multi(bw_ls2_coeffs *BW_RESTRICT coeffs, bw_ls2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_ls2_process_multi(bw_ls2_coeffs *BW_RESTRICT coeffs, bw_ls2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_ls2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_ls2_update_coeffs_audio(coeffs); @@ -359,7 +359,7 @@ public: private: bw_ls2_coeffs coeffs; bw_ls2_state states[N_CHANNELS]; - bw_ls2_state *statesP[N_CHANNELS]; + bw_ls2_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_math.h b/include/bw_math.h index c3fb94b..80f3cfc 100644 --- a/include/bw_math.h +++ b/include/bw_math.h @@ -60,9 +60,12 @@ * improved implementation. *
  • Fixed input validity ranges in bw_asinhf() and * bw_acoshf().
  • + *
  • Added BW_RESTRICT specifiers to input + * arguments of bw_intfracf().
  • *
  • Removed usage of reserved identifiers and designated * initializers.
  • *
  • Added extern "C" to functions.
  • + *
  • Added more debugging checks in bw_intfracf().
  • *
  • Improved documentation w.r.t. validity of input values and * approximation errors.
  • * @@ -255,7 +258,7 @@ static inline float bw_ceilf(float x); * * #### bw_intfracf() * ```>>> */ -static inline void bw_intfracf(float x, float *i, float *f); +static inline void bw_intfracf(float x, float *BW_RESTRICT i, float *BW_RESTRICT f); /*! <<<``` * Puts the integer part (floor) of `x` in `i` and the fractional part in * `f`. @@ -660,8 +663,11 @@ static inline float bw_ceilf(float x) { return r; } -static inline void bw_intfracf(float x, float *i, float *f) { +static inline void bw_intfracf(float x, float *BW_RESTRICT i, float *BW_RESTRICT f) { BW_ASSERT(bw_is_finite(x)); + BW_ASSERT(i != NULL); + BW_ASSERT(f != NULL); + BW_ASSERT(i != f); *i = bw_floorf(x); *f = x - *i; BW_ASSERT(bw_is_finite(*i)); diff --git a/include/bw_mm1.h b/include/bw_mm1.h index 31d69a8..b10dcb3 100644 --- a/include/bw_mm1.h +++ b/include/bw_mm1.h @@ -32,8 +32,8 @@ *
  • bw_mm1_process() and * bw_mm1_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -142,7 +142,7 @@ static inline void bw_mm1_process(bw_mm1_coeffs *BW_RESTRICT coeffs, bw_mm1_stat * * #### bw_mm1_process_multi() * ```>>> */ -static inline void bw_mm1_process_multi(bw_mm1_coeffs *BW_RESTRICT coeffs, bw_mm1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_mm1_process_multi(bw_mm1_coeffs *BW_RESTRICT coeffs, bw_mm1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -273,7 +273,7 @@ static inline void bw_mm1_process(bw_mm1_coeffs *BW_RESTRICT coeffs, bw_mm1_stat } } -static inline void bw_mm1_process_multi(bw_mm1_coeffs *BW_RESTRICT coeffs, bw_mm1_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_mm1_process_multi(bw_mm1_coeffs *BW_RESTRICT coeffs, bw_mm1_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_mm1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_mm1_update_coeffs_audio(coeffs); @@ -348,7 +348,7 @@ public: private: bw_mm1_coeffs coeffs; bw_mm1_state states[N_CHANNELS]; - bw_mm1_state *statesP[N_CHANNELS]; + bw_mm1_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_mm2.h b/include/bw_mm2.h index 813ea2f..09b2800 100644 --- a/include/bw_mm2.h +++ b/include/bw_mm2.h @@ -32,8 +32,8 @@ *
  • bw_mm2_process() and * bw_mm2_process_multi() now use size_t * to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -142,7 +142,7 @@ static inline void bw_mm2_process(bw_mm2_coeffs *BW_RESTRICT coeffs, bw_mm2_stat * * #### bw_mm2_process_multi() * ```>>> */ -static inline void bw_mm2_process_multi(bw_mm2_coeffs *BW_RESTRICT coeffs, bw_mm2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_mm2_process_multi(bw_mm2_coeffs *BW_RESTRICT coeffs, bw_mm2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -318,7 +318,7 @@ static inline void bw_mm2_process(bw_mm2_coeffs *BW_RESTRICT coeffs, bw_mm2_stat } } -static inline void bw_mm2_process_multi(bw_mm2_coeffs *BW_RESTRICT coeffs, bw_mm2_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_mm2_process_multi(bw_mm2_coeffs *BW_RESTRICT coeffs, bw_mm2_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_mm2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_mm2_update_coeffs_audio(coeffs); @@ -408,7 +408,7 @@ public: private: bw_mm2_coeffs coeffs; bw_mm2_state states[N_CHANNELS]; - bw_mm2_state *statesP[N_CHANNELS]; + bw_mm2_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_noise_gate.h b/include/bw_noise_gate.h index d5515ce..fca885a 100644 --- a/include/bw_noise_gate.h +++ b/include/bw_noise_gate.h @@ -32,8 +32,8 @@ *
  • bw_noise_gate_process() and * bw_noise_gate_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -137,7 +137,7 @@ static inline void bw_noise_gate_process(bw_noise_gate_coeffs *BW_RESTRICT coeff * * #### bw_noise_gate_process_multi() * ```>>> */ -static inline void bw_noise_gate_process_multi(bw_noise_gate_coeffs *BW_RESTRICT coeffs, bw_noise_gate_state * const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_noise_gate_process_multi(bw_noise_gate_coeffs *BW_RESTRICT coeffs, bw_noise_gate_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * the first `n_samples` of the `n_channels` sidechain input buffers `x_sc`, @@ -275,7 +275,7 @@ static inline void bw_noise_gate_process(bw_noise_gate_coeffs *BW_RESTRICT coeff } } -static inline void bw_noise_gate_process_multi(bw_noise_gate_coeffs *BW_RESTRICT coeffs, bw_noise_gate_state * const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_noise_gate_process_multi(bw_noise_gate_coeffs *BW_RESTRICT coeffs, bw_noise_gate_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, const float * const *x_sc, float * const *y, size_t n_channels, size_t n_samples) { bw_noise_gate_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_noise_gate_update_coeffs_audio(coeffs); @@ -325,12 +325,12 @@ public: void reset(); void process( const float * const *x, - const float * const *xSC, + const float * const *x_sc, float * const *y, size_t nSamples); void process( std::array x, - std::array xSC, + std::array x_sc, std::array y, size_t nSamples); @@ -352,7 +352,7 @@ public: private: bw_noise_gate_coeffs coeffs; bw_noise_gate_state states[N_CHANNELS]; - bw_noise_gate_state *statesP[N_CHANNELS]; + bw_noise_gate_state *BW_RESTRICT statesP[N_CHANNELS]; }; template @@ -377,19 +377,19 @@ inline void NoiseGate::reset() { template inline void NoiseGate::process( const float * const *x, - const float * const *xSC, + const float * const *x_sc, float * const *y, size_t nSamples) { - bw_noise_gate_process_multi(&coeffs, statesP, x, xSC, y, N_CHANNELS, nSamples); + bw_noise_gate_process_multi(&coeffs, statesP, x, x_sc, y, N_CHANNELS, nSamples); } template inline void NoiseGate::process( std::array x, - std::array xSC, + std::array x_sc, std::array y, size_t nSamples) { - process(x.data(), xSC.data(), y.data(), nSamples); + process(x.data(), x_sc.data(), y.data(), nSamples); } template diff --git a/include/bw_noise_gen.h b/include/bw_noise_gen.h index 11940ac..aedf61f 100644 --- a/include/bw_noise_gen.h +++ b/include/bw_noise_gen.h @@ -36,8 +36,8 @@ *
  • bw_noise_gen_process() and * bw_noise_gen_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -117,7 +117,7 @@ static inline void bw_noise_gen_process(bw_noise_gen_coeffs *BW_RESTRICT coeffs, * * #### bw_noise_gen_process_multi() * ```>>> */ -static inline void bw_noise_gen_process_multi(bw_noise_gen_coeffs *BW_RESTRICT coeffs, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_noise_gen_process_multi(bw_noise_gen_coeffs *BW_RESTRICT coeffs, float *BW_RESTRICT const *BW_RESTRICT y, size_t n_channels, size_t n_samples); /*! <<<``` * Generates and fills the first `n_samples` of the `n_channels` output * buffers `y` using `coeffs`. @@ -165,7 +165,7 @@ struct bw_noise_gen_coeffs { float scaling_k; // Parameters - uint64_t *state; + uint64_t *BW_RESTRICT state; char sample_rate_scaling; }; @@ -195,7 +195,7 @@ static inline void bw_noise_gen_process(bw_noise_gen_coeffs *BW_RESTRICT coeffs, y[i] = bw_noise_gen_process1_scaling(coeffs); } -static inline void bw_noise_gen_process_multi(bw_noise_gen_coeffs *BW_RESTRICT coeffs, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_noise_gen_process_multi(bw_noise_gen_coeffs *BW_RESTRICT coeffs, float *BW_RESTRICT const *BW_RESTRICT y, size_t n_channels, size_t n_samples) { for (size_t i = 0; i < n_channels; i++) bw_noise_gen_process(coeffs, y[i], n_samples); } @@ -227,10 +227,10 @@ public: void setSampleRate(float sampleRate); void process( - float * const *y, + float *BW_RESTRICT const *BW_RESTRICT y, size_t nSamples); void process( - std::array y, + std::array y, size_t nSamples); void setSampleRateScaling(bool value); @@ -262,14 +262,14 @@ inline void NoiseGen::setSampleRate(float sampleRate) { template inline void NoiseGen::process( - float * const *y, + float *BW_RESTRICT const *BW_RESTRICT y, size_t nSamples) { bw_noise_gen_process_multi(&coeffs, y, N_CHANNELS, nSamples); } template inline void NoiseGen::process( - std::array y, + std::array y, size_t nSamples) { process(y.data(), nSamples); } diff --git a/include/bw_notch.h b/include/bw_notch.h index 16863be..575d0f1 100644 --- a/include/bw_notch.h +++ b/include/bw_notch.h @@ -33,8 +33,8 @@ *
  • bw_notch_process() and * bw_notch_process_multi() now use * size_t to count samples and channels.
  • - *
  • Added more const specifiers to input - * arguments.
  • + *
  • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
  • *
  • Moved C++ code to C header.
  • *
  • Added overladed C++ process() function taking * C-style arrays as arguments.
  • @@ -143,7 +143,7 @@ static inline void bw_notch_process(bw_notch_coeffs *BW_RESTRICT coeffs, bw_notc * * #### bw_notch_process_multi() * ```>>> */ -static inline void bw_notch_process_multi(bw_notch_coeffs *BW_RESTRICT coeffs, bw_notch_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_notch_process_multi(bw_notch_coeffs *BW_RESTRICT coeffs, bw_notch_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -231,7 +231,7 @@ static inline void bw_notch_process(bw_notch_coeffs *BW_RESTRICT coeffs, bw_notc } } -static inline void bw_notch_process_multi(bw_notch_coeffs *BW_RESTRICT coeffs, bw_notch_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_notch_process_multi(bw_notch_coeffs *BW_RESTRICT coeffs, bw_notch_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_notch_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_notch_update_coeffs_audio(coeffs); @@ -291,7 +291,7 @@ public: private: bw_notch_coeffs coeffs; bw_notch_state states[N_CHANNELS]; - bw_notch_state *statesP[N_CHANNELS]; + bw_notch_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_one_pole.h b/include/bw_one_pole.h index 2e0b02b..7d0b820 100644 --- a/include/bw_one_pole.h +++ b/include/bw_one_pole.h @@ -34,8 +34,8 @@ *
      *
    • Now using size_t instead of * BW_SIZE_T.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -196,7 +196,7 @@ static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, b * * #### bw_one_pole_process_multi() * ```>>> */ -static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -706,7 +706,7 @@ static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, b BW_ASSERT_DEEP(!bw_has_nan(y, n_samples)); } -static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); @@ -1014,7 +1014,7 @@ public: private: bw_one_pole_coeffs coeffs; bw_one_pole_state states[N_CHANNELS]; - bw_one_pole_state *statesP[N_CHANNELS]; + bw_one_pole_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_osc_filt.h b/include/bw_osc_filt.h index e802280..64763fe 100644 --- a/include/bw_osc_filt.h +++ b/include/bw_osc_filt.h @@ -38,8 +38,8 @@ *
    • bw_osc_filt_process() and * bw_osc_filt_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -110,7 +110,7 @@ static inline void bw_osc_filt_process(bw_osc_filt_state *BW_RESTRICT state, con * * #### bw_osc_filt_process_multi() * ```>>> */ -static inline void bw_osc_filt_process_multi(bw_osc_filt_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_osc_filt_process_multi(bw_osc_filt_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -152,7 +152,7 @@ static inline void bw_osc_filt_process(bw_osc_filt_state *BW_RESTRICT state, con y[i] = bw_osc_filt_process1(state, x[i]); } -static inline void bw_osc_filt_process_multi(bw_osc_filt_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_osc_filt_process_multi(bw_osc_filt_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { for (size_t i = 0; i < n_channels; i++) bw_osc_filt_process(state[i], x[i], y[i], n_samples); } @@ -195,7 +195,7 @@ public: private: bw_osc_filt_state states[N_CHANNELS]; - bw_osc_filt_state *statesP[N_CHANNELS]; + bw_osc_filt_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_peak.h b/include/bw_peak.h index 509722d..68cfdea 100644 --- a/include/bw_peak.h +++ b/include/bw_peak.h @@ -40,8 +40,8 @@ *
    • bw_peak_process() and * bw_peak_process_multi() now use size_t * to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -152,7 +152,7 @@ static inline void bw_peak_process(bw_peak_coeffs *BW_RESTRICT coeffs, bw_peak_s * * #### bw_peak_process_multi() * ```>>> */ -static inline void bw_peak_process_multi(bw_peak_coeffs *BW_RESTRICT coeffs, bw_peak_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_peak_process_multi(bw_peak_coeffs *BW_RESTRICT coeffs, bw_peak_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -315,7 +315,7 @@ static inline void bw_peak_process(bw_peak_coeffs *BW_RESTRICT coeffs, bw_peak_s } } -static inline void bw_peak_process_multi(bw_peak_coeffs *BW_RESTRICT coeffs, bw_peak_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_peak_process_multi(bw_peak_coeffs *BW_RESTRICT coeffs, bw_peak_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_peak_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_peak_update_coeffs_audio(coeffs); @@ -411,7 +411,7 @@ public: private: bw_peak_coeffs coeffs; bw_peak_state states[N_CHANNELS]; - bw_peak_state *statesP[N_CHANNELS]; + bw_peak_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_phase_gen.h b/include/bw_phase_gen.h index 009eebe..337c0ef 100644 --- a/include/bw_phase_gen.h +++ b/include/bw_phase_gen.h @@ -34,8 +34,8 @@ *
    • bw_phase_gen_process() and * bw_phase_gen_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -165,7 +165,7 @@ static inline void bw_phase_gen_process(bw_phase_gen_coeffs *BW_RESTRICT coeffs, * * #### bw_phase_gen_process_multi() * ```>>> */ -static inline void bw_phase_gen_process_multi(bw_phase_gen_coeffs *BW_RESTRICT coeffs, bw_phase_gen_state * const *BW_RESTRICT state, const float * const *x_mod, float * const *y, float * const *y_phase_inc, size_t n_channels, size_t n_samples); +static inline void bw_phase_gen_process_multi(bw_phase_gen_coeffs *BW_RESTRICT coeffs, bw_phase_gen_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x_mod, float * const *y, float * const *y_phase_inc, size_t n_channels, size_t n_samples); /*! <<<``` * Generates and fills the first `n_samples` of the `n_channels` output * buffers `y`, while using and updating both the common `coeffs` and each of @@ -342,7 +342,7 @@ static inline void bw_phase_gen_process(bw_phase_gen_coeffs *BW_RESTRICT coeffs, } } -static inline void bw_phase_gen_process_multi(bw_phase_gen_coeffs *BW_RESTRICT coeffs, bw_phase_gen_state * const *BW_RESTRICT state, const float * const *x_mod, float * const *y, float * const *y_phase_inc, size_t n_channels, size_t n_samples) { +static inline void bw_phase_gen_process_multi(bw_phase_gen_coeffs *BW_RESTRICT coeffs, bw_phase_gen_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x_mod, float * const *y, float * const *y_phase_inc, size_t n_channels, size_t n_samples) { bw_phase_gen_update_coeffs_ctrl(coeffs); if (y != NULL) { if (x_mod != NULL) { @@ -500,7 +500,7 @@ public: private: bw_phase_gen_coeffs coeffs; bw_phase_gen_state states[N_CHANNELS]; - bw_phase_gen_state *statesP[N_CHANNELS]; + bw_phase_gen_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_phaser.h b/include/bw_phaser.h index 031d88b..58fc8f2 100644 --- a/include/bw_phaser.h +++ b/include/bw_phaser.h @@ -35,8 +35,8 @@ *
    • bw_phaser_process() and * bw_phaser_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -139,7 +139,7 @@ static inline void bw_phaser_process(bw_phaser_coeffs *BW_RESTRICT coeffs, bw_ph * * #### bw_phaser_process_multi() * ```>>> */ -static inline void bw_phaser_process_multi(bw_phaser_coeffs *BW_RESTRICT coeffs, bw_phaser_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_phaser_process_multi(bw_phaser_coeffs *BW_RESTRICT coeffs, bw_phaser_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -263,7 +263,7 @@ static inline void bw_phaser_process(bw_phaser_coeffs *BW_RESTRICT coeffs, bw_ph } } -static inline void bw_phaser_process_multi(bw_phaser_coeffs *BW_RESTRICT coeffs, bw_phaser_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_phaser_process_multi(bw_phaser_coeffs *BW_RESTRICT coeffs, bw_phaser_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_phaser_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_phaser_update_coeffs_audio(coeffs); @@ -328,7 +328,7 @@ public: private: bw_phaser_coeffs coeffs; bw_phaser_state states[N_CHANNELS]; - bw_phaser_state *statesP[N_CHANNELS]; + bw_phaser_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_pink_filt.h b/include/bw_pink_filt.h index 1d88c27..8a90d5d 100644 --- a/include/bw_pink_filt.h +++ b/include/bw_pink_filt.h @@ -39,8 +39,8 @@ *
    • bw_pink_filt_process() and * bw_pink_filt_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -148,7 +148,7 @@ static inline void bw_pink_filt_process(bw_pink_filt_coeffs *BW_RESTRICT coeffs, * * #### bw_pink_filt_process_multi() * ```>>> */ -static inline void bw_pink_filt_process_multi(bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_pink_filt_process_multi(bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -248,7 +248,7 @@ static inline void bw_pink_filt_process(bw_pink_filt_coeffs *BW_RESTRICT coeffs, y[i] = bw_pink_filt_process1(coeffs, state, x[i]); } -static inline void bw_pink_filt_process_multi(bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_pink_filt_process_multi(bw_pink_filt_coeffs *BW_RESTRICT coeffs, bw_pink_filt_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { for (size_t i = 0; i < n_channels; i++) bw_pink_filt_process(coeffs, state[i], x[i], y[i], n_samples); } @@ -305,7 +305,7 @@ public: private: bw_pink_filt_coeffs coeffs; bw_pink_filt_state states[N_CHANNELS]; - bw_pink_filt_state *statesP[N_CHANNELS]; + bw_pink_filt_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_ppm.h b/include/bw_ppm.h index 0d9ec73..cf3f124 100644 --- a/include/bw_ppm.h +++ b/include/bw_ppm.h @@ -35,8 +35,8 @@ *
    • bw_ppm_process() and * bw_ppm_process_multi() now use size_t * to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -144,7 +144,7 @@ static inline void bw_ppm_process(bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_stat * * #### bw_ppm_process_multi() * ```>>> */ -static inline void bw_ppm_process_multi(bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_ppm_process_multi(bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -242,7 +242,7 @@ static inline void bw_ppm_process(bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_stat } } -static inline void bw_ppm_process_multi(bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_ppm_process_multi(bw_ppm_coeffs *BW_RESTRICT coeffs, bw_ppm_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_ppm_update_coeffs_ctrl(coeffs); if (y != NULL) for (size_t i = 0; i < n_samples; i++) { @@ -313,7 +313,7 @@ public: private: bw_ppm_coeffs coeffs; bw_ppm_state states[N_CHANNELS]; - bw_ppm_state *statesP[N_CHANNELS]; + bw_ppm_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_reverb.h b/include/bw_reverb.h index 3b48edf..448b585 100644 --- a/include/bw_reverb.h +++ b/include/bw_reverb.h @@ -42,8 +42,8 @@ *
    • bw_reverb_process() and * bw_reverb_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -107,7 +107,7 @@ static inline size_t bw_reverb_mem_req(const bw_reverb_coeffs *BW_RESTRICT coeff * * #### bw_reverb_mem_set() * ```>>> */ -static inline void bw_reverb_mem_set(const bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state *BW_RESTRICT state, void *mem); +static inline void bw_reverb_mem_set(const bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state *BW_RESTRICT state, void *BW_RESTRICT mem); /*! <<<``` * Associates the contiguous memory block `mem` to the given `state`. * @@ -154,7 +154,7 @@ static inline void bw_reverb_process(bw_reverb_coeffs *BW_RESTRICT coeffs, bw_re * * #### bw_reverb_process_multi() * ```>>> */ -static inline void bw_reverb_process_multi(bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state * const *BW_RESTRICT state, const float * const *x_l, const float * const *x_r, float * const *y_l, float * const *y_r, size_t n_channels, size_t n_samples); +static inline void bw_reverb_process_multi(bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x_l, const float * const *x_r, float * const *y_l, float * const *y_r, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x_l` * (left) and `x_r` (right) and fills the first `n_samples` of the @@ -403,7 +403,7 @@ static inline size_t bw_reverb_mem_req(const bw_reverb_coeffs *BW_RESTRICT coeff + bw_delay_mem_req(&coeffs->delay_d4_coeffs); } -static inline void bw_reverb_mem_set(const bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state *BW_RESTRICT state, void *mem) { +static inline void bw_reverb_mem_set(const bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state *BW_RESTRICT state, void *BW_RESTRICT mem) { char *m = (char *)mem; bw_delay_mem_set(&coeffs->predelay_coeffs, &state->predelay_state, m); m += bw_delay_mem_req(&coeffs->predelay_coeffs); @@ -591,7 +591,7 @@ static inline void bw_reverb_process(bw_reverb_coeffs *BW_RESTRICT coeffs, bw_re } } -static inline void bw_reverb_process_multi(bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state * const *BW_RESTRICT state, const float * const *x_l, const float * const *x_r, float * const *y_l, float * const *y_r, size_t n_channels, size_t n_samples) { +static inline void bw_reverb_process_multi(bw_reverb_coeffs *BW_RESTRICT coeffs, bw_reverb_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x_l, const float * const *x_r, float * const *y_l, float * const *y_r, size_t n_channels, size_t n_samples) { bw_reverb_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_reverb_update_coeffs_audio(coeffs); @@ -671,8 +671,8 @@ public: private: bw_reverb_coeffs coeffs; bw_reverb_state states[N_CHANNELS]; - bw_reverb_state *statesP[N_CHANNELS]; - void *mem; + bw_reverb_state *BW_RESTRICT statesP[N_CHANNELS]; + void *BW_RESTRICT mem; }; template diff --git a/include/bw_satur.h b/include/bw_satur.h index 48c1f31..fadc0d7 100644 --- a/include/bw_satur.h +++ b/include/bw_satur.h @@ -43,8 +43,8 @@ *
    • bw_satur_process() and * bw_satur_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -158,7 +158,7 @@ static inline void bw_satur_process(bw_satur_coeffs *BW_RESTRICT coeffs, bw_satu * * #### bw_satur_process_multi() * ```>>> */ -static inline void bw_satur_process_multi(bw_satur_coeffs *BW_RESTRICT coeffs, bw_satur_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_satur_process_multi(bw_satur_coeffs *BW_RESTRICT coeffs, bw_satur_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -312,7 +312,7 @@ static inline void bw_satur_process(bw_satur_coeffs *BW_RESTRICT coeffs, bw_satu } } -static inline void bw_satur_process_multi(bw_satur_coeffs *BW_RESTRICT coeffs, bw_satur_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_satur_process_multi(bw_satur_coeffs *BW_RESTRICT coeffs, bw_satur_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_satur_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_satur_update_coeffs_audio(coeffs); @@ -377,7 +377,7 @@ public: private: bw_satur_coeffs coeffs; bw_satur_state states[N_CHANNELS]; - bw_satur_state *statesP[N_CHANNELS]; + bw_satur_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_slew_lim.h b/include/bw_slew_lim.h index 0e9fa07..1d012d3 100644 --- a/include/bw_slew_lim.h +++ b/include/bw_slew_lim.h @@ -32,8 +32,8 @@ *
    • bw_slew_lim_process() and * bw_slew_lim_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -157,7 +157,7 @@ static inline void bw_slew_lim_process(bw_slew_lim_coeffs *BW_RESTRICT coeffs, b * * #### bw_slew_lim_process_multi() * ```>>> */ -static inline void bw_slew_lim_process_multi(bw_slew_lim_coeffs *BW_RESTRICT coeffs, bw_slew_lim_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_slew_lim_process_multi(bw_slew_lim_coeffs *BW_RESTRICT coeffs, bw_slew_lim_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -327,7 +327,7 @@ static inline void bw_slew_lim_process(bw_slew_lim_coeffs *BW_RESTRICT coeffs, b } } -static inline void bw_slew_lim_process_multi(bw_slew_lim_coeffs *BW_RESTRICT coeffs, bw_slew_lim_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_slew_lim_process_multi(bw_slew_lim_coeffs *BW_RESTRICT coeffs, bw_slew_lim_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_slew_lim_update_coeffs_ctrl(coeffs); if (y != NULL) { if (coeffs->max_rate_up != INFINITY) { @@ -448,7 +448,7 @@ public: private: bw_slew_lim_coeffs coeffs; bw_slew_lim_state states[N_CHANNELS]; - bw_slew_lim_state *statesP[N_CHANNELS]; + bw_slew_lim_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_sr_reduce.h b/include/bw_sr_reduce.h index 7070f37..a039c0b 100644 --- a/include/bw_sr_reduce.h +++ b/include/bw_sr_reduce.h @@ -36,8 +36,8 @@ *
    • bw_sr_reduce_lim_process() and * bw_sr_reduce_lim_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -120,7 +120,7 @@ static inline void bw_sr_reduce_process(bw_sr_reduce_coeffs *BW_RESTRICT coeffs, * * #### bw_sr_reduce_process_multi() * ```>>> */ -static inline void bw_sr_reduce_process_multi(bw_sr_reduce_coeffs *BW_RESTRICT coeffs, bw_sr_reduce_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_sr_reduce_process_multi(bw_sr_reduce_coeffs *BW_RESTRICT coeffs, bw_sr_reduce_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -186,7 +186,7 @@ static inline void bw_sr_reduce_process(bw_sr_reduce_coeffs *BW_RESTRICT coeffs, y[i] = bw_sr_reduce_process1(coeffs, state, x[i]); } -static inline void bw_sr_reduce_process_multi(bw_sr_reduce_coeffs *BW_RESTRICT coeffs, bw_sr_reduce_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_sr_reduce_process_multi(bw_sr_reduce_coeffs *BW_RESTRICT coeffs, bw_sr_reduce_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { for (size_t i = 0; i < n_channels; i++) bw_sr_reduce_process(coeffs, state[i], x[i], y[i], n_samples); } @@ -236,7 +236,7 @@ public: private: bw_sr_reduce_coeffs coeffs; bw_sr_reduce_state states[N_CHANNELS]; - bw_sr_reduce_state *statesP[N_CHANNELS]; + bw_sr_reduce_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_src.h b/include/bw_src.h index f26c7d6..c00a4d4 100644 --- a/include/bw_src.h +++ b/include/bw_src.h @@ -32,8 +32,8 @@ *
    • bw_src_process() and * bw_src_process_multi() now use size_t * to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header and fixed C++ API.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -102,7 +102,7 @@ static inline void bw_src_reset_state(const bw_src_coeffs *BW_RESTRICT coeffs, b * * #### bw_src_process() * ```>>> */ -static inline void bw_src_process(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state *BW_RESTRICT state, const float *x, float *y, size_t *n_in_samples, size_t *n_out_samples); +static inline void bw_src_process(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state *BW_RESTRICT state, const float *x, float *y, size_t *BW_RESTRICT n_in_samples, size_t *BW_RESTRICT n_out_samples); /*! <<<``` * Processes at most the first `n_in_samples` of the input buffer `x` and * fills the output buffer `y` with at most `n_out_samples` using `coeffs`, @@ -114,7 +114,7 @@ static inline void bw_src_process(const bw_src_coeffs *BW_RESTRICT coeffs, bw_sr * * #### bw_src_process_multi() * ```>>> */ -static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t *n_in_samples, size_t *n_out_samples); +static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t *BW_RESTRICT n_in_samples, size_t *BW_RESTRICT n_out_samples); /*! <<<``` * Processes at most the first `n_in_samples[i]` of each input buffer `x[i]` * and fills the corresponding output buffer `y[i]` with at most @@ -200,7 +200,7 @@ static inline void bw_src_reset_state(const bw_src_coeffs *BW_RESTRICT coeffs, b state->xz3 = x_0; } -static inline void bw_src_process(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state *BW_RESTRICT state, const float *x, float *y, size_t *n_in_samples, size_t *n_out_samples) { +static inline void bw_src_process(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state *BW_RESTRICT state, const float *x, float *y, size_t *BW_RESTRICT n_in_samples, size_t *BW_RESTRICT n_out_samples) { size_t i = 0; size_t j = 0; if (coeffs->k < 0) { @@ -267,7 +267,7 @@ static inline void bw_src_process(const bw_src_coeffs *BW_RESTRICT coeffs, bw_sr *n_out_samples = j; } -static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t *n_in_samples, size_t *n_out_samples) { +static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs, bw_src_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t *BW_RESTRICT n_in_samples, size_t *BW_RESTRICT n_out_samples) { for (size_t i = 0; i < n_channels; i++) bw_src_process(coeffs, state[i], x[i], y[i], n_in_samples + i, n_out_samples + i); } @@ -293,8 +293,8 @@ public: void process( const float * const *x, float * const *y, - size_t *nInSamples, - size_t *nOutSamples); + size_t *BW_RESTRICT nInSamples, + size_t *BW_RESTRICT nOutSamples); void process( std::array x, std::array y, @@ -313,7 +313,7 @@ public: private: bw_src_coeffs coeffs; bw_src_state states[N_CHANNELS]; - bw_src_state *statesP[N_CHANNELS]; + bw_src_state *BW_RESTRICT statesP[N_CHANNELS]; }; template @@ -333,8 +333,8 @@ template inline void SRC::process( const float * const *x, float * const *y, - size_t *nInSamples, - size_t *nOutSamples) { + size_t *BW_RESTRICT nInSamples, + size_t *BW_RESTRICT nOutSamples) { bw_src_process_multi(coeffs, statesP, x, y, N_CHANNELS, nInSamples, nOutSamples); } diff --git a/include/bw_src_int.h b/include/bw_src_int.h index 50ec5b1..07ac567 100644 --- a/include/bw_src_int.h +++ b/include/bw_src_int.h @@ -38,8 +38,8 @@ *
    • bw_src_int_lim_process() and * bw_src_int_lim_process_multi() now use * size_t to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -122,7 +122,7 @@ static inline size_t bw_src_int_process(const bw_src_int_coeffs *BW_RESTRICT coe * * #### bw_src_int_process_multi() * ```>>> */ -static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT coeffs, bw_src_int_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t *n, size_t n_channels, size_t n_in_samples); +static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT coeffs, bw_src_int_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t *BW_RESTRICT n, size_t n_channels, size_t n_in_samples); /*! <<<``` * Processes the first `n_in_samples` of the `n_channels` input buffers `x` * and fills the `n_channels` output buffers `y` using `coeffs`, while using @@ -240,7 +240,7 @@ static inline size_t bw_src_int_process(const bw_src_int_coeffs *BW_RESTRICT coe return n; } -static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT coeffs, bw_src_int_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t *n, size_t n_channels, size_t n_in_samples) { +static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT coeffs, bw_src_int_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t *BW_RESTRICT n, size_t n_channels, size_t n_in_samples) { if (n != NULL) for (size_t i = 0; i < n_channels; i++) n[i] = bw_src_int_process(coeffs, state[i], x[i], y[i], n_in_samples); @@ -288,7 +288,7 @@ public: private: bw_src_int_coeffs coeffs; bw_src_int_state states[N_CHANNELS]; - bw_src_int_state *statesP[N_CHANNELS]; + bw_src_int_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_svf.h b/include/bw_svf.h index e3e958a..d57911c 100644 --- a/include/bw_svf.h +++ b/include/bw_svf.h @@ -33,8 +33,8 @@ *
    • bw_svf_process() and * bw_svf_process_multi() now use size_t * to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -164,7 +164,7 @@ static inline void bw_svf_process(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_stat * * #### bw_svf_process_multi() * ```>>> */ -static inline void bw_svf_process_multi(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state * const *BW_RESTRICT state, const float * const *x, float * const *y_lp, float * const *y_bp, float * const *y_hp, size_t n_channels, size_t n_samples); +static inline void bw_svf_process_multi(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y_lp, float * const *y_bp, float * const *y_hp, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y_lp` @@ -404,7 +404,7 @@ static inline void bw_svf_process(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_stat } } -static inline void bw_svf_process_multi(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state * const *BW_RESTRICT state, const float * const *x, float * const *y_lp, float * const *y_bp, float * const *y_hp, size_t n_channels, size_t n_samples) { +static inline void bw_svf_process_multi(bw_svf_coeffs *BW_RESTRICT coeffs, bw_svf_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y_lp, float * const *y_bp, float * const *y_hp, size_t n_channels, size_t n_samples) { if (y_lp != NULL) { if (y_bp != NULL) { if (y_hp != NULL) { @@ -573,7 +573,7 @@ public: private: bw_svf_coeffs coeffs; bw_svf_state states[N_CHANNELS]; - bw_svf_state *statesP[N_CHANNELS]; + bw_svf_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_trem.h b/include/bw_trem.h index 903cd3b..01405ab 100644 --- a/include/bw_trem.h +++ b/include/bw_trem.h @@ -34,8 +34,8 @@ *
    • bw_trem_process() and * bw_trem_process_multi() now use size_t * to count samples and channels.
    • - *
    • Added more const specifiers to input - * arguments.
    • + *
    • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
    • *
    • Moved C++ code to C header.
    • *
    • Added overladed C++ process() function taking * C-style arrays as arguments.
    • @@ -137,7 +137,7 @@ static inline void bw_trem_process(bw_trem_coeffs *BW_RESTRICT coeffs, bw_trem_s * * #### bw_trem_process_multi() * ```>>> */ -static inline void bw_trem_process_multi(bw_trem_coeffs *BW_RESTRICT coeffs, bw_trem_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_trem_process_multi(bw_trem_coeffs *BW_RESTRICT coeffs, bw_trem_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -233,7 +233,7 @@ static inline void bw_trem_process(bw_trem_coeffs *BW_RESTRICT coeffs, bw_trem_s } } -static inline void bw_trem_process_multi(bw_trem_coeffs *BW_RESTRICT coeffs, bw_trem_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_trem_process_multi(bw_trem_coeffs *BW_RESTRICT coeffs, bw_trem_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_trem_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_trem_update_coeffs_audio(coeffs); @@ -292,8 +292,8 @@ public: private: bw_trem_coeffs coeffs; - bw_trem_state states[N_CHANNELS]; - bw_trem_state *statesP[N_CHANNELS]; + bw_trem_state states[N_CHANNELS]; + bw_trem_state *BW_RESTRICT statesP[N_CHANNELS]; }; template diff --git a/include/bw_voice_alloc.h b/include/bw_voice_alloc.h index 56f1a1c..d97f20e 100644 --- a/include/bw_voice_alloc.h +++ b/include/bw_voice_alloc.h @@ -31,7 +31,8 @@ *
        *
      • Now using size_t instead of * BW_SIZE_T.
      • - *
      • Added const where needed to callback types in + *
      • Added const and BW_RESTRICT where + * needed to callback types in * bw_voice_alloc_opts and to * bw_voice_alloc().
      • *
      • Removed usage of reserved identifiers.
      • @@ -103,7 +104,7 @@ typedef struct { * * #### bw_voice_alloc() * ```>>> */ -void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue *BW_RESTRICT queue, void * const *BW_RESTRICT voices, size_t n_voices); +void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue *BW_RESTRICT queue, void *BW_RESTRICT const *BW_RESTRICT voices, size_t n_voices); /*! <<<``` * It performs voice allocation according to `opts` and using the events in * `queue`. @@ -125,7 +126,7 @@ void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue * extern "C" { #endif -void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue *BW_RESTRICT queue, void * const *BW_RESTRICT voices, size_t n_voices) { +void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue *BW_RESTRICT queue, void *BW_RESTRICT const *BW_RESTRICT voices, size_t n_voices) { BW_ASSERT(opts != NULL); BW_ASSERT(opts->priority == bw_voice_alloc_priority_low || opts->priority == bw_voice_alloc_priority_high); BW_ASSERT(n_voices == 0 || opts->note_on != NULL); diff --git a/include/bw_wah.h b/include/bw_wah.h index 6a7afc5..ee06e95 100644 --- a/include/bw_wah.h +++ b/include/bw_wah.h @@ -34,8 +34,8 @@ *
      • bw_wah_process() and * bw_wah_process_multi() now use size_t * to count samples and channels.
      • - *
      • Added more const specifiers to input - * arguments.
      • + *
      • Added more const and BW_RESTRICT + * specifiers to input arguments and implementation.
      • *
      • Moved C++ code to C header.
      • *
      • Added overladed C++ process() function taking * C-style arrays as arguments.
      • @@ -151,7 +151,7 @@ static inline void bw_wah_process(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_stat * * #### bw_wah_process_multi() * ```>>> */ -static inline void bw_wah_process_multi(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); +static inline void bw_wah_process_multi(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples); /*! <<<``` * Processes the first `n_samples` of the `n_channels` input buffers `x` and * fills the first `n_samples` of the `n_channels` output buffers `y`, while @@ -233,7 +233,7 @@ static inline void bw_wah_process(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_stat } } -static inline void bw_wah_process_multi(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state * const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { +static inline void bw_wah_process_multi(bw_wah_coeffs *BW_RESTRICT coeffs, bw_wah_state *BW_RESTRICT const *BW_RESTRICT state, const float * const *x, float * const *y, size_t n_channels, size_t n_samples) { bw_wah_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { bw_wah_update_coeffs_audio(coeffs); @@ -288,7 +288,7 @@ public: private: bw_wah_coeffs coeffs; bw_wah_state states[N_CHANNELS]; - bw_wah_state *statesP[N_CHANNELS]; + bw_wah_state *BW_RESTRICT statesP[N_CHANNELS]; }; template