bool32.rising start copying
bool32 splat
bool32 clear
int32 source start
int32 destination start
int32 length of the area to copy
bool32.pulse operation done.
int32 src
int32 dst
int32 range
bool32.tgl add to src contents
bool32.tgl clear dst
objref name of the source -table
objref name of the destination - table
spinner speed
uint32_t pos;
bool doit;
bool trig;
bool splat;
bool clear;
int speed;
uint32_t src;
uint32_t dst;
uint32_t range;
uint32_t blocksize;
outlet_done = 0;
if (inlet_trig && !trig) {
speed = attr_speed << 4;
src = param_src + inlet_src;
dst = param_dst + inlet_dst;
range = param_range + inlet_range;
blocksize = range - (range % speed);
splat = param_splat || inlet_splat;
clear = !(param_clear || inlet_clear);
trig = 1;
pos = 0;
doit = 1;
}
if (!inlet_trig && !doit)
trig = 0;
// copy n chunks of size 'blocksize'
if (doit) {
if (pos < blocksize) {
{
int ii;
for (ii = 0; ii < speed; ii++) {
int spos = pos + ii + src;
int dpos = pos + ii + dst;
attr_dst.array[dpos] =
(attr_src.array[spos] + (attr_dst.array[dpos] * splat)) * clear;
}
}
pos += speed;
}
// copy what's left
else {
int ii;
for (ii = pos; ii < range; ii++) {
int spos = ii + src;
int dpos = ii + dst;
attr_dst.array[dpos] =
(attr_src.array[spos] + (attr_dst.array[dpos] * splat)) * clear;
}
doit = 0;
outlet_done = 1;
}
}