From b2169b67926ca4cbe5a52fa9e6cc162b343023a0 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Wed, 7 Jun 2023 15:41:20 +0200 Subject: [PATCH] multichannel + no NULL to bw_{balance,pan}_process + fix doc, bw_svf_process --- TODO | 1 + .../synth_poly/src/bw_example_synth_poly.c | 21 ++- include/bw_ap1.h | 25 +++- include/bw_ap2.h | 25 +++- include/bw_balance.h | 66 ++++----- include/bw_bd_reduce.h | 26 +++- include/bw_chorus.h | 19 +++ include/bw_clip.h | 24 ++++ include/bw_comb.h | 19 +++ include/bw_common.h | 2 +- include/bw_comp.h | 20 +++ include/bw_delay.h | 24 +++- include/bw_dist.h | 18 +++ include/bw_drive.h | 18 +++ include/bw_drywet.h | 18 +++ include/bw_env_follow.h | 37 ++++- include/bw_env_gen.h | 33 ++++- include/bw_fuzz.h | 18 +++ include/bw_gain.h | 18 +++ include/bw_hp1.h | 25 +++- include/bw_hs1.h | 25 +++- include/bw_hs2.h | 25 +++- include/bw_lp1.h | 24 +++- include/bw_ls1.h | 25 +++- include/bw_ls2.h | 25 +++- include/bw_mm1.h | 25 +++- include/bw_mm2.h | 25 +++- include/bw_noise_gate.h | 28 +++- include/bw_notch.h | 25 +++- include/bw_one_pole.h | 118 +++++++++++++++- include/bw_osc_filt.h | 4 +- include/bw_osc_pulse.h | 37 ++++- include/bw_osc_tri.h | 29 ++++ include/bw_pan.h | 60 ++++---- include/bw_peak.h | 19 +++ include/bw_phase_gen.h | 129 +++++++++++++++++- include/bw_phaser.h | 19 +++ include/bw_ppm.h | 39 +++++- include/bw_reverb.h | 31 ++++- include/bw_ringmod.h | 18 +++ include/bw_satur.h | 19 +++ include/bw_slew_lim.h | 89 +++++++++++- include/bw_svf.h | 125 ++++++++++++++++- include/bw_trem.h | 25 +++- include/bw_wah.h | 25 +++- 45 files changed, 1360 insertions(+), 110 deletions(-) diff --git a/TODO b/TODO index 1f0b9d1..9fa6489 100644 --- a/TODO +++ b/TODO @@ -48,6 +48,7 @@ code: * max_delay -> set sample rate? see reverb * revise typedef style (see https://stackoverflow.com/questions/54752861/using-an-anonymous-struct-vs-a-named-struct-with-typedef) * sr-dependent vs cr-dependent coeffs? see synth poly example +* bw_buf_copy (to be used in bw_slew_lim)? build system: * make makefiles handle paths with spaces etc diff --git a/examples/synth_poly/src/bw_example_synth_poly.c b/examples/synth_poly/src/bw_example_synth_poly.c index 146723a..72d342a 100644 --- a/examples/synth_poly/src/bw_example_synth_poly.c +++ b/examples/synth_poly/src/bw_example_synth_poly.c @@ -186,7 +186,26 @@ void bw_example_synth_poly_process(bw_example_synth_poly *instance, const float* int n = instance->params[p_vco3_kbd] >= 0.5f ? instance->voices[i].note : 0; bw_phase_gen_set_frequency(&instance->voices[i].vco1_phase_gen_coeffs, 440.f * bw_pow2f_3(f1 + 8.333333333333333e-2f * instance->voices[i].note)); bw_phase_gen_set_frequency(&instance->voices[i].vco2_phase_gen_coeffs, 440.f * bw_pow2f_3(f2 + 8.333333333333333e-2f * instance->voices[i].note)); - bw_phase_gen_set_frequency(&instance->voices[i].vco3_phase_gen_coeffs, 440.f * bw_pow2f_3(f2 + 8.333333333333333e-2f * n)); + bw_phase_gen_set_frequency(&instance->voices[i].vco3_phase_gen_coeffs, 440.f * bw_pow2f_3(f3 + 8.333333333333333e-2f * n)); + } + + for (int j = 0; j < N_VOICES; j++) { + bw_phase_gen_update_coeffs_ctrl(&instance->voices[i].vco1_phase_gen_coeffs); + bw_phase_gen_update_coeffs_ctrl(&instance->voices[i].vco2_phase_gen_coeffs); + bw_phase_gen_update_coeffs_ctrl(&instance->voices[i].vco3_phase_gen_coeffs); + } + + for (int i = 0; i < n_samples; i++) { + for (int j = 0; j < N_VOICES; j++) { + bw_phase_gen_update_coeffs_audio(&instance->voices[i].vco1_phase_gen_coeffs); + bw_phase_gen_update_coeffs_audio(&instance->voices[i].vco2_phase_gen_coeffs); + bw_phase_gen_update_coeffs_audio(&instance->voices[i].vco3_phase_gen_coeffs); + } + + for (int j = 0; j < N_VOICES; j++) { + float p1, p1inc; + bw_phase_gen_process1(&instance->voices[i].vco1_phase_gen_coeffs, &instance->voices[i].vco1_phase_gen_state, &p1, &p1inc; + } } //... diff --git a/include/bw_ap1.h b/include/bw_ap1.h index d62ad65..f09b0b6 100644 --- a/include/bw_ap1.h +++ b/include/bw_ap1.h @@ -20,7 +20,7 @@ /*! * module_type {{{ dsp }}} - * version {{{ 0.4.0 }}} + * version {{{ 0.5.0 }}} * requires {{{ bw_common bw_config bw_lp1 bw_math bw_one_pole }}} * description {{{ * First-order allpass filter (90° shift at cutoff, approaching 180° shift @@ -28,6 +28,11 @@ * }}} * changelog {{{ *