frac32 rate
bool32 morph
bool32 get
int32 preset
int32 pre
frac32 rate
int32.mini value
bool32.mom morph
bool32.mom get
bool32.mom rnd
int32 preset
frac32.s.map rate
spinner parameters
spinner presets
spinner preparams
bool get;
static const uint32_t params = attr_parameters;
static const uint32_t presets = attr_presets;
static const uint32_t LENGTH = params * presets;
int32_t *pst;
int i;
int j;
bool A;
bool rnd;
int32_t TP[params];
bool pv;
int P;
int16_t pre;
bool DO;
static int32_t _array[LENGTH] __attribute__((section(".sdram")));
pst = &_array[0];
pre = 0;
DO = 1;
if (DO) {
while (!(parent->PExch[pre].value == param_value)) {
pre += 1;
}
pre += 6;
DO = 0;
}
if (param_preset >= presets) {
PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_preset],
presets - 1, 0xFFFD);
}
P = param_preset + inlet_preset;
P = P - P / presets * presets;
P = (P < 0 ? P + presets : P) * params;
int32_t rate;
MTOF(__SSAT((-1 << 27) + (inlet_rate << 1), 29), rate)
rate = rate >> 2;
A = param_morph || inlet_morph;
bool GET = param_get || inlet_get;
if ((GET > 0) && !get) {
get = 1;
for (i = 0; i < params; i++) {
pst[P + i] = parent->PExch[i + pre].value;
}
} else if (GET == 0) {
get = 0;
}
if (A > 0) {
for (j = 0; j < params; j++) {
if (!(pst[P + j] == parent->PExch[j + pre].value)) {
if (!(pv == A)) {
TP[j] = (pst[P + j]) - (parent->PExch[j + pre].value);
}
int32_t Tm = ___SMMUL(TP[j], rate);
Tm = Tm == 0 ? TP[j] > 0 ? 1 : -1 : Tm;
int32_t tmp = Tm + parent->PExch[j + pre].value;
if (TP[j] > 0) {
tmp = tmp > pst[P + j] ? pst[P + j] : tmp;
} else {
tmp = tmp < pst[P + j] ? pst[P + j] : tmp;
}
PExParameterChange(
&parent->PExch[PARAM_INDEX_attr_legal_name_value + j + 6], tmp,
0xFFFD);
}
}
}
if ((param_rnd > 0) && !rnd) {
rnd = 1;
for (j = 0; j < params; j++) {
for (i = 0; i < presets; i++) {
pst[i * params + j] = (int32_t)GenerateRandomNumber() >> 4;
}
}
} else if (param_rnd == 0) {
rnd = 0;
}
outlet_pre = pre;
pv = A;