|
|
@ -46,7 +46,6 @@ boolean AudioEffectModulatedDelay::begin(short *delayline, int d_length) |
|
|
|
_delayline = NULL; |
|
|
|
_delayline = NULL; |
|
|
|
_delay_length = 0; |
|
|
|
_delay_length = 0; |
|
|
|
_delay_offset = 0.0; |
|
|
|
_delay_offset = 0.0; |
|
|
|
_modulation_intensity = 0.0; |
|
|
|
|
|
|
|
_circ_idx = 0; |
|
|
|
_circ_idx = 0; |
|
|
|
|
|
|
|
|
|
|
|
if (delayline == NULL) { |
|
|
|
if (delayline == NULL) { |
|
|
@ -73,7 +72,7 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
block = receiveWritable(0); |
|
|
|
block = receiveWritable(0); |
|
|
|
modulation = receiveReadOnly(1); |
|
|
|
modulation = receiveReadOnly(1); |
|
|
|
|
|
|
|
|
|
|
|
if (block && modulation && _modulation_intensity > 0.1) |
|
|
|
if (block && modulation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int16_t *bp; |
|
|
|
int16_t *bp; |
|
|
|
float *mp; |
|
|
|
float *mp; |
|
|
@ -94,7 +93,7 @@ void AudioEffectModulatedDelay::update(void) |
|
|
|
_delayline[_circ_idx] = *bp; |
|
|
|
_delayline[_circ_idx] = *bp; |
|
|
|
|
|
|
|
|
|
|
|
// Calculate the modulation-index as a floating point number for interpolation
|
|
|
|
// Calculate the modulation-index as a floating point number for interpolation
|
|
|
|
mod_idx = _delay_offset + (*mp * _modulation_intensity); |
|
|
|
mod_idx = _delay_offset + (*mp * (1 - MODULATION_MAX_FACTOR) * _delay_length); |
|
|
|
mod_fraction = modff(mod_idx, &mod_number); |
|
|
|
mod_fraction = modff(mod_idx, &mod_number); |
|
|
|
|
|
|
|
|
|
|
|
// calculate modulation index into circular buffer
|
|
|
|
// calculate modulation index into circular buffer
|
|
|
@ -149,13 +148,3 @@ float AudioEffectModulatedDelay::offset(float offset_value) // in ms |
|
|
|
|
|
|
|
|
|
|
|
return (offset_frames / AUDIO_SAMPLE_RATE * 1000); |
|
|
|
return (offset_frames / AUDIO_SAMPLE_RATE * 1000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void AudioEffectModulatedDelay::intensity(float intensity_value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (intensity_value > 1.0) |
|
|
|
|
|
|
|
intensity_value = 1.0; |
|
|
|
|
|
|
|
else if (intensity_value < 0.0) |
|
|
|
|
|
|
|
intensity_value = 0.0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_modulation_intensity = intensity_value * (1 - MODULATION_MAX_FACTOR) * 2 * _delay_length; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|