read_interp_mod

Delay read, 16 bits, interpolated, proportional modulation input
Author: Are Leistad
License: BSD
Github: drj/delay/read_interp_mod.axo

Inlets

frac32buffer Delay time bias

frac32buffer Delay time modulation

Outlets

frac32buffer Delay output

Parameters

frac32.u.map Delay time

Attributes

objref delayname

Audio Rate
uint32_t tmp_d;
uint32_t tmp_di;
uint32_t tmp_w1;
uint32_t tmp_w2;
int32_t tmp_a1;
int32_t tmp_a2;
int32_t tmp_r;

int32_t time_mod = ___SMMUL((param_time + inlet_time) << 3, inlet_tmod << 2);
tmp_d = __USAT(param_time + inlet_time + time_mod, 27);

// Must limit the length!
uint32_t tmp_d_limited = tmp_d >> (27 - attr_delayname.LENGTHPOW);
if (tmp_d_limited > attr_delayname.LENGTHMASK - BUFSIZE) {
  tmp_d_limited = attr_delayname.LENGTHMASK - BUFSIZE;
  tmp_d = 0;
}
tmp_di = attr_delayname.writepos - tmp_d_limited - BUFSIZE + buffer_index - 1;

// Part of original code for read_interp replaced above by synced, modulated and
// limited version.
//  tmp_d  = __USAT(param_time + inlet_time,27);
//  tmp_di = attr_delayname.writepos - (tmp_d>>(27-attr_delayname.LENGTHPOW)) -
//  BUFSIZE + buffer_index -1;
tmp_w1 = (tmp_d << (attr_delayname.LENGTHPOW + 3)) & 0x3FFFFFFF;
tmp_w2 = (1 << 30) - tmp_w1;
tmp_a1 = attr_delayname.array[tmp_di & attr_delayname.LENGTHMASK] << 16;
tmp_a2 = attr_delayname.array[(tmp_di + 1) & attr_delayname.LENGTHMASK] << 16;
tmp_r = ___SMMUL(tmp_a1, tmp_w1);
tmp_r = ___SMMLA(tmp_a2, tmp_w2, tmp_r);

outlet_out = tmp_r;

Privacy

© 2024 Zrna Research