From 48275d077d8b501a488cbeb81220949f8a8d9f90 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Sat, 12 Aug 2023 10:15:04 +0200 Subject: [PATCH] improved bw_one_pole + removed bwpp_one_pole + c++ reshuffling --- .../src/bw_example_fxpp_one_pole.h | 2 +- include/bw_ap1.h | 12 +- include/bw_ap2.h | 12 +- include/bw_balance.h | 12 +- include/bw_bd_reduce.h | 12 +- include/bw_buf.h | 217 +++++++------- include/bw_chorus.h | 12 +- include/bw_clip.h | 12 +- include/bw_comb.h | 12 +- include/bw_common.h | 2 + include/bw_comp.h | 12 +- include/bw_delay.h | 12 +- include/bw_dist.h | 12 +- include/bw_drive.h | 12 +- include/bw_drywet.h | 12 +- include/bw_env_follow.h | 12 +- include/bw_env_gen.h | 12 +- include/bw_fuzz.h | 12 +- include/bw_gain.h | 12 +- include/bw_hp1.h | 12 +- include/bw_hs1.h | 12 +- include/bw_hs2.h | 12 +- include/bw_lp1.h | 12 +- include/bw_ls1.h | 12 +- include/bw_ls2.h | 12 +- include/bw_math.h | 2 + include/bw_mm1.h | 12 +- include/bw_mm2.h | 12 +- include/bw_noise_gate.h | 12 +- include/bw_noise_gen.h | 10 +- include/bw_notch.h | 12 +- include/bw_note_queue.h | 43 +-- include/bw_one_pole.h | 281 ++++++++++++++---- include/bw_osc_filt.h | 12 +- include/bw_osc_pulse.h | 12 +- include/bw_osc_saw.h | 12 +- include/bw_osc_sin.h | 12 +- include/bw_osc_tri.h | 12 +- include/bw_pan.h | 12 +- include/bw_peak.h | 12 +- include/bw_phase_gen.h | 12 +- include/bw_phaser.h | 12 +- include/bw_pink_filt.h | 12 +- include/bw_ppm.h | 12 +- include/bw_rand.h | 2 + include/bw_reverb.h | 12 +- include/bw_ringmod.h | 12 +- include/bw_satur.h | 12 +- include/bw_slew_lim.h | 12 +- include/bw_sr_reduce.h | 12 +- include/bw_src.h | 12 +- include/bw_src_int.h | 12 +- include/bw_svf.h | 12 +- include/bw_trem.h | 12 +- include/bw_voice_alloc.h | 14 +- include/bw_wah.h | 12 +- include/bwpp_one_pole.h | 144 --------- 57 files changed, 848 insertions(+), 433 deletions(-) delete mode 100644 include/bwpp_one_pole.h diff --git a/examples/fxpp_one_pole/src/bw_example_fxpp_one_pole.h b/examples/fxpp_one_pole/src/bw_example_fxpp_one_pole.h index 882d370..72faf95 100644 --- a/examples/fxpp_one_pole/src/bw_example_fxpp_one_pole.h +++ b/examples/fxpp_one_pole/src/bw_example_fxpp_one_pole.h @@ -23,7 +23,7 @@ #include "platform.h" -#include +#include using namespace Brickworks; diff --git a/include/bw_ap1.h b/include/bw_ap1.h index 4d5eb39..8951f7c 100644 --- a/include/bw_ap1.h +++ b/include/bw_ap1.h @@ -63,12 +63,12 @@ #ifndef _BW_AP1_H #define _BW_AP1_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_ap1_coeffs * ```>>> */ @@ -152,6 +152,10 @@ static inline void bw_ap1_set_cutoff(bw_ap1_coeffs *BW_RESTRICT coeffs, float va * Default value: `1e3f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -159,6 +163,10 @@ static inline void bw_ap1_set_cutoff(bw_ap1_coeffs *BW_RESTRICT coeffs, float va #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_ap1_coeffs { // Sub-components bw_lp1_coeffs lp1_coeffs; diff --git a/include/bw_ap2.h b/include/bw_ap2.h index 693eeea..83e5306 100644 --- a/include/bw_ap2.h +++ b/include/bw_ap2.h @@ -63,12 +63,12 @@ #ifndef _BW_AP2_H #define _BW_AP2_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_ap2_coeffs * ```>>> */ @@ -162,6 +162,10 @@ static inline void bw_ap2_set_Q(bw_ap2_coeffs *BW_RESTRICT coeffs, float value); * Default value: `0.5f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -169,6 +173,10 @@ static inline void bw_ap2_set_Q(bw_ap2_coeffs *BW_RESTRICT coeffs, float value); #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_ap2_coeffs { // Sub-components bw_svf_coeffs svf_coeffs; diff --git a/include/bw_balance.h b/include/bw_balance.h index 9c3cb42..cc98d3c 100644 --- a/include/bw_balance.h +++ b/include/bw_balance.h @@ -59,12 +59,12 @@ #ifndef _BW_BALANCE_H #define _BW_BALANCE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_balance_coeffs * ```>>> */ @@ -138,6 +138,10 @@ static inline void bw_balance_set_balance(bw_balance_coeffs *BW_RESTRICT coeffs, * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -146,6 +150,10 @@ static inline void bw_balance_set_balance(bw_balance_coeffs *BW_RESTRICT coeffs, #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_balance_coeffs { // Sub-components bw_gain_coeffs l_coeffs; diff --git a/include/bw_bd_reduce.h b/include/bw_bd_reduce.h index 568375a..8d38676 100644 --- a/include/bw_bd_reduce.h +++ b/include/bw_bd_reduce.h @@ -65,12 +65,12 @@ #ifndef _BW_BD_REDUCE_H #define _BW_BD_REDUCE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_bd_reduce_coeffs * ```>>> */ @@ -134,6 +134,10 @@ static inline void bw_bd_reduce_set_bit_depth(bw_bd_reduce_coeffs *BW_RESTRICT c * Default value: `16`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -141,6 +145,10 @@ static inline void bw_bd_reduce_set_bit_depth(bw_bd_reduce_coeffs *BW_RESTRICT c #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_bd_reduce_coeffs { // Coefficients float ki; diff --git a/include/bw_buf.h b/include/bw_buf.h index 7da174b..d09fb4c 100644 --- a/include/bw_buf.h +++ b/include/bw_buf.h @@ -77,6 +77,8 @@ extern "C" { #endif +/*** Public API ***/ + /*! api {{{ * #### bw_buf_fill() * ```>>> */ @@ -169,112 +171,6 @@ static inline void bw_buf_mul_multi(const float * const *src1, const float * con #ifdef __cplusplus } - -#include - -namespace Brickworks { - -/*! api_cpp {{{ - * ##### Brickworks::bufFill - * ```>>> */ -template -inline void bufFill( - float k, - float ** dest, - int nSamples); - -template -inline void bufFill( - float k, - std::array dest, - int nSamples); -/*! <<<``` - * - * ##### Brickworks::bufNeg - * ```>>> */ -template -inline void bufNeg( - const float * const *src, - float **dest, - int nSamples); - -template -inline void bufNeg( - std::array src, - std::array dest, - int nSamples); -/*! <<<``` - * - * ##### Brickworks::bufAdd - * ```>>> */ -template -inline void bufAdd( - const float * const *src, - float **dest, - float k, - int nSamples); - -template -inline void bufAdd( - std::array src, - std::array dest, - float k, - int nSamples); -/*! <<<``` - * - * ##### Brickworks::bufScale - * ```>>> */ -template -inline void bufScale( - const float * const *src, - float k, - float **dest, - int nSamples); - -template -inline void bufScale( - std::array src, - std::array dest, - float k, - int nSamples); -/*! <<<``` - * - * ##### Brickworks::bufMix - * ```>>> */ -template -inline void bufMix( - const float * const *src1, - const float * const *src2, - float **dest, - int nSamples); - -template -inline void bufMix( - std::array src1, - std::array src2, - std::array dest, - int nSamples); -/*! <<<``` - * - * ##### Brickworks::bufMul - * ```>>> */ -template -inline void bufMul( - const float * const *src1, - const float * const *src2, - float **dest, - int nSamples); - -template -inline void bufMul( - std::array src1, - std::array src2, - std::array dest, - int nSamples); -/*! <<<``` - * }}} */ - -} #endif /*** Implementation ***/ @@ -395,8 +291,117 @@ static inline void bw_buf_mul_multi(const float * const *src1, const float * con #ifdef __cplusplus } +#include + namespace Brickworks { +/*** Public C++ API ***/ + +/*! api_cpp {{{ + * ##### Brickworks::bufFill + * ```>>> */ +template +inline void bufFill( + float k, + float ** dest, + int nSamples); + +template +inline void bufFill( + float k, + std::array dest, + int nSamples); +/*! <<<``` + * + * ##### Brickworks::bufNeg + * ```>>> */ +template +inline void bufNeg( + const float * const *src, + float **dest, + int nSamples); + +template +inline void bufNeg( + std::array src, + std::array dest, + int nSamples); +/*! <<<``` + * + * ##### Brickworks::bufAdd + * ```>>> */ +template +inline void bufAdd( + const float * const *src, + float **dest, + float k, + int nSamples); + +template +inline void bufAdd( + std::array src, + std::array dest, + float k, + int nSamples); +/*! <<<``` + * + * ##### Brickworks::bufScale + * ```>>> */ +template +inline void bufScale( + const float * const *src, + float k, + float **dest, + int nSamples); + +template +inline void bufScale( + std::array src, + std::array dest, + float k, + int nSamples); +/*! <<<``` + * + * ##### Brickworks::bufMix + * ```>>> */ +template +inline void bufMix( + const float * const *src1, + const float * const *src2, + float **dest, + int nSamples); + +template +inline void bufMix( + std::array src1, + std::array src2, + std::array dest, + int nSamples); +/*! <<<``` + * + * ##### Brickworks::bufMul + * ```>>> */ +template +inline void bufMul( + const float * const *src1, + const float * const *src2, + float **dest, + int nSamples); + +template +inline void bufMul( + std::array src1, + std::array src2, + std::array dest, + int nSamples); +/*! <<<``` + * }}} */ + +/*** Implementation ***/ + +/* WARNING: This part of the file is not part of the public API. Its content may + * change at any time in future versions. Please, do not use it directly. */ + template inline void bufFill( float k, diff --git a/include/bw_chorus.h b/include/bw_chorus.h index a9aff37..19c23b7 100644 --- a/include/bw_chorus.h +++ b/include/bw_chorus.h @@ -67,12 +67,12 @@ #ifndef _BW_CHORUS_H #define _BW_CHORUS_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_chorus_coeffs * ```>>> */ @@ -209,6 +209,10 @@ static inline void bw_chorus_set_coeff_fb(bw_chorus_coeffs *BW_RESTRICT coeffs, * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -218,6 +222,10 @@ static inline void bw_chorus_set_coeff_fb(bw_chorus_coeffs *BW_RESTRICT coeffs, #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_chorus_coeffs { // Sub-components bw_phase_gen_coeffs phase_gen_coeffs; diff --git a/include/bw_clip.h b/include/bw_clip.h index 8762c16..7b50294 100644 --- a/include/bw_clip.h +++ b/include/bw_clip.h @@ -61,12 +61,12 @@ #ifndef _BW_CLIP_H #define _BW_CLIP_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_clip_coeffs * ```>>> */ @@ -173,6 +173,10 @@ static inline void bw_clip_set_gain_compensation(bw_clip_coeffs *BW_RESTRICT coe * Default value: `1` (on). * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -181,6 +185,10 @@ static inline void bw_clip_set_gain_compensation(bw_clip_coeffs *BW_RESTRICT coe #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_clip_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_comb.h b/include/bw_comb.h index 094ec91..8b19fdb 100644 --- a/include/bw_comb.h +++ b/include/bw_comb.h @@ -68,12 +68,12 @@ #ifndef _BW_COMB_H #define _BW_COMB_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_comb_coeffs * ```>>> */ @@ -202,6 +202,10 @@ static inline void bw_comb_set_coeff_fb(bw_comb_coeffs *BW_RESTRICT coeffs, floa * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -212,6 +216,10 @@ static inline void bw_comb_set_coeff_fb(bw_comb_coeffs *BW_RESTRICT coeffs, floa #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_comb_coeffs { // Sub-components bw_delay_coeffs delay_coeffs; diff --git a/include/bw_common.h b/include/bw_common.h index 12b41f2..5158495 100644 --- a/include/bw_common.h +++ b/include/bw_common.h @@ -81,6 +81,8 @@ #ifndef BW_COMMON_H #define BW_COMMON_H +/*** Public API ***/ + /*! api {{{ * * #### Basic definitions diff --git a/include/bw_comp.h b/include/bw_comp.h index 6385b91..a05f865 100644 --- a/include/bw_comp.h +++ b/include/bw_comp.h @@ -60,12 +60,12 @@ #ifndef _BW_COMP_H #define _BW_COMP_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_comp_coeffs * ```>>> */ @@ -204,6 +204,10 @@ static inline void bw_comp_set_gain_dB(bw_comp_coeffs *BW_RESTRICT coeffs, float * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -214,6 +218,10 @@ static inline void bw_comp_set_gain_dB(bw_comp_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_comp_coeffs { // Sub-components bw_env_follow_coeffs env_follow_coeffs; diff --git a/include/bw_delay.h b/include/bw_delay.h index cc4baef..e088440 100644 --- a/include/bw_delay.h +++ b/include/bw_delay.h @@ -61,12 +61,12 @@ #ifndef _BW_DELAY_H #define _BW_DELAY_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_delay_coeffs * ```>>> */ @@ -186,6 +186,10 @@ static inline size_t bw_delay_get_length(const bw_delay_coeffs *BW_RESTRICT coef * Returns the length of the delay line in samples. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -194,6 +198,10 @@ static inline size_t bw_delay_get_length(const bw_delay_coeffs *BW_RESTRICT coef #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_delay_coeffs { // Coefficients float fs; diff --git a/include/bw_dist.h b/include/bw_dist.h index 45f25ba..2b620df 100644 --- a/include/bw_dist.h +++ b/include/bw_dist.h @@ -55,12 +55,12 @@ #ifndef _BW_DIST_H #define _BW_DIST_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_dist_coeffs * ```>>> */ @@ -161,6 +161,10 @@ static inline void bw_dist_set_volume(bw_dist_coeffs *BW_RESTRICT coeffs, float * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -173,6 +177,10 @@ static inline void bw_dist_set_volume(bw_dist_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_dist_coeffs { // Sub-components bw_hp1_coeffs hp1_coeffs; diff --git a/include/bw_drive.h b/include/bw_drive.h index d7bfa5d..7312e6d 100644 --- a/include/bw_drive.h +++ b/include/bw_drive.h @@ -54,12 +54,12 @@ #ifndef _BW_DRIVE_H #define _BW_DRIVE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_drive_coeffs * ```>>> */ @@ -160,6 +160,10 @@ static inline void bw_drive_set_volume(bw_drive_coeffs *BW_RESTRICT coeffs, floa * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -170,6 +174,10 @@ static inline void bw_drive_set_volume(bw_drive_coeffs *BW_RESTRICT coeffs, floa #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_drive_coeffs { // Sub-components bw_svf_coeffs hp2_coeffs; diff --git a/include/bw_drywet.h b/include/bw_drywet.h index 69d5ebe..f0b4e05 100644 --- a/include/bw_drywet.h +++ b/include/bw_drywet.h @@ -50,12 +50,12 @@ #ifndef _BW_DRYWET_H #define _BW_DRYWET_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_drywet_coeffs * ```>>> */ @@ -134,6 +134,10 @@ static inline void bw_drywet_set_smooth_tau(bw_drywet_coeffs *BW_RESTRICT coeffs * Default value: `0.05f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -141,6 +145,10 @@ static inline void bw_drywet_set_smooth_tau(bw_drywet_coeffs *BW_RESTRICT coeffs #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_drywet_coeffs { // Sub-components bw_gain_coeffs gain_coeffs; diff --git a/include/bw_env_follow.h b/include/bw_env_follow.h index e71e638..7bea373 100644 --- a/include/bw_env_follow.h +++ b/include/bw_env_follow.h @@ -67,12 +67,12 @@ #ifndef _BW_ENV_FOLLOW_H #define _BW_ENV_FOLLOW_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_env_follow_coeffs * ```>>> */ @@ -174,6 +174,10 @@ static inline float bw_env_follow_get_y_z1(const bw_env_follow_state *BW_RESTRIC /*! <<<``` * Returns the last output sample as stored in `state`. * }}} */ + +#ifdef __cplusplus +} +#endif /*** Implementation ***/ @@ -183,6 +187,10 @@ static inline float bw_env_follow_get_y_z1(const bw_env_follow_state *BW_RESTRIC #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_env_follow_coeffs { // Sub-components bw_one_pole_coeffs one_pole_coeffs; diff --git a/include/bw_env_gen.h b/include/bw_env_gen.h index 81b9192..b649c75 100644 --- a/include/bw_env_gen.h +++ b/include/bw_env_gen.h @@ -89,12 +89,12 @@ #ifndef _BW_ENV_GEN_H #define _BW_ENV_GEN_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_env_gen_coeffs * ```>>> */ @@ -247,6 +247,10 @@ static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *state); * Returns the last output sample as stored in `state`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -255,6 +259,10 @@ static inline float bw_env_gen_get_y_z1(const bw_env_gen_state *state); #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_env_gen_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_fuzz.h b/include/bw_fuzz.h index ff4cc10..19d152e 100644 --- a/include/bw_fuzz.h +++ b/include/bw_fuzz.h @@ -55,12 +55,12 @@ #ifndef _BW_FUZZ_H #define _BW_FUZZ_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_fuzz_coeffs * ```>>> */ @@ -153,6 +153,10 @@ static inline void bw_fuzz_set_volume(bw_fuzz_coeffs *BW_RESTRICT coeffs, float * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -164,6 +168,10 @@ static inline void bw_fuzz_set_volume(bw_fuzz_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_fuzz_coeffs { // Sub-components bw_svf_coeffs svf_coeffs; diff --git a/include/bw_gain.h b/include/bw_gain.h index 14868f7..aba0764 100644 --- a/include/bw_gain.h +++ b/include/bw_gain.h @@ -70,12 +70,12 @@ #ifndef _BW_GAIN_H #define _BW_GAIN_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_gain_coeffs * ```>>> */ @@ -167,6 +167,10 @@ static inline float bw_gain_get_gain(const bw_gain_coeffs *BW_RESTRICT coeffs); * Returns the actual current gain coefficient (linear gain) in `coeffs`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -175,6 +179,10 @@ static inline float bw_gain_get_gain(const bw_gain_coeffs *BW_RESTRICT coeffs); #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_gain_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_hp1.h b/include/bw_hp1.h index e9416a3..4aa68b8 100644 --- a/include/bw_hp1.h +++ b/include/bw_hp1.h @@ -63,12 +63,12 @@ #ifndef _BW_HP1_H #define _BW_HP1_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_hp1_coeffs * ```>>> */ @@ -152,6 +152,10 @@ static inline void bw_hp1_set_cutoff(bw_hp1_coeffs *BW_RESTRICT coeffs, float va * Default value: `1e3f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -159,6 +163,10 @@ static inline void bw_hp1_set_cutoff(bw_hp1_coeffs *BW_RESTRICT coeffs, float va #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_hp1_coeffs { // Sub-components bw_lp1_coeffs lp1_coeffs; diff --git a/include/bw_hs1.h b/include/bw_hs1.h index 5e102ac..025917d 100644 --- a/include/bw_hs1.h +++ b/include/bw_hs1.h @@ -62,12 +62,12 @@ #ifndef _BW_HS1_H #define _BW_HS1_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_hs1_coeffs * ```>>> */ @@ -170,6 +170,10 @@ static inline void bw_hs1_set_high_gain_dB(bw_hs1_coeffs *BW_RESTRICT coeffs, fl * * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -178,6 +182,10 @@ static inline void bw_hs1_set_high_gain_dB(bw_hs1_coeffs *BW_RESTRICT coeffs, fl #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_hs1_coeffs { // Sub-components bw_mm1_coeffs mm1_coeffs; diff --git a/include/bw_hs2.h b/include/bw_hs2.h index fcf9e3f..99a2568 100644 --- a/include/bw_hs2.h +++ b/include/bw_hs2.h @@ -62,12 +62,12 @@ #ifndef _BW_HS2_H #define _BW_HS2_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_hs2_coeffs * ```>>> */ @@ -179,6 +179,10 @@ static inline void bw_hs2_set_high_gain_dB(bw_hs2_coeffs *BW_RESTRICT coeffs, fl * Default value: `-INFINITY`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -187,6 +191,10 @@ static inline void bw_hs2_set_high_gain_dB(bw_hs2_coeffs *BW_RESTRICT coeffs, fl #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_hs2_coeffs { // Sub-components bw_mm2_coeffs mm2_coeffs; diff --git a/include/bw_lp1.h b/include/bw_lp1.h index 9c0e310..c6b4e1f 100644 --- a/include/bw_lp1.h +++ b/include/bw_lp1.h @@ -66,12 +66,12 @@ #ifndef _BW_LP1_H #define _BW_LP1_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_lp1_coeffs * ```>>> */ @@ -174,6 +174,10 @@ static inline void bw_lp1_set_prewarp_freq(bw_lp1_coeffs *BW_RESTRICT coeffs, fl * Default value: `1e3f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -182,6 +186,10 @@ static inline void bw_lp1_set_prewarp_freq(bw_lp1_coeffs *BW_RESTRICT coeffs, fl #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_lp1_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_ls1.h b/include/bw_ls1.h index c2f8b0f..8ee93fb 100644 --- a/include/bw_ls1.h +++ b/include/bw_ls1.h @@ -63,12 +63,12 @@ #ifndef _BW_LS1_H #define _BW_LS1_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_ls1_coeffs * ```>>> */ @@ -168,6 +168,10 @@ static inline void bw_ls1_set_dc_gain_dB(bw_ls1_coeffs *BW_RESTRICT coeffs, floa * Default value: `-INFINITY`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -176,6 +180,10 @@ static inline void bw_ls1_set_dc_gain_dB(bw_ls1_coeffs *BW_RESTRICT coeffs, floa #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_ls1_coeffs { // Sub-components bw_mm1_coeffs mm1_coeffs; diff --git a/include/bw_ls2.h b/include/bw_ls2.h index 1c49794..0171460 100644 --- a/include/bw_ls2.h +++ b/include/bw_ls2.h @@ -63,12 +63,12 @@ #ifndef _BW_LS2_H #define _BW_LS2_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_ls2_coeffs * ```>>> */ @@ -178,6 +178,10 @@ static inline void bw_ls2_set_dc_gain_dB(bw_ls2_coeffs *BW_RESTRICT coeffs, floa * Default value: `-INFINITY`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -186,6 +190,10 @@ static inline void bw_ls2_set_dc_gain_dB(bw_ls2_coeffs *BW_RESTRICT coeffs, floa #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_ls2_coeffs { // Sub-components bw_mm2_coeffs mm2_coeffs; diff --git a/include/bw_math.h b/include/bw_math.h index fc9aa43..c3fb94b 100644 --- a/include/bw_math.h +++ b/include/bw_math.h @@ -117,6 +117,8 @@ extern "C" { #endif +/*** Public API ***/ + /*! api {{{ * #### bw_signfilli32() * ```>>> */ diff --git a/include/bw_mm1.h b/include/bw_mm1.h index c1fdb09..bd7069a 100644 --- a/include/bw_mm1.h +++ b/include/bw_mm1.h @@ -62,12 +62,12 @@ #ifndef _BW_MM1_H #define _BW_MM1_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_mm1_coeffs * ```>>> */ @@ -186,6 +186,10 @@ static inline void bw_mm1_set_coeff_lp(bw_mm1_coeffs *BW_RESTRICT coeffs, float * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -194,6 +198,10 @@ static inline void bw_mm1_set_coeff_lp(bw_mm1_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_mm1_coeffs { // Sub-components bw_lp1_coeffs lp1_coeffs; diff --git a/include/bw_mm2.h b/include/bw_mm2.h index cc2aa9e..41c6f8e 100644 --- a/include/bw_mm2.h +++ b/include/bw_mm2.h @@ -62,12 +62,12 @@ #ifndef _BW_MM2_H #define _BW_MM2_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_mm2_coeffs * ```>>> */ @@ -212,6 +212,10 @@ static inline void bw_mm2_set_coeff_hp(bw_mm2_coeffs *BW_RESTRICT coeffs, float * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -220,6 +224,10 @@ static inline void bw_mm2_set_coeff_hp(bw_mm2_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_mm2_coeffs { // Sub-components bw_svf_coeffs svf_coeffs; diff --git a/include/bw_noise_gate.h b/include/bw_noise_gate.h index c82337c..ddce819 100644 --- a/include/bw_noise_gate.h +++ b/include/bw_noise_gate.h @@ -56,12 +56,12 @@ #ifndef _BW_NOISE_GATE_H #define _BW_NOISE_GATE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_noise_gate_coeffs * ```>>> */ @@ -184,6 +184,10 @@ static inline void bw_noise_gate_set_release_tau(bw_noise_gate_coeffs *BW_RESTRI * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -193,6 +197,10 @@ static inline void bw_noise_gate_set_release_tau(bw_noise_gate_coeffs *BW_RESTRI #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_noise_gate_coeffs { // Sub-noise_gateonents bw_env_follow_coeffs env_follow_coeffs; diff --git a/include/bw_noise_gen.h b/include/bw_noise_gen.h index 08c6d13..e707e0d 100644 --- a/include/bw_noise_gen.h +++ b/include/bw_noise_gen.h @@ -137,6 +137,10 @@ static inline float bw_noise_gen_get_scaling_k(const bw_noise_gen_coeffs *BW_RES * if sample rate scaling were enabled, as stored in `coeffs`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -144,7 +148,11 @@ static inline float bw_noise_gen_get_scaling_k(const bw_noise_gen_coeffs *BW_RES #include #include - + +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_noise_gen_coeffs { // Coefficients float scaling_k; diff --git a/include/bw_notch.h b/include/bw_notch.h index 059f28f..60c07dc 100644 --- a/include/bw_notch.h +++ b/include/bw_notch.h @@ -63,12 +63,12 @@ #ifndef _BW_NOTCH_H #define _BW_NOTCH_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_notch_coeffs * ```>>> */ @@ -162,6 +162,10 @@ static inline void bw_notch_set_Q(bw_notch_coeffs *BW_RESTRICT coeffs, float val * Default value: `0.5f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -169,6 +173,10 @@ static inline void bw_notch_set_Q(bw_notch_coeffs *BW_RESTRICT coeffs, float val #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_notch_coeffs { // Sub-components bw_svf_coeffs svf_coeffs; diff --git a/include/bw_note_queue.h b/include/bw_note_queue.h index 9c5ed4f..8949e66 100644 --- a/include/bw_note_queue.h +++ b/include/bw_note_queue.h @@ -67,6 +67,8 @@ extern "C" { #endif +/*** Public API ***/ + /*! api {{{ * #### bw_note_queue_status * ```>>> */ @@ -149,25 +151,6 @@ static inline char bw_note_queue_is_valid(const bw_note_queue *BW_RESTRICT queue #ifdef __cplusplus } - -namespace Brickworks { - -/*! api_cpp {{{ - * ##### Brickworks::NoteQueue - * ```>>> */ -class NoteQueue { -public: - NoteQueue(); - - void clear(); - void add(unsigned char note, bool pressed, float velocity, bool force_went_off); - - bw_note_queue queue; -}; -/*! <<<``` - * }}} */ - -} #endif /*** Implementation ***/ @@ -259,8 +242,30 @@ static inline char bw_note_queue_is_valid(const bw_note_queue *BW_RESTRICT queue #ifdef __cplusplus } +/*** Public C++ API ***/ + namespace Brickworks { +/*! api_cpp {{{ + * ##### Brickworks::NoteQueue + * ```>>> */ +class NoteQueue { +public: + NoteQueue(); + + void clear(); + void add(unsigned char note, bool pressed, float velocity, bool force_went_off); + + bw_note_queue queue; +}; +/*! <<<``` + * }}} */ + +/*** Implementation ***/ + +/* WARNING: This part of the file is not part of the public API. Its content may + * change at any time in future versions. Please, do not use it directly. */ + inline NoteQueue::NoteQueue() { bw_note_queue_reset(&queue); } diff --git a/include/bw_one_pole.h b/include/bw_one_pole.h index 85dbb87..53ceb9e 100644 --- a/include/bw_one_pole.h +++ b/include/bw_one_pole.h @@ -34,6 +34,12 @@ *
    *
  • Now using size_t instead of * BW_SIZE_T.
  • + *
  • Added more const specifiers to input + * arguments.
  • + *
  • Moved C++ code to C header.
  • + *
  • Added overladed C++ process() function taking + * C-style arrays as arguments.
  • + *
  • Removed usage of reserved identifiers.
  • *
* *
  • Version 0.6.0: @@ -71,25 +77,27 @@ * }}} */ -#ifndef _BW_ONE_POLE_H -#define _BW_ONE_POLE_H +#ifndef BW_ONE_POLE_H +#define BW_ONE_POLE_H + +#include #ifdef __cplusplus extern "C" { #endif -#include +/*** Public API ***/ /*! api {{{ * #### bw_one_pole_coeffs * ```>>> */ -typedef struct _bw_one_pole_coeffs bw_one_pole_coeffs; +typedef struct bw_one_pole_coeffs bw_one_pole_coeffs; /*! <<<``` * Coefficients and related. * * #### bw_one_pole_state * ```>>> */ -typedef struct _bw_one_pole_state bw_one_pole_state; +typedef struct bw_one_pole_state bw_one_pole_state; /*! <<<``` * Internal state and related. * @@ -188,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 **BW_RESTRICT state, const float **x, float **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 state, const float * const *x, float **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 @@ -324,6 +332,10 @@ static inline char bw_one_pole_state_is_valid(const bw_one_pole_state *BW_RESTRI * than or equal to that of `bw_one_pole_state`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -331,16 +343,20 @@ static inline char bw_one_pole_state_is_valid(const bw_one_pole_state *BW_RESTRI #include +#ifdef __cplusplus +extern "C" { +#endif + #ifdef BW_DEBUG_DEEP -enum _bw_one_pole_coeffs_state { - _bw_one_pole_coeffs_state_invalid, - _bw_one_pole_coeffs_state_init, - _bw_one_pole_coeffs_state_set_sample_rate, - _bw_one_pole_coeffs_state_reset_coeffs, +enum bw_one_pole_coeffs_state { + bw_one_pole_coeffs_state_invalid, + bw_one_pole_coeffs_state_init, + bw_one_pole_coeffs_state_set_sample_rate, + bw_one_pole_coeffs_state_reset_coeffs, }; #endif -struct _bw_one_pole_coeffs { +struct bw_one_pole_coeffs { #ifdef BW_DEBUG_DEEP uint32_t hash; enum _bw_one_pole_coeffs_state state; @@ -362,7 +378,7 @@ struct _bw_one_pole_coeffs { int param_changed; }; -struct _bw_one_pole_state { +struct bw_one_pole_state { #ifdef BW_DEBUG_DEEP uint32_t hash; uint32_t coeffs_reset_id; @@ -371,9 +387,9 @@ struct _bw_one_pole_state { float y_z1; }; -#define _BW_ONE_POLE_PARAM_CUTOFF_UP 1 -#define _BW_ONE_POLE_PARAM_CUTOFF_DOWN (1<<1) -#define _BW_ONE_POLE_PARAM_STICKY_THRESH (1<<2) +#define BW_ONE_POLE_PARAM_CUTOFF_UP 1 +#define BW_ONE_POLE_PARAM_CUTOFF_DOWN (1<<1) +#define BW_ONE_POLE_PARAM_STICKY_THRESH (1<<2) static inline void bw_one_pole_init(bw_one_pole_coeffs *BW_RESTRICT coeffs) { BW_ASSERT(coeffs != NULL); @@ -394,26 +410,26 @@ static inline void bw_one_pole_init(bw_one_pole_coeffs *BW_RESTRICT coeffs) { static inline void bw_one_pole_set_sample_rate(bw_one_pole_coeffs *BW_RESTRICT coeffs, float sample_rate) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); coeffs->Ttm2pi = -6.283185307179586f / sample_rate; #ifdef BW_DEBUG_DEEP - coeffs->state = _bw_one_pole_coeffs_state_set_sample_rate; + coeffs->state = bw_one_pole_coeffs_state_set_sample_rate; #endif BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state == _bw_one_pole_coeffs_state_set_sample_rate); + BW_ASSERT_DEEP(coeffs->state == bw_one_pole_coeffs_state_set_sample_rate); } static inline void _bw_one_pole_do_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RESTRICT coeffs) { if (coeffs->param_changed) { - if (coeffs->param_changed & _BW_ONE_POLE_PARAM_CUTOFF_UP) + if (coeffs->param_changed & BW_ONE_POLE_PARAM_CUTOFF_UP) coeffs->mA1u = coeffs->cutoff_up > 1.591549430918953e8f ? 0.f : bw_expf(coeffs->Ttm2pi * coeffs->cutoff_up); // tau < 1 ns is instantaneous for any practical purpose - if (coeffs->param_changed & _BW_ONE_POLE_PARAM_CUTOFF_DOWN) + if (coeffs->param_changed & BW_ONE_POLE_PARAM_CUTOFF_DOWN) coeffs->mA1d = coeffs->cutoff_down > 1.591549430918953e8f ? 0.f : bw_expf(coeffs->Ttm2pi * coeffs->cutoff_down); // as before - if (coeffs->param_changed & _BW_ONE_POLE_PARAM_STICKY_THRESH) + if (coeffs->param_changed & BW_ONE_POLE_PARAM_STICKY_THRESH) coeffs->st2 = coeffs->sticky_thresh * coeffs->sticky_thresh; coeffs->param_changed = 0; } @@ -422,7 +438,7 @@ static inline void _bw_one_pole_do_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RES static inline void bw_one_pole_reset_coeffs(bw_one_pole_coeffs *BW_RESTRICT coeffs) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_set_sample_rate); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_set_sample_rate); coeffs->param_changed = ~0; _bw_one_pole_do_update_coeffs_ctrl(coeffs); @@ -432,13 +448,13 @@ static inline void bw_one_pole_reset_coeffs(bw_one_pole_coeffs *BW_RESTRICT coef coeffs->reset_id++; #endif BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state == _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state == bw_one_pole_coeffs_state_reset_coeffs); } static inline void bw_one_pole_reset_state(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float y_z1) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT(bw_is_finite(y_z1)); @@ -458,18 +474,18 @@ static inline void bw_one_pole_reset_state(const bw_one_pole_coeffs *BW_RESTRICT static inline void bw_one_pole_update_coeffs_ctrl(bw_one_pole_coeffs *BW_RESTRICT coeffs) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); _bw_one_pole_do_update_coeffs_ctrl(coeffs); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); } static inline void bw_one_pole_update_coeffs_audio(bw_one_pole_coeffs *BW_RESTRICT coeffs) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); (void)coeffs; } @@ -477,7 +493,7 @@ static inline void bw_one_pole_update_coeffs_audio(bw_one_pole_coeffs *BW_RESTRI static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -487,7 +503,7 @@ static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT c state->y_z1 = y; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); BW_ASSERT(bw_is_finite(y)); @@ -498,7 +514,7 @@ static inline float bw_one_pole_process1(const bw_one_pole_coeffs *BW_RESTRICT c static inline float bw_one_pole_process1_sticky_abs(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -511,7 +527,7 @@ static inline float bw_one_pole_process1_sticky_abs(const bw_one_pole_coeffs *BW state->y_z1 = y; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); BW_ASSERT(bw_is_finite(y)); @@ -522,7 +538,7 @@ static inline float bw_one_pole_process1_sticky_abs(const bw_one_pole_coeffs *BW static inline float bw_one_pole_process1_sticky_rel(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -535,7 +551,7 @@ static inline float bw_one_pole_process1_sticky_rel(const bw_one_pole_coeffs *BW state->y_z1 = y; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); BW_ASSERT(bw_is_finite(y)); @@ -546,7 +562,7 @@ static inline float bw_one_pole_process1_sticky_rel(const bw_one_pole_coeffs *BW static inline float bw_one_pole_process1_asym(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -556,7 +572,7 @@ static inline float bw_one_pole_process1_asym(const bw_one_pole_coeffs *BW_RESTR state->y_z1 = y; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); BW_ASSERT(bw_is_finite(y)); @@ -567,7 +583,7 @@ static inline float bw_one_pole_process1_asym(const bw_one_pole_coeffs *BW_RESTR static inline float bw_one_pole_process1_asym_sticky_abs(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -580,7 +596,7 @@ static inline float bw_one_pole_process1_asym_sticky_abs(const bw_one_pole_coeff state->y_z1 = y; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); BW_ASSERT(bw_is_finite(y)); @@ -591,7 +607,7 @@ static inline float bw_one_pole_process1_asym_sticky_abs(const bw_one_pole_coeff static inline float bw_one_pole_process1_asym_sticky_rel(const bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, float x) { 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -604,7 +620,7 @@ static inline float bw_one_pole_process1_asym_sticky_rel(const bw_one_pole_coeff state->y_z1 = y; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); BW_ASSERT(bw_is_finite(y)); @@ -615,7 +631,7 @@ static inline float bw_one_pole_process1_asym_sticky_rel(const bw_one_pole_coeff static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_state *BW_RESTRICT state, const float *x, float *y, 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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); @@ -684,16 +700,16 @@ static inline void bw_one_pole_process(bw_one_pole_coeffs *BW_RESTRICT coeffs, b } BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_reset_coeffs); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state)); BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id); 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 **BW_RESTRICT state, const float **x, float **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 state, const float * const *x, float **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); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); //... bw_one_pole_update_coeffs_ctrl(coeffs); @@ -800,7 +816,7 @@ static inline void bw_one_pole_process_multi(bw_one_pole_coeffs *BW_RESTRICT coe static inline void bw_one_pole_set_cutoff(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); BW_ASSERT(!bw_is_nan(value)); BW_ASSERT(value >= 0.f); @@ -808,45 +824,45 @@ static inline void bw_one_pole_set_cutoff(bw_one_pole_coeffs *BW_RESTRICT coeffs bw_one_pole_set_cutoff_down(coeffs, value); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_cutoff_up(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); BW_ASSERT(!bw_is_nan(value)); BW_ASSERT(value >= 0.f); if (coeffs->cutoff_up != value) { coeffs->cutoff_up = value; - coeffs->param_changed |= _BW_ONE_POLE_PARAM_CUTOFF_UP; + coeffs->param_changed |= BW_ONE_POLE_PARAM_CUTOFF_UP; } BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_cutoff_down(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); BW_ASSERT(!bw_is_nan(value)); BW_ASSERT(value >= 0.f); if (coeffs->cutoff_down != value) { coeffs->cutoff_down = value; - coeffs->param_changed |= _BW_ONE_POLE_PARAM_CUTOFF_DOWN; + coeffs->param_changed |= BW_ONE_POLE_PARAM_CUTOFF_DOWN; } BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_tau(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); BW_ASSERT(!bw_is_nan(value)); BW_ASSERT(value >= 0.f); @@ -854,13 +870,13 @@ static inline void bw_one_pole_set_tau(bw_one_pole_coeffs *BW_RESTRICT coeffs, f bw_one_pole_set_tau_down(coeffs, value); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_tau_up(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); BW_ASSERT(!bw_is_nan(value)); BW_ASSERT(value >= 0.f); @@ -868,13 +884,13 @@ static inline void bw_one_pole_set_tau_up(bw_one_pole_coeffs *BW_RESTRICT coeffs // tau < 1 ns is instantaneous for any practical purpose BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_tau_down(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); BW_ASSERT(!bw_is_nan(value)); BW_ASSERT(value >= 0.f); @@ -882,34 +898,34 @@ static inline void bw_one_pole_set_tau_down(bw_one_pole_coeffs *BW_RESTRICT coef // as before BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_sticky_thresh(bw_one_pole_coeffs *BW_RESTRICT coeffs, float value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); //... if (coeffs->sticky_thresh != value) { coeffs->sticky_thresh = value; - coeffs->param_changed |= _BW_ONE_POLE_PARAM_STICKY_THRESH; + coeffs->param_changed |= BW_ONE_POLE_PARAM_STICKY_THRESH; } BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline void bw_one_pole_set_sticky_mode(bw_one_pole_coeffs *BW_RESTRICT coeffs, bw_one_pole_sticky_mode value) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); //... coeffs->sticky_mode = value; BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); - BW_ASSERT_DEEP(coeffs->state >= _bw_one_pole_coeffs_state_init); + BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_init); } static inline float bw_one_pole_get_y_z1(const bw_one_pole_state *BW_RESTRICT state) { @@ -943,11 +959,144 @@ static inline char bw_one_pole_state_is_valid(const bw_one_pole_state *BW_RESTRI return bw_is_finite(state->y_z1); } -#undef _BW_ONE_POLE_PARAM_CUTOFF_UP -#undef _BW_ONE_POLE_PARAM_CUTOFF_DOWN -#undef _BW_ONE_POLE_PARAM_STICKY_THRESH +#undef BW_ONE_POLE_PARAM_CUTOFF_UP +#undef BW_ONE_POLE_PARAM_CUTOFF_DOWN +#undef BW_ONE_POLE_PARAM_STICKY_THRESH #ifdef __cplusplus +} + +#include + +namespace Brickworks { + +/*** Public C++ API ***/ + +/*! api_cpp {{{ + * ##### Brickworks::OnePole + * ```>>> */ +template +class OnePole { +public: + OnePole(); + + void setSampleRate(float sampleRate); + void reset(float y_z1 = 0.f); + void process( + const float * const *x, + float **y, + int nSamples); + void process( + std::array x, + std::array y, + int nSamples); + + void setCutoff(float value); + void setCutoffUp(float value); + void setCutoffDown(float value); + void setTau(float value); + void setTauUp(float value); + void setTauDown(float value); + void setStickyThresh(float value); + void setStickyMode(bw_one_pole_sticky_mode value); + + float getYZ1(size_t channel); +/*! <<<... + * } + * ``` + * }}} */ + +/*** Implementation ***/ + +/* WARNING: This part of the file is not part of the public API. Its content may + * change at any time in future versions. Please, do not use it directly. */ + +private: + bw_one_pole_coeffs coeffs; + bw_one_pole_state states[N_CHANNELS]; + bw_one_pole_state *statesP[N_CHANNELS]; +}; + +template +inline OnePole::OnePole() { + bw_one_pole_init(&coeffs); + for (size_t i = 0; i < N_CHANNELS; i++) + statesP[i] = states + i; +} + +template +inline void OnePole::setSampleRate(float sampleRate) { + bw_one_pole_set_sample_rate(&coeffs, sampleRate); +} + +template +inline void OnePole::reset(float y_z1) { + bw_one_pole_reset_coeffs(&coeffs); + for (size_t i = 0; i < N_CHANNELS; i++) + bw_one_pole_reset_state(&coeffs, states + i, y_z1); +} + +template +inline void OnePole::process( + const float * const *x, + float **y, + int nSamples) { + bw_one_pole_process_multi(&coeffs, statesP, x, y, N_CHANNELS, nSamples); +} + +template +inline void OnePole::process( + std::array x, + std::array y, + int nSamples) { + process(x.data(), y.data(), nSamples); +} + +template +inline void OnePole::setCutoff(float value) { + bw_one_pole_set_cutoff(&coeffs, value); +} + +template +inline void OnePole::setCutoffUp(float value) { + bw_one_pole_set_cutoff_up(&coeffs, value); +} + +template +inline void OnePole::setCutoffDown(float value) { + bw_one_pole_set_cutoff_down(&coeffs, value); +} + +template +inline void OnePole::setTau(float value) { + bw_one_pole_set_tau(&coeffs, value); +} + +template +inline void OnePole::setTauUp(float value) { + bw_one_pole_set_tau_up(&coeffs, value); +} + +template +inline void OnePole::setTauDown(float value) { + bw_one_pole_set_tau_down(&coeffs, value); +} + +template +inline void OnePole::setStickyThresh(float value) { + bw_one_pole_set_sticky_thresh(&coeffs, value); +} + +template +inline void OnePole::setStickyMode(bw_one_pole_sticky_mode value) { + bw_one_pole_set_sticky_mode(&coeffs, value); +} + +template +inline float OnePole::getYZ1(size_t channel) { + return bw_one_pole_get_y_z1(states + channel); +} + } #endif diff --git a/include/bw_osc_filt.h b/include/bw_osc_filt.h index d73db0d..972a00f 100644 --- a/include/bw_osc_filt.h +++ b/include/bw_osc_filt.h @@ -67,12 +67,12 @@ #ifndef _BW_OSC_FILT_H #define _BW_OSC_FILT_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_osc_filt_state * ```>>> */ @@ -110,11 +110,19 @@ static inline void bw_osc_filt_process_multi(bw_osc_filt_state **BW_RESTRICT sta * using and updating each of the `n_channels` `state`s. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may * change at any time in future versions. Please, do not use it directly. */ +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_osc_filt_state { float x_z1; float y_z1; diff --git a/include/bw_osc_pulse.h b/include/bw_osc_pulse.h index 9f9cc82..fa4bed9 100644 --- a/include/bw_osc_pulse.h +++ b/include/bw_osc_pulse.h @@ -70,12 +70,12 @@ #ifndef _BW_OSC_PULSE_H #define _BW_OSC_PULSE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_osc_pulse_coeffs * ```>>> */ @@ -170,6 +170,10 @@ static inline void bw_osc_pulse_set_pulse_width(bw_osc_pulse_coeffs *BW_RESTRICT * Default value: `0.5f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -178,6 +182,10 @@ static inline void bw_osc_pulse_set_pulse_width(bw_osc_pulse_coeffs *BW_RESTRICT #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_osc_pulse_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_osc_saw.h b/include/bw_osc_saw.h index a846a74..7597817 100644 --- a/include/bw_osc_saw.h +++ b/include/bw_osc_saw.h @@ -69,12 +69,12 @@ #ifndef _BW_OSC_SAW_H #define _BW_OSC_SAW_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_osc_saw_coeffs * ```>>> */ @@ -135,6 +135,10 @@ static inline void bw_osc_saw_set_antialiasing(bw_osc_saw_coeffs *BW_RESTRICT co * Default value: `0` (off). * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -142,6 +146,10 @@ static inline void bw_osc_saw_set_antialiasing(bw_osc_saw_coeffs *BW_RESTRICT co #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_osc_saw_coeffs { // Parameters char antialiasing; diff --git a/include/bw_osc_sin.h b/include/bw_osc_sin.h index 5535252..6cce484 100644 --- a/include/bw_osc_sin.h +++ b/include/bw_osc_sin.h @@ -64,12 +64,12 @@ #ifndef _BW_OSC_SIN_H #define _BW_OSC_SIN_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_osc_sin_process1() * ```>>> */ @@ -96,6 +96,10 @@ static inline void bw_osc_sin_process_multi(const float **x, float **y, int n_ch * of the `n_channels` output buffers `y`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -103,6 +107,10 @@ static inline void bw_osc_sin_process_multi(const float **x, float **y, int n_ch #include +#ifdef __cplusplus +extern "C" { +#endif + static inline float bw_osc_sin_process1(float x) { return bw_sin2pif(x); } diff --git a/include/bw_osc_tri.h b/include/bw_osc_tri.h index 9a562b7..ca1f2bd 100644 --- a/include/bw_osc_tri.h +++ b/include/bw_osc_tri.h @@ -72,12 +72,12 @@ #ifndef _BW_OSC_TRI_H #define _BW_OSC_TRI_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_osc_tri_coeffs * ```>>> */ @@ -172,6 +172,10 @@ static inline void bw_osc_tri_set_slope(bw_osc_tri_coeffs *BW_RESTRICT coeffs, f * Default value: `0.5f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -180,6 +184,10 @@ static inline void bw_osc_tri_set_slope(bw_osc_tri_coeffs *BW_RESTRICT coeffs, f #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_osc_tri_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_pan.h b/include/bw_pan.h index dece94e..fe0f17a 100644 --- a/include/bw_pan.h +++ b/include/bw_pan.h @@ -58,12 +58,12 @@ #ifndef _BW_PAN_H #define _BW_PAN_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_pan_coeffs * ```>>> */ @@ -136,6 +136,10 @@ static inline void bw_pan_set_pan(bw_pan_coeffs *BW_RESTRICT coeffs, float value * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -144,6 +148,10 @@ static inline void bw_pan_set_pan(bw_pan_coeffs *BW_RESTRICT coeffs, float value #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_pan_coeffs { // Sub-components bw_gain_coeffs l_coeffs; diff --git a/include/bw_peak.h b/include/bw_peak.h index 483d61c..e63f13d 100644 --- a/include/bw_peak.h +++ b/include/bw_peak.h @@ -72,12 +72,12 @@ #ifndef _BW_PEAK_H #define _BW_PEAK_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_peak_coeffs * ```>>> */ @@ -205,6 +205,10 @@ static inline void bw_peak_set_use_bandwidth(bw_peak_coeffs *BW_RESTRICT coeffs, * Default value: non-`0` (use bandwidth parameter). * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -213,6 +217,10 @@ static inline void bw_peak_set_use_bandwidth(bw_peak_coeffs *BW_RESTRICT coeffs, #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_peak_coeffs { // Sub-components bw_mm2_coeffs mm2_coeffs; diff --git a/include/bw_phase_gen.h b/include/bw_phase_gen.h index f2a838b..2a8507c 100644 --- a/include/bw_phase_gen.h +++ b/include/bw_phase_gen.h @@ -74,12 +74,12 @@ #ifndef _BW_PHASE_GEN_H #define _BW_PHASE_GEN_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_phase_gen_coeffs * ```>>> */ @@ -188,6 +188,10 @@ static inline void bw_phase_gen_set_portamento_tau(bw_phase_gen_coeffs *BW_RESTR * Default value: `0.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -196,6 +200,10 @@ static inline void bw_phase_gen_set_portamento_tau(bw_phase_gen_coeffs *BW_RESTR #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_phase_gen_coeffs { // Sub-components bw_one_pole_coeffs portamento_coeffs; diff --git a/include/bw_phaser.h b/include/bw_phaser.h index 49dddc2..6c2f70c 100644 --- a/include/bw_phaser.h +++ b/include/bw_phaser.h @@ -60,12 +60,12 @@ #ifndef _BW_PHASER_H #define _BW_PHASER_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_phaser_coeffs * ```>>> */ @@ -164,6 +164,10 @@ static inline void bw_phaser_set_amount(bw_phaser_coeffs *BW_RESTRICT coeffs, fl * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -174,6 +178,10 @@ static inline void bw_phaser_set_amount(bw_phaser_coeffs *BW_RESTRICT coeffs, fl #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_phaser_coeffs { // Sub-components bw_phase_gen_coeffs phase_gen_coeffs; diff --git a/include/bw_pink_filt.h b/include/bw_pink_filt.h index 9ed5b5f..9387526 100644 --- a/include/bw_pink_filt.h +++ b/include/bw_pink_filt.h @@ -81,12 +81,12 @@ #ifndef _BW_PINK_FILT_H #define _BW_PINK_FILT_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_pink_filt_coeffs * ```>>> */ @@ -170,11 +170,19 @@ static inline float bw_pink_filt_get_scaling_k(const bw_pink_filt_coeffs *BW_RES * if sample rate scaling were enabled, as stored in `coeffs`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may * change at any time in future versions. Please, do not use it directly. */ +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_pink_filt_coeffs { // Coefficients float scaling_k; diff --git a/include/bw_ppm.h b/include/bw_ppm.h index 83b1c36..ba098fe 100644 --- a/include/bw_ppm.h +++ b/include/bw_ppm.h @@ -61,12 +61,12 @@ #ifndef _BW_PPM_H #define _BW_PPM_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_ppm_coeffs * ```>>> */ @@ -163,6 +163,10 @@ static inline float bw_ppm_get_y_z1(const bw_ppm_state *BW_RESTRICT state); * Returns the last output sample as stored in `state`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -170,6 +174,10 @@ static inline float bw_ppm_get_y_z1(const bw_ppm_state *BW_RESTRICT state); #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_ppm_coeffs { // Sub-components bw_env_follow_coeffs env_follow_coeffs; diff --git a/include/bw_rand.h b/include/bw_rand.h index b9ce532..11f6c22 100644 --- a/include/bw_rand.h +++ b/include/bw_rand.h @@ -70,6 +70,8 @@ extern "C" { #endif +/*** Public API ***/ + /*! api {{{ * #### bw_randu32() * ```>>> */ diff --git a/include/bw_reverb.h b/include/bw_reverb.h index 7b6e597..3fb4959 100644 --- a/include/bw_reverb.h +++ b/include/bw_reverb.h @@ -58,12 +58,12 @@ #ifndef _BW_REVERB_H #define _BW_REVERB_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_reverb_coeffs * ```>>> */ @@ -198,6 +198,10 @@ static inline void bw_reverb_set_wet(bw_reverb_coeffs *BW_RESTRICT coeffs, float * Default value: `0.5f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -212,6 +216,10 @@ static inline void bw_reverb_set_wet(bw_reverb_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_reverb_coeffs { // Sub-components bw_delay_coeffs predelay_coeffs; diff --git a/include/bw_ringmod.h b/include/bw_ringmod.h index 683ba00..42d4389 100644 --- a/include/bw_ringmod.h +++ b/include/bw_ringmod.h @@ -58,12 +58,12 @@ #ifndef _BW_RINGMOD_H #define _BW_RINGMOD_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_ringmod_coeffs * ```>>> */ @@ -137,6 +137,10 @@ static inline void bw_ringmod_set_amount(bw_ringmod_coeffs *BW_RESTRICT coeffs, * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -145,6 +149,10 @@ static inline void bw_ringmod_set_amount(bw_ringmod_coeffs *BW_RESTRICT coeffs, #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_ringmod_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_satur.h b/include/bw_satur.h index 07772e7..9a4d274 100644 --- a/include/bw_satur.h +++ b/include/bw_satur.h @@ -74,12 +74,12 @@ #ifndef _BW_SATUR_H #define _BW_SATUR_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_satur_coeffs * ```>>> */ @@ -186,6 +186,10 @@ static inline void bw_satur_set_gain_compensation(bw_satur_coeffs *BW_RESTRICT c * Default value: `1` (on). * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -194,6 +198,10 @@ static inline void bw_satur_set_gain_compensation(bw_satur_coeffs *BW_RESTRICT c #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_satur_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_slew_lim.h b/include/bw_slew_lim.h index e5d3aa3..1150ea5 100644 --- a/include/bw_slew_lim.h +++ b/include/bw_slew_lim.h @@ -63,12 +63,12 @@ #ifndef _BW_SLEW_LIM_H #define _BW_SLEW_LIM_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_slew_lim_coeffs * ```>>> */ @@ -205,6 +205,10 @@ static inline void bw_slew_lim_set_max_rate_down(bw_slew_lim_coeffs *BW_RESTRICT static inline float bw_slew_lim_get_y_z1(const bw_slew_lim_state *BW_RESTRICT state); +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -212,6 +216,10 @@ static inline float bw_slew_lim_get_y_z1(const bw_slew_lim_state *BW_RESTRICT st #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_slew_lim_coeffs { // Coefficients float T; diff --git a/include/bw_sr_reduce.h b/include/bw_sr_reduce.h index 72e77af..6791b61 100644 --- a/include/bw_sr_reduce.h +++ b/include/bw_sr_reduce.h @@ -65,12 +65,12 @@ #ifndef _BW_SR_REDUCE_H #define _BW_SR_REDUCE_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_sr_reduce_coeffs * ```>>> */ @@ -131,6 +131,10 @@ static inline void bw_sr_reduce_set_ratio(bw_sr_reduce_coeffs *BW_RESTRICT coeff * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -138,6 +142,10 @@ static inline void bw_sr_reduce_set_ratio(bw_sr_reduce_coeffs *BW_RESTRICT coeff #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_sr_reduce_coeffs { // Parameters float ratio; diff --git a/include/bw_src.h b/include/bw_src.h index cd84be1..4ecd971 100644 --- a/include/bw_src.h +++ b/include/bw_src.h @@ -56,12 +56,12 @@ #ifndef _BW_SRC_H #define _BW_SRC_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_src_coeffs * ```>>> */ @@ -119,6 +119,10 @@ static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs, * couples. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -126,6 +130,10 @@ static inline void bw_src_process_multi(const bw_src_coeffs *BW_RESTRICT coeffs, #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_src_coeffs { float k; float a1; diff --git a/include/bw_src_int.h b/include/bw_src_int.h index 7630670..bcd4127 100644 --- a/include/bw_src_int.h +++ b/include/bw_src_int.h @@ -62,12 +62,12 @@ #ifndef _BW_SRC_INT_H #define _BW_SRC_INT_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_src_int_coeffs * ```>>> */ @@ -130,6 +130,10 @@ static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT * buffer, if not `NULL`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -137,6 +141,10 @@ static inline void bw_src_int_process_multi(const bw_src_int_coeffs *BW_RESTRICT #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_src_int_coeffs { int ratio; float a1; diff --git a/include/bw_svf.h b/include/bw_svf.h index f0fe539..d363cb8 100644 --- a/include/bw_svf.h +++ b/include/bw_svf.h @@ -82,12 +82,12 @@ #ifndef _BW_SVF_H #define _BW_SVF_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_svf_coeffs * ```>>> */ @@ -208,6 +208,10 @@ static inline void bw_svf_set_prewarp_freq(bw_svf_coeffs *BW_RESTRICT coeffs, fl * Default value: `1e3f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -216,6 +220,10 @@ static inline void bw_svf_set_prewarp_freq(bw_svf_coeffs *BW_RESTRICT coeffs, fl #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_svf_coeffs { // Sub-components bw_one_pole_coeffs smooth_coeffs; diff --git a/include/bw_trem.h b/include/bw_trem.h index c4ecd94..bf15282 100644 --- a/include/bw_trem.h +++ b/include/bw_trem.h @@ -58,12 +58,12 @@ #ifndef _BW_TREM_H #define _BW_TREM_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_trem_coeffs * ```>>> */ @@ -155,6 +155,10 @@ static inline void bw_trem_set_amount(bw_trem_coeffs *BW_RESTRICT coeffs, float * Default value: `1.f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -164,6 +168,10 @@ static inline void bw_trem_set_amount(bw_trem_coeffs *BW_RESTRICT coeffs, float #include #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_trem_coeffs { // Sub-components bw_phase_gen_coeffs phase_gen_coeffs; diff --git a/include/bw_voice_alloc.h b/include/bw_voice_alloc.h index b6c03b7..56f1a1c 100644 --- a/include/bw_voice_alloc.h +++ b/include/bw_voice_alloc.h @@ -57,12 +57,14 @@ #ifndef BW_VOICE_ALLOC_H #define BW_VOICE_ALLOC_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include +/*** Public API ***/ /*! api {{{ * #### bw_voice_alloc_priority @@ -110,11 +112,19 @@ void bw_voice_alloc(const bw_voice_alloc_opts *BW_RESTRICT opts, bw_note_queue * * the number of elements in `voices`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may * change at any time in future versions. Please, do not use it directly. */ +#ifdef __cplusplus +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) { BW_ASSERT(opts != NULL); BW_ASSERT(opts->priority == bw_voice_alloc_priority_low || opts->priority == bw_voice_alloc_priority_high); diff --git a/include/bw_wah.h b/include/bw_wah.h index ae86170..a45fdfd 100644 --- a/include/bw_wah.h +++ b/include/bw_wah.h @@ -72,12 +72,12 @@ #ifndef _BW_WAH_H #define _BW_WAH_H +#include + #ifdef __cplusplus extern "C" { #endif -#include - /*! api {{{ * #### bw_wah_coeffs * ```>>> */ @@ -161,6 +161,10 @@ static inline void bw_wah_set_wah(bw_wah_coeffs *BW_RESTRICT coeffs, float value * Default value: `0.5f`. * }}} */ +#ifdef __cplusplus +} +#endif + /*** Implementation ***/ /* WARNING: This part of the file is not part of the public API. Its content may @@ -168,6 +172,10 @@ static inline void bw_wah_set_wah(bw_wah_coeffs *BW_RESTRICT coeffs, float value #include +#ifdef __cplusplus +extern "C" { +#endif + struct _bw_wah_coeffs { // Sub-components bw_svf_coeffs svf_coeffs; diff --git a/include/bwpp_one_pole.h b/include/bwpp_one_pole.h deleted file mode 100644 index 1fcf95b..0000000 --- a/include/bwpp_one_pole.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Brickworks - * - * Copyright (C) 2023 Orastron Srl unipersonale - * - * Brickworks is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, version 3 of the License. - * - * Brickworks is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Brickworks. If not, see . - * - * File author: Stefano D'Angelo - */ - -#ifndef BWPP_ONE_POLE_H -#define BWPP_ONE_POLE_H - -#include -#include - -namespace Brickworks { - -/*! api {{{ - * ##### Brickworks::OnePole - * ```>>> */ -template -class OnePole { -public: - OnePole(); - - void setSampleRate(float sampleRate); - void reset(float y_z1 = 0.f); - void process( - std::array x, - std::array y, - int nSamples); - - void setCutoff(float value); - void setCutoffUp(float value); - void setCutoffDown(float value); - void setTau(float value); - void setTauUp(float value); - void setTauDown(float value); - void setStickyThresh(float value); - void setStickyMode(bw_one_pole_sticky_mode value); - - float getYZ1(size_t channel); -/*! <<<... - * } - * ``` - * }}} */ - -/*** Implementation ***/ - -/* WARNING: This part of the file is not part of the public API. Its content may - * change at any time in future versions. Please, do not use it directly. */ - -private: - bw_one_pole_coeffs coeffs; - bw_one_pole_state states[N_CHANNELS]; - bw_one_pole_state *statesP[N_CHANNELS]; -}; - -template -inline OnePole::OnePole() { - bw_one_pole_init(&coeffs); - for (size_t i = 0; i < N_CHANNELS; i++) - statesP[i] = states + i; -} - -template -inline void OnePole::setSampleRate(float sampleRate) { - bw_one_pole_set_sample_rate(&coeffs, sampleRate); -} - -template -inline void OnePole::reset(float y_z1) { - bw_one_pole_reset_coeffs(&coeffs); - for (size_t i = 0; i < N_CHANNELS; i++) - bw_one_pole_reset_state(&coeffs, states + i, y_z1); -} - -template -inline void OnePole::process( - std::array x, - std::array y, - int nSamples) { - bw_one_pole_process_multi(&coeffs, statesP, x.data(), y.data(), N_CHANNELS, nSamples); -} - -template -inline void OnePole::setCutoff(float value) { - bw_one_pole_set_cutoff(&coeffs, value); -} - -template -inline void OnePole::setCutoffUp(float value) { - bw_one_pole_set_cutoff_up(&coeffs, value); -} - -template -inline void OnePole::setCutoffDown(float value) { - bw_one_pole_set_cutoff_down(&coeffs, value); -} - -template -inline void OnePole::setTau(float value) { - bw_one_pole_set_tau(&coeffs, value); -} - -template -inline void OnePole::setTauUp(float value) { - bw_one_pole_set_tau_up(&coeffs, value); -} - -template -inline void OnePole::setTauDown(float value) { - bw_one_pole_set_tau_down(&coeffs, value); -} - -template -inline void OnePole::setStickyThresh(float value) { - bw_one_pole_set_sticky_thresh(&coeffs, value); -} - -template -inline void OnePole::setStickyMode(bw_one_pole_sticky_mode value) { - bw_one_pole_set_sticky_mode(&coeffs, value); -} - -template -inline float OnePole::getYZ1(size_t channel) { - return bw_one_pole_get_y_z1(states + channel); -} - -} - -#endif