frac32.positive input
bool32.rising unhook param
bool32 hooked
frac32.positive output
frac32.u.map value
objref x
int32_t nhooked; // 0:hooked, 1:gt, 2:lt, 4:unhooked
int32_t param_cache;
int32_t tunhook;
bool registered = false;
nhooked = 4;
tunhook = 0;
if (!registered) {
attr_x.registerParam(PARAM_INDEX_attr_legal_name_value,
"attr_legal_name_value");
registered = true;
}
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;