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 play
bool32.rising r2zero
bool32.rising reset to startpoint
frac32buffer.positive drive table/read
int32 loop count since reset
int32 playhead position in samples
int32 length of range in samples
int32 sloop
frac32.bipolar speed
frac32.s.map speed ,+ 64 normal speed forward, - 64 backward
objref table
float32_t index;
bool r;
uint8_t shift;
uint32_t range;
int32_t t_speed;
uint32_t loopstart;
uint32_t reset;
uint32_t count;
bool add;
// 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 = 1;
count = 0;
}
if (inlet_r2zero && (!r)) {
index = 0;
r = 1;
count = 0;
}
if ((!inlet_r2start) && (!inlet_r2zero))
r = 0;
outlet_count = count;
outlet_spos = index;
outlet_stotal = range;
outlet_sloop = range - loopstart;
outlet_speed = t_speed;
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;
}
}
if (inlet_play)
outlet_pos = ((int(index) << shift) + inlet_offset);
else
outlet_pos = 0;