bool32.rising unhook param
frac32.positive input
frac32.positive output
bool32 hooked
frac32.u.map value
int32_t nhooked; // 0:hooked, 1:gt, 2:lt, 4:unhooked
int32_t param_cache;
int32_t tunhook;
nhooked = 4;
tunhook = 0;
if (inlet_unhook && !tunhook) {
tunhook = 1;
nhooked = 4;
} else if (!inlet_unhook) {
tunhook = 0;
}
if (nhooked) {
outlet_out = param_value;
if (param_value > inlet_in) {
nhooked |= 1;
if (nhooked == 7) {
nhooked = 0;
param_cache = param_value;
}
} else if (param_value < inlet_in) {
nhooked |= 2;
if (nhooked == 7) {
nhooked = 0;
param_cache = param_value;
}
} else {
nhooked = 0;
param_cache = param_value;
}
} else {
outlet_out = inlet_in;
if (param_cache != param_value)
nhooked = 4;
else
PExParameterChange(&parent->PExch[PARAM_INDEX_attr_legal_name_value],
inlet_in, 0xFFFD);
param_cache = inlet_in;
}
outlet_hooked = !nhooked;