bool32.rising reset to startpoint
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.risingfalling play or dont
frac32buffer.positive drive table/read
int32 loop count since reset
int32 lenght of the loop in samples
int32 kmul
int32 kdiv
int32 length
int32 test
frac32.s.map speed ,+ 64 normal speed forward, - 64 backward
int32 mul
int32 div
objref table
float32_t index;
uint32_t indexk;
uint32_t indexm;
uint32_t indexd;
uint32_t r;
uint32_t pos;
uint32_t posm;
uint32_t posd;
int shift;
int range;
int t_speed;
int loopstart;
int reset;
int count;
bool add;
index = 0;
r = 1;
// set 'shift factor' for storing the recording length/the sync output
if (attr_table.LENGTH == 2048) {
shift = 16;
}
if (attr_table.LENGTH == 4096) {
shift = 15;
}
if (attr_table.LENGTH == 8192) {
shift = 14;
}
if (attr_table.LENGTH == 16384) {
shift = 13;
}
if (attr_table.LENGTH == 32768) {
shift = 12;
}
if (attr_table.LENGTH == 65536) {
shift = 11;
}
if (attr_table.LENGTH == 131072) {
shift = 10;
}
if (attr_table.LENGTH == 262144) {
shift = 9;
}
if (attr_table.LENGTH == 524288) {
shift = 8;
}
if (attr_table.LENGTH == 1048576) {
shift = 7;
}
if (attr_table.LENGTH == 2097152) {
shift = 6;
}
if (attr_table.LENGTH == 4194304) {
shift = 5;
}
range = (inlet_range >> shift);
loopstart = (___SMMUL(range, inlet_loopstart) << 5);
t_speed = (inlet_speed + param_speed);
reset = (___SMMUL(range, inlet_startpoint) << 5);
outlet_length = (range - loopstart) >> 4;
if (inlet_reset && r) {
index = reset;
indexm = reset >> 4;
indexd = (reset >> 4) * param_div;
r = 0;
count = 0;
} else if (!inlet_reset)
r = 1;
if (indexm >= (outlet_length))
indexm = 0;
if (indexd >= (outlet_length * param_div))
indexd = 0;
indexm += (((t_speed * param_mul) * (float)(1.0f / (1 << 27))));
indexd += (t_speed * (float)(1.0f / (1 << 27)));
outlet_kmul = indexm;
outlet_kdiv = (indexd / param_div);
outlet_count = count;
outlet_kpos = indexk >> 4;
index += (t_speed * (float)(1.0f / (1 << 27)));
indexk = index;
pos = (index + loopstart);
add = range;
// set a range
if (t_speed > 0) {
if (pos >= range) {
index = 0;
count += add;
}
} else {
if (pos <= loopstart) {
index = (range - loopstart);
count += add;
}
}
if (inlet_play)
outlet_pos = ((pos << shift) + inlet_offset);
else
outlet_pos = 0;