bool32 gate
int32 vel
None
bool32.mom send
bool32.mom reset
bool32.mom get
objref core
static const uint32_t LENGTH = 4096;
int32_t prev;
int32_t PREV;
int i;
int gtrig;
int16_t *array;
int j;
int ctrig;
int rtrig;
int GET;
int Gtrig;
static int16_t _array[LENGTH] __attribute__((section(".sdram")));
array = &_array[0];
for (i = 0; i < LENGTH; i++) {
array[i] = 0;
}
int prev = 0;
int PREV = 0;
if ((param_reset > 0) && !rtrig) {
rtrig = 1;
GET = 0;
for (i = 0; i < LENGTH; i++) {
array[i] = 0;
}
} else if (param_reset == 0) {
rtrig = 0;
}
if ((param_get > 0) && !Gtrig) {
Gtrig = 1;
for (i = 0; i < 256; i++) {
for (j = 0; j < 16; j++) {
array[i * 16 + j] = attr_core.array[i * 16 + j];
if (j > 0) {
array[i * 16 + j] -= attr_core.array[i * 16 + j - 1];
}
}
}
} else if (param_get == 0) {
Gtrig = 0;
}
if ((inlet_gate > 0) && !gtrig) {
gtrig = 1;
int32_t NOTE = inlet_vel;
NOTE = NOTE > 15 ? 15 : NOTE;
NOTE = NOTE < 0 ? 0 : NOTE;
if (GET == 0) {
PREV = prev = NOTE;
}
array[PREV + prev + NOTE] += 1;
PREV = prev * 16;
prev = NOTE * 16;
GET = 1;
} else if (inlet_gate == 0) {
gtrig = 0;
}
if ((param_send > 0) && !ctrig) {
ctrig = 1;
for (i = 0; i < 256; i++) {
for (j = 0; j < 16; j++) {
attr_core.array[i * 16 + j] = array[i * 16 + j];
if (j > 0) {
attr_core.array[i * 16 + j] += attr_core.array[i * 16 + j - 1];
}
}
}
} else if (param_send == 0) {
ctrig = 0;
}