From 8c9796f025fff1e6434c0650c00aa1edca536256 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Thu, 23 Mar 2023 14:03:27 +0100 Subject: [PATCH] added initial value to bw_{ap2,hs2,ls2,mm2,notch,peak,svf,wah} --- TODO | 1 + examples/fx_ap2/src/bw_example_fx_ap2.c | 2 +- .../fx_eq_3band/src/bw_example_fx_eq_3band.c | 6 +++--- examples/fx_mm2/src/bw_example_fx_mm2.c | 2 +- examples/fx_notch/src/bw_example_fx_notch.c | 2 +- examples/fx_svf/src/bw_example_fx_svf.c | 2 +- .../synth_mono/src/bw_example_synth_mono.c | 2 +- .../synth_simple/src/bw_example_synth_simple.c | 2 +- include/bw_ap2.h | 18 ++++++++++++------ include/bw_hs2.h | 16 +++++++++++----- include/bw_ls2.h | 16 +++++++++++----- include/bw_mm2.h | 16 +++++++++++----- include/bw_notch.h | 16 +++++++++++----- include/bw_peak.h | 16 +++++++++++----- include/bw_svf.h | 18 ++++++++++++------ include/bw_wah.h | 4 +++- 16 files changed, 92 insertions(+), 47 deletions(-) diff --git a/TODO b/TODO index 1ea9bc7..b72b7bb 100644 --- a/TODO +++ b/TODO @@ -34,6 +34,7 @@ code: * bw_satur gain compensation to divide by actual gain (derivative) rather than gain parameter? * cite papers, thank authors * process1 and multi-channel +* add initial state (x0) to reset state of lp1, ap1, mm1, hs1, ls1, others? all? build system: * make makefiles handle paths with spaces etc diff --git a/examples/fx_ap2/src/bw_example_fx_ap2.c b/examples/fx_ap2/src/bw_example_fx_ap2.c index 72bc08e..b12088a 100644 --- a/examples/fx_ap2/src/bw_example_fx_ap2.c +++ b/examples/fx_ap2/src/bw_example_fx_ap2.c @@ -30,7 +30,7 @@ void bw_example_fx_ap2_set_sample_rate(bw_example_fx_ap2 *instance, float sample void bw_example_fx_ap2_reset(bw_example_fx_ap2 *instance) { bw_ap2_reset_coeffs(&instance->ap2_coeffs); - bw_ap2_reset_state(&instance->ap2_coeffs, &instance->ap2_state); + bw_ap2_reset_state(&instance->ap2_coeffs, &instance->ap2_state, 0.f); } void bw_example_fx_ap2_process(bw_example_fx_ap2 *instance, const float** x, float** y, int n_samples) { diff --git a/examples/fx_eq_3band/src/bw_example_fx_eq_3band.c b/examples/fx_eq_3band/src/bw_example_fx_eq_3band.c index 982ea96..67c3c6f 100644 --- a/examples/fx_eq_3band/src/bw_example_fx_eq_3band.c +++ b/examples/fx_eq_3band/src/bw_example_fx_eq_3band.c @@ -34,11 +34,11 @@ void bw_example_fx_eq_3band_set_sample_rate(bw_example_fx_eq_3band *instance, fl void bw_example_fx_eq_3band_reset(bw_example_fx_eq_3band *instance) { bw_ls2_reset_coeffs(&instance->ls2_coeffs); - bw_ls2_reset_state(&instance->ls2_coeffs, &instance->ls2_state); + bw_ls2_reset_state(&instance->ls2_coeffs, &instance->ls2_state, 0.f); bw_peak_reset_coeffs(&instance->peak_coeffs); - bw_peak_reset_state(&instance->peak_coeffs, &instance->peak_state); + bw_peak_reset_state(&instance->peak_coeffs, &instance->peak_state, 0.f); bw_hs2_reset_coeffs(&instance->hs2_coeffs); - bw_hs2_reset_state(&instance->hs2_coeffs, &instance->hs2_state); + bw_hs2_reset_state(&instance->hs2_coeffs, &instance->hs2_state, 0.f); } void bw_example_fx_eq_3band_process(bw_example_fx_eq_3band *instance, const float** x, float** y, int n_samples) { diff --git a/examples/fx_mm2/src/bw_example_fx_mm2.c b/examples/fx_mm2/src/bw_example_fx_mm2.c index 356c0db..e33ca5d 100644 --- a/examples/fx_mm2/src/bw_example_fx_mm2.c +++ b/examples/fx_mm2/src/bw_example_fx_mm2.c @@ -30,7 +30,7 @@ void bw_example_fx_mm2_set_sample_rate(bw_example_fx_mm2 *instance, float sample void bw_example_fx_mm2_reset(bw_example_fx_mm2 *instance) { bw_mm2_reset_coeffs(&instance->mm2_coeffs); - bw_mm2_reset_state(&instance->mm2_coeffs, &instance->mm2_state); + bw_mm2_reset_state(&instance->mm2_coeffs, &instance->mm2_state, 0.f); } void bw_example_fx_mm2_process(bw_example_fx_mm2 *instance, const float** x, float** y, int n_samples) { diff --git a/examples/fx_notch/src/bw_example_fx_notch.c b/examples/fx_notch/src/bw_example_fx_notch.c index 7b885f3..15d0f5e 100644 --- a/examples/fx_notch/src/bw_example_fx_notch.c +++ b/examples/fx_notch/src/bw_example_fx_notch.c @@ -30,7 +30,7 @@ void bw_example_fx_notch_set_sample_rate(bw_example_fx_notch *instance, float sa void bw_example_fx_notch_reset(bw_example_fx_notch *instance) { bw_notch_reset_coeffs(&instance->notch_coeffs); - bw_notch_reset_state(&instance->notch_coeffs, &instance->notch_state); + bw_notch_reset_state(&instance->notch_coeffs, &instance->notch_state, 0.f); } void bw_example_fx_notch_process(bw_example_fx_notch *instance, const float** x, float** y, int n_samples) { diff --git a/examples/fx_svf/src/bw_example_fx_svf.c b/examples/fx_svf/src/bw_example_fx_svf.c index dd180b1..513849d 100644 --- a/examples/fx_svf/src/bw_example_fx_svf.c +++ b/examples/fx_svf/src/bw_example_fx_svf.c @@ -30,7 +30,7 @@ void bw_example_fx_svf_set_sample_rate(bw_example_fx_svf *instance, float sample void bw_example_fx_svf_reset(bw_example_fx_svf *instance) { bw_svf_reset_coeffs(&instance->svf_coeffs); - bw_svf_reset_state(&instance->svf_coeffs, &instance->svf_state); + bw_svf_reset_state(&instance->svf_coeffs, &instance->svf_state, 0.f); } void bw_example_fx_svf_process(bw_example_fx_svf *instance, const float** x, float** y, int n_samples) { diff --git a/examples/synth_mono/src/bw_example_synth_mono.c b/examples/synth_mono/src/bw_example_synth_mono.c index 2a9ef8a..f917b42 100644 --- a/examples/synth_mono/src/bw_example_synth_mono.c +++ b/examples/synth_mono/src/bw_example_synth_mono.c @@ -111,7 +111,7 @@ void bw_example_synth_mono_reset(bw_example_synth_mono *instance) { bw_env_gen_reset_coeffs(&instance->vcf_env_gen_coeffs); bw_env_gen_reset_state(&instance->vcf_env_gen_coeffs, &instance->vcf_env_gen_state); bw_svf_reset_coeffs(&instance->vcf_coeffs); - bw_svf_reset_state(&instance->vcf_coeffs, &instance->vcf_state); + bw_svf_reset_state(&instance->vcf_coeffs, &instance->vcf_state, 0.f); bw_env_gen_reset_coeffs(&instance->vca_env_gen_coeffs); bw_env_gen_reset_state(&instance->vca_env_gen_coeffs, &instance->vca_env_gen_state); bw_phase_gen_reset_coeffs(&instance->a440_phase_gen_coeffs); diff --git a/examples/synth_simple/src/bw_example_synth_simple.c b/examples/synth_simple/src/bw_example_synth_simple.c index 3242a95..92b3f92 100644 --- a/examples/synth_simple/src/bw_example_synth_simple.c +++ b/examples/synth_simple/src/bw_example_synth_simple.c @@ -50,7 +50,7 @@ void bw_example_synth_simple_reset(bw_example_synth_simple *instance) { bw_osc_pulse_reset_coeffs(&instance->osc_pulse_coeffs); bw_osc_filt_reset_state(&instance->osc_filt_state); bw_svf_reset_coeffs(&instance->svf_coeffs); - bw_svf_reset_state(&instance->svf_coeffs, &instance->svf_state); + bw_svf_reset_state(&instance->svf_coeffs, &instance->svf_state, 0.f); bw_env_gen_reset_coeffs(&instance->env_gen_coeffs); bw_env_gen_reset_state(&instance->env_gen_coeffs, &instance->env_gen_state); bw_gain_reset_coeffs(&instance->gain_coeffs); diff --git a/include/bw_ap2.h b/include/bw_ap2.h index 690a619..69af0f3 100644 --- a/include/bw_ap2.h +++ b/include/bw_ap2.h @@ -1,7 +1,7 @@ /* * Brickworks * - * Copyright (C) 2022 Orastron Srl unipersonale + * Copyright (C) 2022, 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 @@ -20,7 +20,7 @@ /*! * module_type {{{ dsp }}} - * version {{{ 0.3.0 }}} + * version {{{ 0.4.0 }}} * requires {{{ bw_config bw_common bw_math bw_one_pole bw_svf }}} * description {{{ * Second-order allpass filter (180° shift at cutoff, approaching 360° shift @@ -28,6 +28,11 @@ * }}} * changelog {{{ *