|
|
@ -107,6 +107,7 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
if (block && modulation) |
|
|
|
if (block && modulation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int16_t *bp; |
|
|
|
int16_t *bp; |
|
|
|
|
|
|
|
int16_t cb_mod_index_neighbor; |
|
|
|
float *mp; |
|
|
|
float *mp; |
|
|
|
float mod_index; |
|
|
|
float mod_index; |
|
|
|
float mod_number; |
|
|
|
float mod_number; |
|
|
@ -130,11 +131,31 @@ 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 - (_delay_offset + int(mod_index))) % _delay_length; |
|
|
|
cb_mod_index = (_cb_index - (_delay_offset + int(mod_index))); |
|
|
|
|
|
|
|
if (cb_mod_index >= _delay_length) |
|
|
|
|
|
|
|
cb_mod_index -= _delay_length; |
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
*bp = round(float(_delayline[cb_mod_index]) * mod_fraction + float(_delayline[cb_mod_index + 1]) * (1.0 - mod_fraction)); |
|
|
|
if (*mp < 0.0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (cb_mod_index == 0) |
|
|
|
|
|
|
|
cb_mod_index_neighbor = _delay_length; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
cb_mod_index_neighbor = cb_mod_index - 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (cb_mod_index == _delay_length) |
|
|
|
|
|
|
|
cb_mod_index_neighbor = 0; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
cb_mod_index_neighbor = cb_mod_index + 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (*mp < 0.0) |
|
|
|
|
|
|
|
*bp = round(float(_delayline[cb_mod_index]) * mod_fraction + float(_delayline[cb_mod_index_neighbor]) * (1.0 - mod_fraction)); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
*bp = round(float(_delayline[cb_mod_index_neighbor]) * mod_fraction + float(_delayline[cb_mod_index]) * (1.0 - mod_fraction)); |
|
|
|
|
|
|
|
|
|
|
|
// push the pointers forward
|
|
|
|
// push the pointers forward
|
|
|
|
bp++; // next audio data
|
|
|
|
bp++; // next audio data
|
|
|
|