From 9cad9262d556574c6ec84a6a8215caf599d012c0 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 16 Aug 2019 11:23:27 +0200 Subject: [PATCH] Chorus fixes. --- effect_modulated_delay.cpp | 13 +++++++------ effect_modulated_delay.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/effect_modulated_delay.cpp b/effect_modulated_delay.cpp index c4025c5..26267cd 100644 --- a/effect_modulated_delay.cpp +++ b/effect_modulated_delay.cpp @@ -90,7 +90,8 @@ void AudioEffectModulatedDelay::update(void) float mod_idx; float mod_number; float mod_fraction; - + float modulation_f32[AUDIO_BLOCK_SAMPLES]; + bp = block->data; arm_q15_to_float(modulation->data, modulation_f32, AUDIO_BLOCK_SAMPLES); mp = modulation_f32; @@ -115,15 +116,15 @@ void AudioEffectModulatedDelay::update(void) c_mod_idx += _delay_length; // linear interpolation - if (c_mod_idx < 1) + if (c_mod_idx == 0) { idx[0] = _delay_length - 1; idx[1] = 0; } - else if (c_mod_idx + 1 >= _delay_length) + else if (c_mod_idx == _delay_length - 1) { idx[0] = 0; - idx[1] = c_mod_idx; + idx[1] = _delay_length - 1; } else { @@ -131,9 +132,9 @@ void AudioEffectModulatedDelay::update(void) idx[1] = c_mod_idx + 1; } if (mod_idx < 0.0) - *bp = round(float(_delayline[idx[0]]) * (1.0 - mod_fraction) + float(_delayline[idx[1]]) * mod_fraction); + *bp = round(float(_delayline[idx[0]]) * fabs(mod_fraction) + float(_delayline[idx[1]]) * (1.0 - fabs(mod_fraction))); else - *bp = round(float(_delayline[idx[0]]) * mod_fraction + float(_delayline[idx[1]]) * (1.0 - mod_fraction)); + *bp = round(float(_delayline[idx[0]]) * (1.0 - mod_fraction) + float(_delayline[idx[1]]) * mod_fraction); // push the pointers forward bp++; // next audio data diff --git a/effect_modulated_delay.h b/effect_modulated_delay.h index 03c243f..cce71e8 100644 --- a/effect_modulated_delay.h +++ b/effect_modulated_delay.h @@ -60,7 +60,6 @@ class AudioEffectModulatedDelay : arm_biquad_casd_df1_inst_f32 filter_lp_mod; float filter_lp_state[4]; float filter_lp_coeffs[5]; - float modulation_f32[AUDIO_BLOCK_SAMPLES]; #endif };