From 5a4b9dc9b38fa0799cbbb47a85d6270c2cadfb98 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Sat, 24 Feb 2024 19:23:25 +0100 Subject: [PATCH] fix a few bugs in synth(pp)_{mono,poly} --- examples/synth_mono/src/plugin.h | 4 ++-- examples/synth_poly/src/plugin.h | 6 +++--- examples/synthpp_mono/src/impl.cpp | 4 ++-- examples/synthpp_poly/src/impl.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/synth_mono/src/plugin.h b/examples/synth_mono/src/plugin.h index 33104bf..9a53e67 100644 --- a/examples/synth_mono/src/plugin.h +++ b/examples/synth_mono/src/plugin.h @@ -180,8 +180,8 @@ static void plugin_set_sample_rate(plugin *instance, float sample_rate) { instance->sync_count = (size_t)bw_roundf(sample_rate * SYNC_RATE); - instance->noise_kv[0] = 6.f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs) * bw_pink_filt_get_scaling_k(&instance->pink_filt_coeffs); - instance->noise_kv[1] = 0.1f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs); + instance->noise_kv[0] = 0.1f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs); + instance->noise_kv[1] = 6.f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs) * bw_pink_filt_get_scaling_k(&instance->pink_filt_coeffs); } static size_t plugin_mem_req(plugin *instance) { diff --git a/examples/synth_poly/src/plugin.h b/examples/synth_poly/src/plugin.h index 52dad44..91490cc 100644 --- a/examples/synth_poly/src/plugin.h +++ b/examples/synth_poly/src/plugin.h @@ -171,7 +171,7 @@ static void plugin_init(plugin *instance) { instance->rand_state = 0xbaddecaf600dfeed; - for (int i = 0; i < N_VOICES; j++) { + for (int i = 0; i < N_VOICES; i++) { instance->b0[i] = instance->voices[i].buf[0]; instance->b1[i] = instance->voices[i].buf[1]; instance->b2[i] = instance->voices[i].buf[2]; @@ -218,8 +218,8 @@ static void plugin_set_sample_rate(plugin *instance, float sample_rate) { instance->sync_count = (size_t)bw_roundf(sample_rate * SYNC_RATE); - instance->noise_kv[0] = 6.f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs) * bw_pink_filt_get_scaling_k(&instance->pink_filt_coeffs); - instance->noise_kv[1] = 0.1f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs); + instance->noise_kv[0] = 0.1f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs); + instance->noise_kv[1] = 6.f * bw_noise_gen_get_scaling_k(&instance->noise_gen_coeffs) * bw_pink_filt_get_scaling_k(&instance->pink_filt_coeffs); } static size_t plugin_mem_req(plugin *instance) { diff --git a/examples/synthpp_mono/src/impl.cpp b/examples/synthpp_mono/src/impl.cpp index 59d590b..76efbf2 100644 --- a/examples/synthpp_mono/src/impl.cpp +++ b/examples/synthpp_mono/src/impl.cpp @@ -166,8 +166,8 @@ void impl_set_sample_rate(impl handle, float sample_rate) { instance->syncCount = (size_t)bw_roundf(sample_rate * SYNC_RATE); - instance->noiseKV[0] = 6.f * instance->noiseGen.getScalingK() * instance->pinkFilt.getScalingK(); - instance->noiseKV[1] = 0.1f * instance->noiseGen.getScalingK(); + instance->noiseKV[0] = 0.1f * instance->noiseGen.getScalingK(); + instance->noiseKV[1] = 6.f * instance->noiseGen.getScalingK() * instance->pinkFilt.getScalingK(); } void impl_reset(impl handle) { diff --git a/examples/synthpp_poly/src/impl.cpp b/examples/synthpp_poly/src/impl.cpp index 6c2db6b..67cb34a 100644 --- a/examples/synthpp_poly/src/impl.cpp +++ b/examples/synthpp_poly/src/impl.cpp @@ -202,8 +202,8 @@ void impl_set_sample_rate(impl handle, float sample_rate) { instance->syncCount = (size_t)bw_roundf(sample_rate * SYNC_RATE); - instance->noiseKV[0] = 6.f * instance->noiseGen.getScalingK() * instance->pinkFilt.getScalingK(); - instance->noiseKV[1] = 0.1f * instance->noiseGen.getScalingK(); + instance->noiseKV[0] = 0.1f * instance->noiseGen.getScalingK(); + instance->noiseKV[1] = 6.f * instance->noiseGen.getScalingK() * instance->pinkFilt.getScalingK(); } void impl_reset(impl handle) {