From 8ee4150889a6df4d77114da742d6fd19c332c9eb Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Mon, 25 Sep 2023 16:47:17 +0200 Subject: [PATCH] more debug + cosmetics --- TODO | 2 -- include/bw_ap1.h | 15 +++++++++++++++ include/bw_ap2.h | 15 +++++++++++++++ include/bw_balance.h | 12 ++++++++++++ include/bw_bd_reduce.h | 7 ++++++- include/bw_buf.h | 30 +++++++++++++++++++++++++++++ include/bw_chorus.h | 15 +++++++++++++++ include/bw_clip.h | 15 +++++++++++++++ include/bw_comb.h | 15 +++++++++++++++ include/bw_comp.h | 15 +++++++++++++++ include/bw_delay.h | 15 +++++++++++++++ include/bw_dist.h | 15 +++++++++++++++ include/bw_drive.h | 15 +++++++++++++++ include/bw_dry_wet.h | 5 +++++ include/bw_env_follow.h | 22 ++++++++++++++++++--- include/bw_env_gen.h | 16 ++++++++++++++++ include/bw_fuzz.h | 15 +++++++++++++++ include/bw_gain.h | 5 +++++ include/bw_hp1.h | 15 +++++++++++++++ include/bw_hs1.h | 15 +++++++++++++++ include/bw_hs2.h | 15 +++++++++++++++ include/bw_lp1.h | 15 +++++++++++++++ include/bw_ls1.h | 15 +++++++++++++++ include/bw_ls2.h | 15 +++++++++++++++ include/bw_mm1.h | 15 +++++++++++++++ include/bw_mm2.h | 15 +++++++++++++++ include/bw_noise_gate.h | 15 +++++++++++++++ include/bw_noise_gen.h | 5 +++++ include/bw_notch.h | 15 +++++++++++++++ include/bw_one_pole.h | 16 ++++++++++++++++ include/bw_osc_filt.h | 15 +++++++++++++++ include/bw_osc_pulse.h | 5 +++++ include/bw_osc_saw.h | 5 +++++ include/bw_osc_sin.h | 5 +++++ include/bw_osc_tri.h | 5 +++++ include/bw_pan.h | 14 ++++++++++++++ include/bw_peak.h | 25 +++++++++++++++++++----- include/bw_phase_gen.h | 27 ++++++++++++++++++++++++++ include/bw_phaser.h | 21 ++++++++++++++++++--- include/bw_pink_filt.h | 21 ++++++++++++++++++--- include/bw_ppm.h | 16 ++++++++++++++++ include/bw_reverb.h | 26 +++++++++++++++++++++++++ include/bw_ring_mod.h | 5 +++++ include/bw_satur.h | 21 ++++++++++++++++++--- include/bw_slew_lim.h | 16 ++++++++++++++++ include/bw_sr_reduce.h | 15 +++++++++++++++ include/bw_src.h | 25 ++++++++++++++++++++---- include/bw_src_int.h | 19 ++++++++++++++++++- include/bw_svf.h | 42 +++++++++++++++++++++++++++++++++++++++++ include/bw_trem.h | 15 +++++++++++++++ include/bw_wah.h | 15 +++++++++++++++ 51 files changed, 753 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index ff7d9f3..7313c3a 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ ----- * test flush-to-zero on arm -* debugging - also check outputs different (incl bw_buf) -* check all examples again (from fxpp_noise_gate) * clearly specify that state is tied to a particular set of coeffs (1:N) * state that sample rate is finite and > 0 * state that audio cannot be inf (also in reset) diff --git a/include/bw_ap1.h b/include/bw_ap1.h index 4b77c02..ecef6ce 100644 --- a/include/bw_ap1.h +++ b/include/bw_ap1.h @@ -397,6 +397,11 @@ static inline void bw_ap1_reset_state_multi( BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -495,8 +500,18 @@ static inline void bw_ap1_process_multi( BW_ASSERT_DEEP(bw_ap1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ap1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_ap1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_ap2.h b/include/bw_ap2.h index fd3a66d..e402a94 100644 --- a/include/bw_ap2.h +++ b/include/bw_ap2.h @@ -408,6 +408,11 @@ static inline void bw_ap2_reset_state_multi( BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -508,8 +513,18 @@ static inline void bw_ap2_process_multi( BW_ASSERT_DEEP(bw_ap2_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ap2_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_ap2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_balance.h b/include/bw_balance.h index 1cee3c0..6024362 100644 --- a/include/bw_balance.h +++ b/include/bw_balance.h @@ -326,6 +326,7 @@ static inline void bw_balance_process1( BW_ASSERT_DEEP(coeffs->state >= bw_balance_coeffs_state_reset_coeffs); BW_ASSERT(bw_is_finite(x_l)); BW_ASSERT(bw_is_finite(x_r)); + BW_ASSERT(y_l != y_r); *y_l = bw_gain_process1(&coeffs->l_coeffs, x_l); *y_r = bw_gain_process1(&coeffs->r_coeffs, x_r); @@ -352,6 +353,7 @@ static inline void bw_balance_process( BW_ASSERT_DEEP(bw_has_only_finite(x_r, n_samples)); BW_ASSERT(y_l != NULL); BW_ASSERT(y_r != NULL); + BW_ASSERT(y_l != y_r); bw_balance_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { @@ -380,6 +382,16 @@ static inline void bw_balance_process_multi( BW_ASSERT(x_r != NULL); BW_ASSERT(y_l != NULL); BW_ASSERT(y_r != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) { + BW_ASSERT(y_l[i] != y_l[j]); + BW_ASSERT(y_r[i] != y_r[j]); + } + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y_l[i] != y_r[j]); +#endif bw_balance_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_bd_reduce.h b/include/bw_bd_reduce.h index 3ed8d37..5d46607 100644 --- a/include/bw_bd_reduce.h +++ b/include/bw_bd_reduce.h @@ -106,7 +106,7 @@ static inline void bw_bd_reduce_set_sample_rate( * #### bw_bd_reduce_reset_coeffs() * ```>>> */ static inline void bw_bd_reduce_reset_coeffs( - bw_bd_reduce_coeffs *BW_RESTRICT coeffs); + bw_bd_reduce_coeffs * BW_RESTRICT coeffs); /*! <<<``` * Resets coefficients in `coeffs` to assume their target values. * @@ -351,6 +351,11 @@ static inline void bw_bd_reduce_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_bd_reduce_coeffs_state_reset_coeffs); BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_bd_reduce_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) diff --git a/include/bw_buf.h b/include/bw_buf.h index 1d3ac02..ac9ac83 100644 --- a/include/bw_buf.h +++ b/include/bw_buf.h @@ -335,6 +335,11 @@ static inline void bw_buf_fill_multi( size_t n_elems) { BW_ASSERT(!bw_is_nan(k)); BW_ASSERT(dest != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(dest[i] != dest[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_buf_fill(k, dest[i], n_elems); @@ -347,6 +352,11 @@ static inline void bw_buf_neg_multi( size_t n_elems) { BW_ASSERT(src != NULL); BW_ASSERT(dest != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(dest[i] != dest[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_buf_neg(src[i], dest[i], n_elems); @@ -361,6 +371,11 @@ static inline void bw_buf_add_multi( BW_ASSERT(src != NULL); BW_ASSERT(!bw_is_nan(k)); BW_ASSERT(dest != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(dest[i] != dest[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_buf_add(src[i], k, dest[i], n_elems); @@ -375,6 +390,11 @@ static inline void bw_buf_scale_multi( BW_ASSERT(src != NULL); BW_ASSERT(!bw_is_nan(k)); BW_ASSERT(dest != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(dest[i] != dest[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_buf_scale(src[i], k, dest[i], n_elems); @@ -389,6 +409,11 @@ static inline void bw_buf_mix_multi( BW_ASSERT(src1 != NULL); BW_ASSERT(src2 != NULL); BW_ASSERT(dest != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(dest[i] != dest[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_buf_mix(src1[i], src2[i], dest[i], n_elems); @@ -403,6 +428,11 @@ static inline void bw_buf_mul_multi( BW_ASSERT(src1 != NULL); BW_ASSERT(src2 != NULL); BW_ASSERT(dest != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(dest[i] != dest[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_buf_mul(src1[i], src2[i], dest[i], n_elems); diff --git a/include/bw_chorus.h b/include/bw_chorus.h index 612980e..b265c5e 100644 --- a/include/bw_chorus.h +++ b/include/bw_chorus.h @@ -532,6 +532,11 @@ static inline void bw_chorus_reset_state_multi( BW_ASSERT_DEEP(bw_chorus_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_chorus_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -640,8 +645,18 @@ static inline void bw_chorus_process_multi( BW_ASSERT_DEEP(bw_chorus_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_chorus_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_chorus_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_clip.h b/include/bw_clip.h index 8d27e12..1a3e22f 100644 --- a/include/bw_clip.h +++ b/include/bw_clip.h @@ -451,6 +451,11 @@ static inline void bw_clip_reset_state_multi( BW_ASSERT_DEEP(bw_clip_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_clip_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -578,8 +583,18 @@ static inline void bw_clip_process_multi( BW_ASSERT_DEEP(bw_clip_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_clip_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif if (coeffs->gain_compensation) for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_comb.h b/include/bw_comb.h index 8539c29..2c1befc 100644 --- a/include/bw_comb.h +++ b/include/bw_comb.h @@ -586,6 +586,11 @@ static inline void bw_comb_reset_state_multi( BW_ASSERT_DEEP(bw_comb_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_comb_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -696,8 +701,18 @@ static inline void bw_comb_process_multi( BW_ASSERT_DEEP(bw_comb_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_comb_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_comb_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_comp.h b/include/bw_comp.h index 245704e..7a1073d 100644 --- a/include/bw_comp.h +++ b/include/bw_comp.h @@ -492,6 +492,11 @@ static inline void bw_comp_reset_state_multi( BW_ASSERT_DEEP(bw_comp_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_comp_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); BW_ASSERT(x_sc_0 != NULL); @@ -604,9 +609,19 @@ static inline void bw_comp_process_multi( BW_ASSERT_DEEP(bw_comp_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_comp_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(x_sc != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_comp_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_delay.h b/include/bw_delay.h index 9a4a591..fa138b5 100644 --- a/include/bw_delay.h +++ b/include/bw_delay.h @@ -496,6 +496,11 @@ static inline void bw_delay_reset_state_multi( BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -643,8 +648,18 @@ static inline void bw_delay_process_multi( BW_ASSERT_DEEP(bw_delay_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_delay_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_delay_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) diff --git a/include/bw_dist.h b/include/bw_dist.h index 7ff220b..c4035cc 100644 --- a/include/bw_dist.h +++ b/include/bw_dist.h @@ -430,6 +430,11 @@ static inline void bw_dist_reset_state_multi( BW_ASSERT_DEEP(bw_dist_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_dist_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -536,8 +541,18 @@ static inline void bw_dist_process_multi( BW_ASSERT_DEEP(bw_dist_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_dist_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_dist_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_drive.h b/include/bw_drive.h index 56b1794..14c8b27 100644 --- a/include/bw_drive.h +++ b/include/bw_drive.h @@ -430,6 +430,11 @@ static inline void bw_drive_reset_state_multi( BW_ASSERT_DEEP(bw_drive_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_drive_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -537,8 +542,18 @@ static inline void bw_drive_process_multi( BW_ASSERT_DEEP(bw_drive_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_drive_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_drive_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_dry_wet.h b/include/bw_dry_wet.h index 1940ee7..188bb26 100644 --- a/include/bw_dry_wet.h +++ b/include/bw_dry_wet.h @@ -346,6 +346,11 @@ static inline void bw_dry_wet_process_multi( BW_ASSERT(x_dry != NULL); BW_ASSERT(x_wet != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_dry_wet_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_env_follow.h b/include/bw_env_follow.h index 64367f9..cf65e7e 100644 --- a/include/bw_env_follow.h +++ b/include/bw_env_follow.h @@ -391,13 +391,18 @@ static inline float bw_env_follow_reset_state( static inline void bw_env_follow_reset_state_multi( const bw_env_follow_coeffs * BW_RESTRICT coeffs, bw_env_follow_state * BW_RESTRICT const * BW_RESTRICT state, - const float * x_0, - float * y_0, - size_t n_channels) { + const float * x_0, + float * y_0, + size_t n_channels) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_env_follow_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_env_follow_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -501,7 +506,18 @@ static inline void bw_env_follow_process_multi( BW_ASSERT_DEEP(bw_env_follow_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_env_follow_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); +#ifndef BW_NO_DEBUG + if (y != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_env_follow_update_coeffs_ctrl(coeffs); if (y != NULL) diff --git a/include/bw_env_gen.h b/include/bw_env_gen.h index f1d5d19..68229e9 100644 --- a/include/bw_env_gen.h +++ b/include/bw_env_gen.h @@ -528,6 +528,11 @@ static inline void bw_env_gen_reset_state_multi( BW_ASSERT_DEEP(bw_env_gen_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_env_gen_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(gate_0 != NULL); if (y_0 != NULL) @@ -676,7 +681,18 @@ static inline void bw_env_gen_process_multi( BW_ASSERT_DEEP(bw_env_gen_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_env_gen_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(gate != NULL); +#ifndef BW_NO_DEBUG + if (y != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_env_gen_update_coeffs_ctrl(coeffs); for (size_t j = 0; j < n_channels; j++) diff --git a/include/bw_fuzz.h b/include/bw_fuzz.h index bbd8b08..e58f1a0 100644 --- a/include/bw_fuzz.h +++ b/include/bw_fuzz.h @@ -417,6 +417,11 @@ static inline void bw_fuzz_reset_state_multi( BW_ASSERT_DEEP(bw_fuzz_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_fuzz_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -523,8 +528,18 @@ static inline void bw_fuzz_process_multi( BW_ASSERT_DEEP(bw_fuzz_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_fuzz_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_fuzz_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_gain.h b/include/bw_gain.h index cf04e0f..8a38b8d 100644 --- a/include/bw_gain.h +++ b/include/bw_gain.h @@ -393,6 +393,11 @@ static inline void bw_gain_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_gain_coeffs_state_reset_coeffs); BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_gain_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_hp1.h b/include/bw_hp1.h index 509a0da..c12c2a1 100644 --- a/include/bw_hp1.h +++ b/include/bw_hp1.h @@ -395,6 +395,11 @@ static inline void bw_hp1_reset_state_multi( BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); for (size_t i = 0; i < n_channels; i++) @@ -492,8 +497,18 @@ static inline void bw_hp1_process_multi( BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_hp1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_hs1.h b/include/bw_hs1.h index 1fa41d6..263faa7 100644 --- a/include/bw_hs1.h +++ b/include/bw_hs1.h @@ -465,6 +465,11 @@ static inline void bw_hs1_reset_state_multi( BW_ASSERT_DEEP(bw_hs1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -568,8 +573,18 @@ static inline void bw_hs1_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_hs1_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(coeffs->high_gain) >= 1e-6f && coeffs->cutoff * bw_sqrtf(coeffs->high_gain) <= 1e12f); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_hs1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_hs2.h b/include/bw_hs2.h index 25ba068..b9d8ebf 100644 --- a/include/bw_hs2.h +++ b/include/bw_hs2.h @@ -488,6 +488,11 @@ static inline void bw_hs2_reset_state_multi( BW_ASSERT_DEEP(bw_hs2_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -591,8 +596,18 @@ static inline void bw_hs2_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_hs2_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) >= 1e-6f && coeffs->cutoff * bw_sqrtf(bw_sqrtf(coeffs->high_gain)) <= 1e12f); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_hs2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_lp1.h b/include/bw_lp1.h index c81280b..8b5f3af 100644 --- a/include/bw_lp1.h +++ b/include/bw_lp1.h @@ -447,6 +447,11 @@ static inline void bw_lp1_reset_state_multi( BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -543,8 +548,18 @@ static inline void bw_lp1_process_multi( BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_samples; i++) { bw_lp1_update_coeffs_audio(coeffs); diff --git a/include/bw_ls1.h b/include/bw_ls1.h index 3f5709b..a0994b2 100644 --- a/include/bw_ls1.h +++ b/include/bw_ls1.h @@ -463,6 +463,11 @@ static inline void bw_ls1_reset_state_multi( BW_ASSERT_DEEP(bw_ls1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -566,8 +571,18 @@ static inline void bw_ls1_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_ls1_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(coeffs->dc_gain)) <= 1e12f); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_ls1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_ls2.h b/include/bw_ls2.h index b744290..e7bfa51 100644 --- a/include/bw_ls2.h +++ b/include/bw_ls2.h @@ -488,6 +488,11 @@ static inline void bw_ls2_reset_state_multi( BW_ASSERT_DEEP(bw_ls2_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -591,8 +596,18 @@ static inline void bw_ls2_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_ls2_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) >= 1e-6f && coeffs->cutoff * bw_rcpf(bw_sqrtf(bw_sqrtf(coeffs->dc_gain))) <= 1e12f); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_ls2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_mm1.h b/include/bw_mm1.h index d8d52f9..de7983b 100644 --- a/include/bw_mm1.h +++ b/include/bw_mm1.h @@ -429,6 +429,11 @@ static inline void bw_mm1_reset_state_multi( BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -533,8 +538,18 @@ static inline void bw_mm1_process_multi( BW_ASSERT_DEEP(bw_mm1_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_mm1_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_mm1_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_mm2.h b/include/bw_mm2.h index e78f7c2..f6baadc 100644 --- a/include/bw_mm2.h +++ b/include/bw_mm2.h @@ -483,6 +483,11 @@ static inline void bw_mm2_reset_state_multi( BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -594,8 +599,18 @@ static inline void bw_mm2_process_multi( BW_ASSERT_DEEP(bw_mm2_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_mm2_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_mm2_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_noise_gate.h b/include/bw_noise_gate.h index 1645117..c5947c4 100644 --- a/include/bw_noise_gate.h +++ b/include/bw_noise_gate.h @@ -458,6 +458,11 @@ static inline void bw_noise_gate_reset_state_multi( BW_ASSERT_DEEP(bw_noise_gate_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_noise_gate_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); BW_ASSERT(x_sc_0 != NULL); @@ -563,9 +568,19 @@ static inline void bw_noise_gate_process_multi( BW_ASSERT_DEEP(bw_noise_gate_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_noise_gate_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(x_sc != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_noise_gate_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_noise_gen.h b/include/bw_noise_gen.h index ecf7807..5669646 100644 --- a/include/bw_noise_gen.h +++ b/include/bw_noise_gen.h @@ -367,6 +367,11 @@ static inline void bw_noise_gen_process_multi( BW_ASSERT_DEEP(bw_noise_gen_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_noise_gen_coeffs_state_reset_coeffs); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_noise_gen_process(coeffs, y[i], n_samples); diff --git a/include/bw_notch.h b/include/bw_notch.h index fe4864b..69f05bc 100644 --- a/include/bw_notch.h +++ b/include/bw_notch.h @@ -407,6 +407,11 @@ static inline void bw_notch_reset_state_multi( BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -506,8 +511,18 @@ static inline void bw_notch_process_multi( BW_ASSERT_DEEP(bw_notch_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_notch_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_notch_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_one_pole.h b/include/bw_one_pole.h index cbf4ba2..fae1632 100644 --- a/include/bw_one_pole.h +++ b/include/bw_one_pole.h @@ -608,6 +608,11 @@ static inline void bw_one_pole_reset_state_multi( BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -879,7 +884,18 @@ static inline void bw_one_pole_process_multi( BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); +#ifndef BW_NO_DEBUG + if (y != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_one_pole_update_coeffs_ctrl(coeffs); if (y != NULL) { diff --git a/include/bw_osc_filt.h b/include/bw_osc_filt.h index d67a031..242d543 100644 --- a/include/bw_osc_filt.h +++ b/include/bw_osc_filt.h @@ -214,6 +214,11 @@ static inline void bw_osc_filt_reset_state_multi( float * y_0, size_t n_channels) { BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -267,8 +272,18 @@ static inline void bw_osc_filt_process_multi( size_t n_channels, size_t n_samples) { BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_osc_filt_process(state[i], x[i], y[i], n_samples); diff --git a/include/bw_osc_pulse.h b/include/bw_osc_pulse.h index aa0b913..ecbfaa0 100644 --- a/include/bw_osc_pulse.h +++ b/include/bw_osc_pulse.h @@ -460,6 +460,11 @@ static inline void bw_osc_pulse_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_osc_pulse_coeffs_state_reset_coeffs); BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif if (coeffs->antialiasing) for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_osc_saw.h b/include/bw_osc_saw.h index 05007e6..67a643f 100644 --- a/include/bw_osc_saw.h +++ b/include/bw_osc_saw.h @@ -427,6 +427,11 @@ static inline void bw_osc_saw_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_osc_saw_coeffs_state_reset_coeffs); BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif if (x_inc != NULL) for (size_t i = 0; i < n_channels; i++) diff --git a/include/bw_osc_sin.h b/include/bw_osc_sin.h index 01c5437..43bb075 100644 --- a/include/bw_osc_sin.h +++ b/include/bw_osc_sin.h @@ -165,6 +165,11 @@ static inline void bw_osc_sin_process_multi( size_t n_samples) { BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_osc_sin_process(x[i], y[i], n_samples); diff --git a/include/bw_osc_tri.h b/include/bw_osc_tri.h index db37ab8..789aa2e 100644 --- a/include/bw_osc_tri.h +++ b/include/bw_osc_tri.h @@ -467,6 +467,11 @@ static inline void bw_osc_tri_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_osc_tri_coeffs_state_reset_coeffs); BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif if (coeffs->antialiasing) for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_pan.h b/include/bw_pan.h index a44bdc6..52098f7 100644 --- a/include/bw_pan.h +++ b/include/bw_pan.h @@ -321,6 +321,9 @@ static inline void bw_pan_process1( BW_ASSERT_DEEP(bw_pan_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_pan_coeffs_state_reset_coeffs); BW_ASSERT(bw_is_finite(x)); + BW_ASSERT(y_l != NULL); + BW_ASSERT(y_r != NULL); + BW_ASSERT(y_l != y_r); *y_l = bw_gain_process1(&coeffs->l_coeffs, x); *y_r = bw_gain_process1(&coeffs->r_coeffs, x); @@ -344,6 +347,7 @@ static inline void bw_pan_process( BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples)); BW_ASSERT(y_l != NULL); BW_ASSERT(y_r != NULL); + BW_ASSERT(y_l != y_r); bw_pan_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { @@ -370,6 +374,16 @@ static inline void bw_pan_process_multi( BW_ASSERT(x != NULL); BW_ASSERT(y_l != NULL); BW_ASSERT(y_r != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) { + BW_ASSERT(y_l[i] != y_l[j]); + BW_ASSERT(y_r[i] != y_r[j]); + } + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y_l[i] != y_r[j]); +#endif bw_pan_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_peak.h b/include/bw_peak.h index 8073aba..9ff3877 100644 --- a/include/bw_peak.h +++ b/include/bw_peak.h @@ -118,8 +118,8 @@ static inline void bw_peak_init( * #### bw_peak_set_sample_rate() * ```>>> */ static inline void bw_peak_set_sample_rate( - bw_peak_coeffs *BW_RESTRICT coeffs, - float sample_rate); + bw_peak_coeffs * BW_RESTRICT coeffs, + float sample_rate); /*! <<<``` * Sets the `sample_rate` (Hz) value in `coeffs`. * @@ -525,13 +525,18 @@ static inline float bw_peak_reset_state( static inline void bw_peak_reset_state_multi( const bw_peak_coeffs * BW_RESTRICT coeffs, bw_peak_state * BW_RESTRICT const * BW_RESTRICT state, - const float * x_0, - float * y_0, - size_t n_channels) { + const float * x_0, + float * y_0, + size_t n_channels) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_peak_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_peak_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -651,8 +656,18 @@ static inline void bw_peak_process_multi( && bw_sqrtf(bw_pow2f(coeffs->bandwidth) * coeffs->peak_gain) * bw_rcpf(bw_pow2f(coeffs->bandwidth) - 1.f) <= 1e6f : 1); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_peak_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_phase_gen.h b/include/bw_phase_gen.h index 1c0b8b4..35dc8d3 100644 --- a/include/bw_phase_gen.h +++ b/include/bw_phase_gen.h @@ -427,6 +427,7 @@ static inline void bw_phase_gen_reset_state( BW_ASSERT(bw_is_finite(phase_0)); BW_ASSERT(y_0 != NULL); BW_ASSERT(y_inc_0 != NULL); + BW_ASSERT(y_0 != y_inc_0); state->phase = phase_0; *y_inc_0 = bw_one_pole_get_y_z1(&coeffs->portamento_state); @@ -454,7 +455,13 @@ static inline void bw_phase_gen_reset_state_multi( BW_ASSERT_DEEP(bw_phase_gen_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_phase_gen_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(phase_0 != NULL); + BW_ASSERT(y_0 != NULL && y_inc_0 != NULL ? y_0 != y_inc_0 : 1); if (y_0 != NULL) { if (y_inc_0 != NULL) { @@ -530,6 +537,7 @@ static inline void bw_phase_gen_process1( BW_ASSERT_DEEP(bw_phase_gen_state_is_valid(coeffs, state)); BW_ASSERT(y != NULL); BW_ASSERT(y_inc != NULL); + BW_ASSERT(y != y_inc); *y_inc = bw_one_pole_get_y_z1(&coeffs->portamento_state); *y = bw_phase_gen_update_phase(state, *y_inc); @@ -556,6 +564,7 @@ static inline void bw_phase_gen_process1_mod( BW_ASSERT(bw_is_finite(x_mod)); BW_ASSERT(y != NULL); BW_ASSERT(y_inc != NULL); + BW_ASSERT(y != y_inc); *y_inc = bw_one_pole_get_y_z1(&coeffs->portamento_state) * bw_pow2f(x_mod); *y = bw_phase_gen_update_phase(state, *y_inc); @@ -581,6 +590,7 @@ static inline void bw_phase_gen_process( BW_ASSERT(state != NULL); BW_ASSERT_DEEP(bw_phase_gen_state_is_valid(coeffs, state)); BW_ASSERT_DEEP(x_mod != NULL ? bw_has_only_finite(x_mod, n_samples) : 1); + BW_ASSERT(y != NULL && y_inc != NULL ? y != y_inc : 1); bw_phase_gen_update_coeffs_ctrl(coeffs); if (y != NULL) { @@ -658,6 +668,23 @@ static inline void bw_phase_gen_process_multi( BW_ASSERT_DEEP(bw_phase_gen_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_phase_gen_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); + if (y != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); + if (y_inc != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y_inc[i] != y_inc[j]); + if (y != NULL && y_inc != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y[i] != y_inc[j]); +#endif bw_phase_gen_update_coeffs_ctrl(coeffs); if (y != NULL) { diff --git a/include/bw_phaser.h b/include/bw_phaser.h index 1850fec..70462c1 100644 --- a/include/bw_phaser.h +++ b/include/bw_phaser.h @@ -415,13 +415,18 @@ static inline float bw_phaser_reset_state( static inline void bw_phaser_reset_state_multi( const bw_phaser_coeffs * BW_RESTRICT coeffs, bw_phaser_state * BW_RESTRICT const * BW_RESTRICT state, - const float * x_0, - float * y_0, - size_t n_channels) { + const float * x_0, + float * y_0, + size_t n_channels) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_phaser_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_phaser_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -533,8 +538,18 @@ static inline void bw_phaser_process_multi( BW_ASSERT_DEEP(coeffs->state >= bw_phaser_coeffs_state_reset_coeffs); BW_ASSERT_DEEP(coeffs->center * bw_pow2f(coeffs->amount) >= 1e-6f && coeffs->center * bw_pow2f(coeffs->amount) <= 1e12f); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_phaser_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_pink_filt.h b/include/bw_pink_filt.h index b5ac5e5..5d0959e 100644 --- a/include/bw_pink_filt.h +++ b/include/bw_pink_filt.h @@ -408,13 +408,18 @@ static inline float bw_pink_filt_reset_state( static inline void bw_pink_filt_reset_state_multi( const bw_pink_filt_coeffs * BW_RESTRICT coeffs, bw_pink_filt_state * BW_RESTRICT const * BW_RESTRICT state, - const float * x_0, - float * y_0, - size_t n_channels) { + const float * x_0, + float * y_0, + size_t n_channels) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -536,8 +541,18 @@ static inline void bw_pink_filt_process_multi( BW_ASSERT_DEEP(bw_pink_filt_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_pink_filt_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_pink_filt_process(coeffs, state[i], x[i], y[i], n_samples); diff --git a/include/bw_ppm.h b/include/bw_ppm.h index cb7ebe8..0f42963 100644 --- a/include/bw_ppm.h +++ b/include/bw_ppm.h @@ -387,6 +387,11 @@ static inline void bw_ppm_reset_state_multi( BW_ASSERT_DEEP(bw_ppm_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ppm_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -491,7 +496,18 @@ static inline void bw_ppm_process_multi( BW_ASSERT_DEEP(bw_ppm_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_ppm_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); +#ifndef BW_NO_DEBUG + if (y != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_ppm_update_coeffs_ctrl(coeffs); if (y != NULL) diff --git a/include/bw_reverb.h b/include/bw_reverb.h index 610477b..e60fa0e 100644 --- a/include/bw_reverb.h +++ b/include/bw_reverb.h @@ -681,6 +681,7 @@ static inline void bw_reverb_reset_state( BW_ASSERT(bw_is_finite(x_r_0)); BW_ASSERT(y_l_0 != NULL); BW_ASSERT(y_r_0 != NULL); + BW_ASSERT(y_l_0 != y_r_0); const float i = 0.5f * (x_l_0 + x_r_0); const float pd = bw_delay_reset_state(&coeffs->predelay_coeffs, &state->predelay_state, i); @@ -742,8 +743,14 @@ static inline void bw_reverb_reset_state_multi( BW_ASSERT_DEEP(bw_reverb_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_reverb_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_l_0 != NULL); BW_ASSERT(x_r_0 != NULL); + BW_ASSERT(y_l_0 != NULL && y_r_0 != NULL ? y_l_0 != y_r_0 : 1); if (y_l_0 != NULL) { if (y_r_0 != NULL) { @@ -968,10 +975,29 @@ static inline void bw_reverb_process_multi( BW_ASSERT_DEEP(bw_reverb_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_reverb_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_l != NULL); BW_ASSERT(x_r != NULL); BW_ASSERT(y_l != NULL); BW_ASSERT(y_r != NULL); +#ifndef BW_NO_DEBUG + if (y_l_0 != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y_l_0[i] != y_l_0[j]); + if (y_r_0 != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y_r_0[i] != y_r_0[j]); + if (y_l_0 != y_r_0) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y_l_0[i] != y_r_0[j]); +#endif bw_reverb_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_ring_mod.h b/include/bw_ring_mod.h index 83c2552..5c461bc 100644 --- a/include/bw_ring_mod.h +++ b/include/bw_ring_mod.h @@ -352,6 +352,11 @@ static inline void bw_ring_mod_process_multi( BW_ASSERT(x_mod != NULL); BW_ASSERT(x_car != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_samples; i++) { bw_ring_mod_update_coeffs_audio(coeffs); diff --git a/include/bw_satur.h b/include/bw_satur.h index fd8fff1..64ec75a 100644 --- a/include/bw_satur.h +++ b/include/bw_satur.h @@ -464,13 +464,18 @@ static inline float bw_satur_reset_state( static inline void bw_satur_reset_state_multi( const bw_satur_coeffs * BW_RESTRICT coeffs, bw_satur_state * BW_RESTRICT const * BW_RESTRICT state, - const float * x_0, - float * y_0, - size_t n_channels) { + const float * x_0, + float * y_0, + size_t n_channels) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_satur_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_satur_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -598,8 +603,18 @@ static inline void bw_satur_process_multi( BW_ASSERT_DEEP(bw_satur_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_satur_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_satur_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_slew_lim.h b/include/bw_slew_lim.h index c13a10c..218dc25 100644 --- a/include/bw_slew_lim.h +++ b/include/bw_slew_lim.h @@ -467,6 +467,11 @@ static inline void bw_slew_lim_reset_state_multi( BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -659,7 +664,18 @@ static inline void bw_slew_lim_process_multi( BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); +#ifndef BW_NO_DEBUG + if (y != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_slew_lim_update_coeffs_ctrl(coeffs); if (y != NULL) { diff --git a/include/bw_sr_reduce.h b/include/bw_sr_reduce.h index 4e41b49..e9b0fe2 100644 --- a/include/bw_sr_reduce.h +++ b/include/bw_sr_reduce.h @@ -379,6 +379,11 @@ static inline void bw_sr_reduce_reset_state_multi( BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -472,8 +477,18 @@ static inline void bw_sr_reduce_process_multi( BW_ASSERT_DEEP(bw_sr_reduce_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_sr_reduce_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif for (size_t i = 0; i < n_channels; i++) bw_sr_reduce_process(coeffs, state[i], x[i], y[i], n_samples); diff --git a/include/bw_src.h b/include/bw_src.h index c65c412..5a11c72 100644 --- a/include/bw_src.h +++ b/include/bw_src.h @@ -322,12 +322,17 @@ static inline float bw_src_reset_state( static inline void bw_src_reset_state_multi( const bw_src_coeffs * BW_RESTRICT coeffs, bw_src_state * BW_RESTRICT const * BW_RESTRICT state, - const float * x_0, - float * y_0, - size_t n_channels) { + const float * x_0, + float * y_0, + size_t n_channels) { BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs)); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -442,9 +447,21 @@ static inline void bw_src_process_multi( BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_src_coeffs_is_valid(coeffs)); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); - BW_ASSERT((void*)x != (void*)y); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT((void *)x[i] != (void *)y[j]); +#endif BW_ASSERT(n_in_samples != NULL); BW_ASSERT(n_out_samples != NULL); BW_ASSERT(n_in_samples != n_out_samples); diff --git a/include/bw_src_int.h b/include/bw_src_int.h index 9157c1a..4e46e49 100644 --- a/include/bw_src_int.h +++ b/include/bw_src_int.h @@ -330,6 +330,11 @@ static inline void bw_src_int_reset_state_multi( BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs)); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -418,9 +423,21 @@ static inline void bw_src_int_process_multi( BW_ASSERT(coeffs != NULL); BW_ASSERT_DEEP(bw_src_int_coeffs_is_valid(coeffs)); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); - BW_ASSERT((void*)x != (void*)y); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT((void *)x[i] != (void *)y[j]); +#endif if (n_out_samples != NULL) for (size_t i = 0; i < n_channels; i++) diff --git a/include/bw_svf.h b/include/bw_svf.h index e2212da..67be868 100644 --- a/include/bw_svf.h +++ b/include/bw_svf.h @@ -501,6 +501,9 @@ static inline void bw_svf_reset_state( BW_ASSERT(y_lp_0 != NULL); BW_ASSERT(y_bp_0 != NULL); BW_ASSERT(y_hp_0 != NULL); + BW_ASSERT(y_lp_0 != y_bp_0); + BW_ASSERT(y_lp_0 != y_hp_0); + BW_ASSERT(y_bp_0 != y_hp_0); state->hp_z1 = 0.f; state->lp_z1 = x_0; @@ -534,6 +537,11 @@ static inline void bw_svf_reset_state_multi( BW_ASSERT_DEEP(bw_svf_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_svf_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_lp_0 != NULL) { @@ -632,6 +640,9 @@ static inline void bw_svf_process1( BW_ASSERT(y_lp != NULL); BW_ASSERT(y_bp != NULL); BW_ASSERT(y_hp != NULL); + BW_ASSERT(y_lp != y_bp); + BW_ASSERT(y_lp != y_hp); + BW_ASSERT(y_bp != y_hp); const float kk = coeffs->kf * state->cutoff_z1; const float lp_xz1 = state->lp_z1 + kk * state->bp_z1; @@ -750,7 +761,38 @@ static inline void bw_svf_process_multi( BW_ASSERT_DEEP(bw_svf_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_svf_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); +#ifndef BW_NO_DEBUG + if (y_lp != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y_lp[i] != y_lp[j]); + if (y_bp != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y_bp[i] != y_bp[j]); + if (y_hp != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y_hp[i] != y_hp[j]); + if (y_lp != NULL && y_bp != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y_lp[i] != y_bp[j]); + if (y_lp != NULL && y_hp != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y_lp[i] != y_hp[j]); + if (y_bp != NULL && y_hp != NULL) + for (size_t i = 0; i < n_channels; i++) + for (size_t j = 0; j < n_channels; j++) + BW_ASSERT(y_bp[i] != y_hp[j]); +#endif if (y_lp != NULL) { if (y_bp != NULL) { diff --git a/include/bw_trem.h b/include/bw_trem.h index 690106a..ef61fc2 100644 --- a/include/bw_trem.h +++ b/include/bw_trem.h @@ -387,6 +387,11 @@ static inline void bw_trem_reset_state_multi( BW_ASSERT_DEEP(bw_trem_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_trem_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -489,8 +494,18 @@ static inline void bw_trem_process_multi( BW_ASSERT_DEEP(bw_trem_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_trem_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_trem_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) { diff --git a/include/bw_wah.h b/include/bw_wah.h index b5755c2..04b316b 100644 --- a/include/bw_wah.h +++ b/include/bw_wah.h @@ -381,6 +381,11 @@ static inline void bw_wah_reset_state_multi( BW_ASSERT_DEEP(bw_wah_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_wah_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x_0 != NULL); if (y_0 != NULL) @@ -479,8 +484,18 @@ static inline void bw_wah_process_multi( BW_ASSERT_DEEP(bw_wah_coeffs_is_valid(coeffs)); BW_ASSERT_DEEP(coeffs->state >= bw_wah_coeffs_state_reset_coeffs); BW_ASSERT(state != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(state[i] != state[j]); +#endif BW_ASSERT(x != NULL); BW_ASSERT(y != NULL); +#ifndef BW_NO_DEBUG + for (size_t i = 0; i < n_channels; i++) + for (size_t j = i + 1; j < n_channels; j++) + BW_ASSERT(y[i] != y[j]); +#endif bw_wah_update_coeffs_ctrl(coeffs); for (size_t i = 0; i < n_samples; i++) {