frac32 input 1
frac32 input 2
frac32 input 3
frac32 input 4
frac32 input 5
frac32 input 6
frac32 input 7
frac32 input 8
charptr32 filename
frac32 o1
frac32 o2
frac32 o3
frac32 o4
frac32 o5
frac32 o6
frac32 o7
frac32 o8
frac32 o9
frac32 o10
frac32 o11
frac32 o12
frac32 o13
frac32 o14
frac32 o15
frac32 o16
frac32.s.map gain
int32.hradio source
int32.hradio destiny
bool32.mom clear
bool32.mom load
bool32.mom save
const int LENGTH = 256;
int32_t *array;
int prev;
int32_t mod[8];
int i;
int ctrig;
int ltrig;
int strig;
static int32_t _array[attr_poly][128] __attribute__((section(".sdram")));
array = &_array[parent->polyIndex][0];
if ((param_save > 0) && !strig) {
strig = 1;
FIL FileObject;
FRESULT err;
UINT bytes_written;
err = f_open(&FileObject, inlet_filename, FA_WRITE | FA_CREATE_ALWAYS);
if (err != FR_OK) {
report_fatfs_error(err, "inlet_filename");
return;
}
int rem_sz = sizeof(*array) * LENGTH;
int offset = 0;
while (rem_sz > 0) {
if (rem_sz > sizeof(fbuff)) {
memcpy((char *)fbuff, (char *)(&array[0]) + offset, sizeof(fbuff));
err = f_write(&FileObject, fbuff, sizeof(fbuff), &bytes_written);
rem_sz -= sizeof(fbuff);
offset += sizeof(fbuff);
} else {
memcpy((char *)fbuff, (char *)(&array[0]) + offset, rem_sz);
err = f_write(&FileObject, fbuff, rem_sz, &bytes_written);
rem_sz = 0;
}
}
if (err != FR_OK)
report_fatfs_error(err, "inlet_filename");
err = f_close(&FileObject);
if (err != FR_OK)
report_fatfs_error(err, "inlet_filename");
} else if (!(param_save > 0))
strig = 0;
if ((param_load > 0) && !ltrig) {
ltrig = 1;
FIL FileObject;
FRESULT err;
UINT bytes_read;
err = f_open(&FileObject, inlet_filename, FA_READ | FA_OPEN_EXISTING);
if (err != FR_OK) {
report_fatfs_error(err, inlet_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;
}
}
if (err != FR_OK) {
report_fatfs_error(err, inlet_filename);
return;
};
err = f_close(&FileObject);
if (err != FR_OK) {
report_fatfs_error(err, inlet_filename);
return;
};
} else if (!(param_load > 0))
ltrig = 0;
mod[0] = inlet_in1;
mod[1] = inlet_in2;
mod[2] = inlet_in3;
mod[3] = inlet_in4;
mod[4] = inlet_in5;
mod[5] = inlet_in6;
mod[6] = inlet_in7;
mod[7] = inlet_in8;
if ((param_clear > 0) && !ctrig) {
ctrig = 1;
for (i = 0; i < 128; i++) {
array[i] = 0;
}
} else if (param_clear == 0) {
ctrig = 0;
}
// load setting
if (!(prev == (param_source + param_destiny + param_clear + param_load))) {
PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_gain],
array[param_source + param_destiny * 8], 0xFFFD);
}
prev = param_source + param_destiny + param_clear + param_load;
// save setting
array[param_source + param_destiny * 8] = param_gain;
outlet_o1 = 0;
for (i = 0; i < 8; i++) {
outlet_o1 += ___SMMUL(array[i] << 3, mod[i] << 2);
}
outlet_o2 = 0;
for (i = 0; i < 8; i++) {
outlet_o2 += ___SMMUL(array[i + 8] << 3, mod[i] << 2);
}
outlet_o3 = 0;
for (i = 0; i < 8; i++) {
outlet_o3 += ___SMMUL(array[i + 16] << 3, mod[i] << 2);
}
outlet_o4 = 0;
for (i = 0; i < 8; i++) {
outlet_o4 += ___SMMUL(array[i + 24] << 3, mod[i] << 2);
}
outlet_o5 = 0;
for (i = 0; i < 8; i++) {
outlet_o5 += ___SMMUL(array[i + 32] << 3, mod[i] << 2);
}
outlet_o6 = 0;
for (i = 0; i < 8; i++) {
outlet_o6 += ___SMMUL(array[i + 40] << 3, mod[i] << 2);
}
outlet_o7 = 0;
for (i = 0; i < 8; i++) {
outlet_o7 += ___SMMUL(array[i + 48] << 3, mod[i] << 2);
}
outlet_o8 = 0;
for (i = 0; i < 8; i++) {
outlet_o8 += ___SMMUL(array[i + 56] << 3, mod[i] << 2);
}
outlet_o9 = 0;
for (i = 0; i < 8; i++) {
outlet_o9 += ___SMMUL(array[i + 64] << 3, mod[i] << 2);
}
outlet_o10 = 0;
for (i = 0; i < 8; i++) {
outlet_o10 += ___SMMUL(array[i + 72] << 3, mod[i] << 2);
}
outlet_o11 = 0;
for (i = 0; i < 8; i++) {
outlet_o11 += ___SMMUL(array[i + 80] << 3, mod[i] << 2);
}
outlet_o12 = 0;
for (i = 0; i < 8; i++) {
outlet_o12 += ___SMMUL(array[i + 88] << 3, mod[i] << 2);
}
outlet_o13 = 0;
for (i = 0; i < 8; i++) {
outlet_o13 += ___SMMUL(array[i + 96] << 3, mod[i] << 2);
}
outlet_o14 = 0;
for (i = 0; i < 8; i++) {
outlet_o14 += ___SMMUL(array[i + 104] << 3, mod[i] << 2);
}
outlet_o15 = 0;
for (i = 0; i < 8; i++) {
outlet_o15 += ___SMMUL(array[i + 112] << 3, mod[i] << 2);
}
outlet_o16 = 0;
for (i = 0; i < 8; i++) {
outlet_o16 += ___SMMUL(array[i + 120] << 3, mod[i] << 2);
}