bool32 gate
int32 note
None
bool32.mom send
bool32.mom reset
bool32.mom get
objref core
static const uint32_t LENGTH = 1728;
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;
}
// for(i=0;i<144;i++){
//
// array[i*12]=1;
// array[i*12+2]=1;
// array[i*12+4]=1;
// array[i*12+5]=1;
// array[i*12+7]=1;
// array[i*12+9]=1;
// array[i*12+11]=1;
//}
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 < 144; i++) {
for (j = 0; j < 12; j++) {
array[i * 12 + j] = attr_core.array[i * 12 + j];
if (j > 0) {
array[i * 12 + j] -= attr_core.array[i * 12 + j - 1];
}
}
}
} else if (param_get == 0) {
Gtrig = 0;
}
if ((inlet_gate > 0) && !gtrig) {
gtrig = 1;
int32_t NOTE = inlet_note;
NOTE = NOTE - NOTE / 12 * 12;
NOTE = NOTE < 0 ? NOTE + 12 : NOTE;
if (GET == 0) {
PREV = prev = NOTE;
}
array[PREV + prev + NOTE] += 1;
PREV = prev * 12;
prev = NOTE * 12;
GET = 1;
} else if (inlet_gate == 0) {
gtrig = 0;
}
if ((param_send > 0) && !ctrig) {
ctrig = 1;
for (i = 0; i < 144; i++) {
for (j = 0; j < 12; j++) {
attr_core.array[i * 12 + j] = array[i * 12 + j];
if (j > 0) {
attr_core.array[i * 12 + j] += attr_core.array[i * 12 + j - 1];
}
}
}
} else if (param_send == 0) {
ctrig = 0;
}