frac32.positive offset inside the table
frac32.positive length of the area to index,or loop end
frac32.positive position inside range on reset
frac32.positive loopstart inside range
frac32.bipolar speed modulation
bool32.rising r2zero
bool32.rising reset to startpoint
frac32buffer.positive drive table/read
int32 loop count since reset
int32 lenght of the loop in samples
int32 slength
frac32.s.map speed ,+ 64 normal speed forward, - 64 backward
objref table
float32_t index;
bool r;
bool rzero;
uint8_t shift;
uint32_t range;
int32_t t_speed;
uint32_t loopstart;
uint32_t reset;
uint32_t count;
bool add;
index = 0;
r = 1;
// set 'shift factor' for storing the recording length/the sync output
shift = (27 - attr_table.LENGTHPOW);
range = (inlet_range >> shift);
loopstart = (___SMMUL(range, inlet_loopstart) << 5);
t_speed = (inlet_speed + param_speed);
add = range;
reset = (___SMMUL(range, inlet_startpoint) << 5);
if (inlet_r2start && r) {
index = reset;
r = 0;
count = 0;
} else if (!inlet_r2start)
r = 1;
if (inlet_r2zero && rzero) {
index = 0;
rzero = 0;
count = 0;
} else if (!inlet_r2zero)
rzero = 1;
outlet_count = count;
outlet_spos = index - (loopstart * (bool)count);
outlet_slength = range - (loopstart * (bool)count);
index += (t_speed * (float)(1.0f / (1 << 27)));
// set a range
if (t_speed > 0) {
if (index >= range) {
index = loopstart;
count += add;
}
} else {
if (index <= loopstart) {
index = range;
count += add;
}
}
outlet_pos = ((int(index) << shift) + inlet_offset);