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.bipolar speed modulation
bool32 toggle playback (looped);trigger playback (1-shot)
bool32.rising reset to 'offset'
bool32.rising reset to 'startpoint'
frac32.bipolar total speed
bool32 playback state
frac32buffer.positive relative position inside table
int32 loop count since reset
int32 playhead position inside range in samples
int32 length of range in samples
frac32.s.map speed ,+ 64 normal speed forward, - 64 backward
objref table
int32_t index;
bool r;
uint8_t shift;
int ntrig;
int32_t t_speed;
int32_t start;
uint32_t count;
bool add;
bool play;
// set 'shift factor' for storing the recording length/the sync output
shift = (27 - attr_table.LENGTHPOW);
t_speed = ((inlet_speed + param_speed) * (float)(1.0f / (1 << (27 - shift))));
add = inlet_range;
start = ___SMMUL(inlet_range, inlet_startpoint) << 5;
play = inlet_play;
if (inlet_r2start && (!r)) {
index = start;
r = 1;
count = 0;
}
if (inlet_r2offset && (!r)) {
index = 0;
r = 1;
count = 0;
}
if ((!inlet_r2start) && (!inlet_r2offset))
r = 0;
outlet_count = (inlet_play) ? count : -1;
outlet_spos = ((index >> shift) > 0) ? (index >> shift) : 0;
outlet_stotal = inlet_range >> shift;
outlet_speed = inlet_speed + param_speed;
outlet_play = play;
if (t_speed > 0) {
if (index >= inlet_range) {
index = 0;
count += add;
}
} else {
if (index <= 0) {
index = inlet_range;
count += add;
}
}
outlet_pos = __USAT((index + inlet_offset), 27);
if (play)
index += t_speed;
else
outlet_pos = 0;