@ -78,11 +78,11 @@ void AudioEffectModulatedDelay::update(void)
block = receiveWritable ( 0 ) ;
modulation = receiveReadOnly ( 1 ) ;
# ifdef INTERPOLATE
# ifdef INTERPOLATE_MODE
int8_t j ;
float x [ INTERPOLATION_WINDOW_SIZE ] ;
float y [ INTERPOLATION_WINDOW_SIZE ] ;
Spline s ( x , y , INTERPOLATION_WINDOW_SIZE , INTERPOLATE ) ;
Spline s ( x , y , INTERPOLATION_WINDOW_SIZE , INTERPOLATE_MODE ) ;
# endif
bp = block - > data ;
@ -100,28 +100,25 @@ void AudioEffectModulatedDelay::update(void)
// calculate modulation index
mod_idx = float ( * mp ) / SHRT_MAX * float ( _delay_length / 2 ) ; // calculate an index with modulation as a float(!!!)
# ifdef INTERPOLATE
# ifdef INTERPOLATE_MODE
// get x/y values around mod_idx
uint8_t c = 0 ;
int16_t c_mod_idx = int ( mod_idx + 0.5 ) + _circ_idx ;
int32_t avg = 0 ;
for ( j = INTERPOLATION_WINDOW_SIZE / - 2 ; j < = INTERPOLATION_WINDOW_SIZE / 2 ; j + + )
{
int16_t jc_mod_idx = ( c_mod_idx + j ) % _delay_length - 1 ;
int16_t jc_mod_idx = ( c_mod_idx + j ) % ( _delay_length - 1 ) ;
if ( jc_mod_idx < 0 )
y [ c ] = float ( _delayline [ _delay_length - 1 + jc_mod_idx ] ) ;
else
y [ c ] = float ( _delayline [ jc_mod_idx ] ) ;
x [ c ] = float ( c ) ;
avg + = y [ c ] ;
c + + ; // because 42 is the answer! ;-)
}
//*bp = int(s.value(mod_idx - int(mod_idx + 0.5)) + 0.5);
* bp = avg / INTERPOLATION_WINDOW_SIZE ;
* bp = int ( s . value ( mod_idx - int ( mod_idx + 0.5 ) ) + 0.5 ) ;
# else
// No interpolation - should sound really bad...
int16_t c_mod_idx = ( int ( mod_idx + 0.5 ) + _circ_idx ) % _delay_length - 1 ;
int16_t c_mod_idx = ( int ( mod_idx + 0.5 ) + _circ_idx ) % ( _delay_length - 1 ) ;
if ( c_mod_idx < 0 )
* bp = _delayline [ _delay_length - 1 + c_mod_idx ] ;
else