|
|
@ -50,17 +50,15 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, uint16_t d_length) |
|
|
|
_cb_index = 0; |
|
|
|
_cb_index = 0; |
|
|
|
_delay_offset = 0; |
|
|
|
_delay_offset = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (delayline == NULL) { |
|
|
|
if (delayline == NULL) |
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
if (d_length < 10) |
|
|
|
if (d_length < 10) { |
|
|
|
|
|
|
|
return (false); |
|
|
|
return (false); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_delayline = delayline; |
|
|
|
_delayline = delayline; |
|
|
|
_delay_length = d_length; |
|
|
|
_delay_length = d_length; |
|
|
|
memset(_delayline, 0, _delay_length); |
|
|
|
memset(_delayline, 0, _delay_length * sizeof(int16_t)); |
|
|
|
_delay_offset = (_delay_length - 1) >> 1; |
|
|
|
_delay_offset = _delay_length >> 1 ; |
|
|
|
|
|
|
|
|
|
|
|
return (true); |
|
|
|
return (true); |
|
|
|
} |
|
|
|
} |
|
|
@ -107,7 +105,7 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part
|
|
|
|
mod_fraction = modff(mod_index, &mod_number); // split float of mod_index into integer (= mod_number) and fraction part
|
|
|
|
|
|
|
|
|
|
|
|
// calculate modulation index into circular buffer
|
|
|
|
// calculate modulation index into circular buffer
|
|
|
|
cb_mod_index = _cb_index - mod_number; |
|
|
|
cb_mod_index = _cb_index - (_delay_offset + mod_number); |
|
|
|
if (cb_mod_index < 0) // check for negative offsets and correct them
|
|
|
|
if (cb_mod_index < 0) // check for negative offsets and correct them
|
|
|
|
cb_mod_index += _delay_length; |
|
|
|
cb_mod_index += _delay_length; |
|
|
|
|
|
|
|
|
|
|
|