From baf440a171c8e58fc7772c28f74abe38605f139a Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Mon, 18 Sep 2023 13:41:15 +0200 Subject: [PATCH] finalized bw_phase_gen + updated synth(pp)_simple + better bw_svf doc --- TODO | 2 + .../src/bw_example_synth_simple.c | 8 +- examples/synth_simple/vst3/Makefile | 3 + examples/synthpp_simple/vst3/Makefile | 3 + include/bw_phase_gen.h | 670 +++++++++++++++--- include/bw_svf.h | 4 +- 6 files changed, 585 insertions(+), 105 deletions(-) diff --git a/TODO b/TODO index 79024e4..85c718e 100644 --- a/TODO +++ b/TODO @@ -28,6 +28,7 @@ finally: * state that you need different output buffers to reset * thank scientific paper authors * change config.h in examples version 1.0.0 +* "Templates must have C++ linkage"? build system: * single header generation (vs modules in bwp... to think about) @@ -75,6 +76,7 @@ code: * get current compression level, knee * src inside distortions? w/ control from outside? * make all outs nullable? +* make all reset state outs nullable (svf, phase_gen, ...)? build system: * make makefiles handle paths with spaces etc diff --git a/examples/synth_simple/src/bw_example_synth_simple.c b/examples/synth_simple/src/bw_example_synth_simple.c index 4669088..008dd8d 100644 --- a/examples/synth_simple/src/bw_example_synth_simple.c +++ b/examples/synth_simple/src/bw_example_synth_simple.c @@ -44,16 +44,18 @@ void bw_example_synth_simple_set_sample_rate(bw_example_synth_simple *instance, void bw_example_synth_simple_reset(bw_example_synth_simple *instance) { bw_phase_gen_reset_coeffs(&instance->phase_gen_coeffs); - bw_phase_gen_reset_state(&instance->phase_gen_coeffs, &instance->phase_gen_state, 0.f); + float p, inc; + bw_phase_gen_reset_state(&instance->phase_gen_coeffs, &instance->phase_gen_state, 0.f, &p, &inc); 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, 0.f); + float lp, bp, hp; + bw_svf_reset_state(&instance->svf_coeffs, &instance->svf_state, 0.f, &lp, &bp, &hp); 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); bw_ppm_reset_coeffs(&instance->ppm_coeffs); - bw_ppm_reset_state(&instance->ppm_coeffs, &instance->ppm_state); + bw_ppm_reset_state(&instance->ppm_coeffs, &instance->ppm_state, 0.f); instance->note = -1; } diff --git a/examples/synth_simple/vst3/Makefile b/examples/synth_simple/vst3/Makefile index 070f1ba..e3d8d91 100644 --- a/examples/synth_simple/vst3/Makefile +++ b/examples/synth_simple/vst3/Makefile @@ -4,3 +4,6 @@ NAME := bw_example_synth_simple SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_synth_simple.c include ${ROOT_DIR}/../../common/vst3/vst3.mk + +CXXFLAGS += -DRELEASE=1 -DNDEBUG -DBW_NO_DEBUG +#CXXFLAGS += -DDEVELOPMENT=1 -DBW_DEBUG_DEEP diff --git a/examples/synthpp_simple/vst3/Makefile b/examples/synthpp_simple/vst3/Makefile index 02790dc..ec6e210 100644 --- a/examples/synthpp_simple/vst3/Makefile +++ b/examples/synthpp_simple/vst3/Makefile @@ -4,3 +4,6 @@ NAME := bw_example_synthpp_simple SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_synthpp_simple.cpp include ${ROOT_DIR}/../../common/vst3/vst3.mk + +CXXFLAGS += -DRELEASE=1 -DNDEBUG -DBW_NO_DEBUG +#CXXFLAGS += -DDEVELOPMENT=1 -DBW_DEBUG_DEEP diff --git a/include/bw_phase_gen.h b/include/bw_phase_gen.h index e8b77bd..d66be6c 100644 --- a/include/bw_phase_gen.h +++ b/include/bw_phase_gen.h @@ -31,6 +31,14 @@ *