int32 trig
bool32 wavetable loaded successfully
table prefix
table suffix
combo number of waves
combo size of each wave
static const uint32_t WAVESPOW = (attr_waves);
static const uint32_t SIZEPOW = (attr_size);
static const uint32_t LENGTHPOW = (attr_waves + attr_size);
static const uint32_t LENGTH = (1 << LENGTHPOW);
static const uint32_t LENGTHMASK = ((1 << LENGTHPOW) - 1);
static const uint32_t BITS = 16;
static const uint32_t GAIN = 12;
int16_t *array;
int ntrig;
int loaded = 0;
// Logic change //
int ptrig;
int32_t pval;
int32_t logicchangetowttrigger;
// String/index //
char c[64];
int offset;
int pval2;
static int16_t _array[attr_poly][LENGTH] __attribute__((section(".sdram")));
loaded = 0;
ntrig = 0;
array = &_array[parent->polyIndex][0];
// Logic change //
ptrig = 0;
pval = 0;
// String/index //
strcpy(&c[0], "attr_prefix000attr_suffix");
offset = strlen("attr_prefix");
pval2 = 0;
if ((logicchangetowttrigger > 0) && !ntrig) {
char *filename = &c[0]; // filename internally //
ntrig = 1;
int i;
for (i = 0; i < LENGTH; i++)
array[i] = 0;
FIL FileObject;
FRESULT err;
UINT bytes_read;
err = f_open(&FileObject, filename, FA_READ | FA_OPEN_EXISTING);
if (err != FR_OK) {
report_fatfs_error(err, filename);
return;
}
int rem_sz = sizeof(array) * LENGTH;
int offset = 0;
while (rem_sz > 0) {
if (rem_sz > sizeof(fbuff)) {
err = f_read(&FileObject, fbuff, sizeof(fbuff), &bytes_read);
if (bytes_read == 0)
break;
memcpy((char *)(&array[0]) + offset, (char *)fbuff, bytes_read);
rem_sz -= bytes_read;
offset += bytes_read;
} else {
err = f_read(&FileObject, fbuff, rem_sz, &bytes_read);
memcpy((char *)(&array[0]) + offset, (char *)fbuff, bytes_read);
rem_sz = 0;
}
}
loaded = (err == FR_OK);
if (err != FR_OK) {
LogTextMessage("Read failed\n");
return;
}
err = f_close(&FileObject);
if (err != FR_OK) {
LogTextMessage("Close failed\n");
return;
}
} else if (!(logicchangetowttrigger > 0))
ntrig = 0;
outlet_loaded = loaded;
// Logic change //
if ((pval != inlet_trig) & (!ptrig)) {
logicchangetowttrigger = 1;
pval = inlet_trig;
ptrig = 1;
} else {
ptrig = 0;
logicchangetowttrigger = 0;
}
// String/index //
if (inlet_trig != pval2) {
pval2 = inlet_trig;
int i = inlet_trig;
int i0 = i / 10;
c[offset + 2] = '0' + i - 10 * i0;
i = i0;
i0 = i / 10;
c[offset + 1] = '0' + i - 10 * i0;
i = i0;
i0 = i / 10;
c[offset + 0] = '0' + i - 10 * i0;
}
// outlet_out = &c[0];