From cb91af4576aa5de46124b31241687e66b7474c3e Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Tue, 19 Sep 2023 14:35:38 +0200 Subject: [PATCH] finalized bw_{sr_reduce,bd_reduce} + examples --- TODO | 1 + .../fx_bitcrush/src/bw_example_fx_bitcrush.c | 7 +- examples/fx_bitcrush/vst3/Makefile | 3 + examples/fxpp_bitcrush/vst3/Makefile | 3 + include/bw_bd_reduce.h | 294 +++++++++-- include/bw_sr_reduce.h | 465 ++++++++++++++++-- 6 files changed, 689 insertions(+), 84 deletions(-) diff --git a/TODO b/TODO index 3c8457c..bed6c55 100644 --- a/TODO +++ b/TODO @@ -78,6 +78,7 @@ code: * make all outs nullable? * make all reset state outs nullable (svf, phase_gen, ...)? * ring mod fx module? +* bitcrusher module? build system: * make makefiles handle paths with spaces etc diff --git a/examples/fx_bitcrush/src/bw_example_fx_bitcrush.c b/examples/fx_bitcrush/src/bw_example_fx_bitcrush.c index 885df2e..27ef435 100644 --- a/examples/fx_bitcrush/src/bw_example_fx_bitcrush.c +++ b/examples/fx_bitcrush/src/bw_example_fx_bitcrush.c @@ -26,12 +26,13 @@ void bw_example_fx_bitcrush_init(bw_example_fx_bitcrush *instance) { } void bw_example_fx_bitcrush_set_sample_rate(bw_example_fx_bitcrush *instance, float sample_rate) { - (void)instance; - (void)sample_rate; + bw_sr_reduce_set_sample_rate(&instance->sr_reduce_coeffs, sample_rate); + bw_bd_reduce_set_sample_rate(&instance->bd_reduce_coeffs, sample_rate); } void bw_example_fx_bitcrush_reset(bw_example_fx_bitcrush *instance) { - bw_sr_reduce_reset_state(&instance->sr_reduce_coeffs, &instance->sr_reduce_state); + bw_sr_reduce_reset_coeffs(&instance->sr_reduce_coeffs); + bw_sr_reduce_reset_state(&instance->sr_reduce_coeffs, &instance->sr_reduce_state, 0.f); bw_bd_reduce_reset_coeffs(&instance->bd_reduce_coeffs); } diff --git a/examples/fx_bitcrush/vst3/Makefile b/examples/fx_bitcrush/vst3/Makefile index 82de167..85be32b 100644 --- a/examples/fx_bitcrush/vst3/Makefile +++ b/examples/fx_bitcrush/vst3/Makefile @@ -4,3 +4,6 @@ NAME := bw_example_fx_bitcrush SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fx_bitcrush.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/fxpp_bitcrush/vst3/Makefile b/examples/fxpp_bitcrush/vst3/Makefile index f2a1743..ce871a7 100644 --- a/examples/fxpp_bitcrush/vst3/Makefile +++ b/examples/fxpp_bitcrush/vst3/Makefile @@ -4,3 +4,6 @@ NAME := bw_example_fxpp_bitcrush SOURCES = ${SOURCES_COMMON} ${ROOT_DIR}/../src/bw_example_fxpp_bitcrush.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_bd_reduce.h b/include/bw_bd_reduce.h index cd0ce26..3ed8d37 100644 --- a/include/bw_bd_reduce.h +++ b/include/bw_bd_reduce.h @@ -33,6 +33,7 @@ *