component deadzonev2 "Return the center if within the threshold";
pin_ptr io float center = 0.0 "The center of the dead zone";
pin_ptr io float threshhold = 1.0 "The dead zone is \\fBcenter\\fR \\(+- (\\fBthreshhold\\fR/2)";
pin_ptr in float in;
pin_ptr out float out;

function _ "Update \\fBout\\fR based on \\fBin\\fR and the parameters.";

license "GPL";
;;
FUNCTION(_)
{
    hal_float_t th2 = gf(threshhold) / 2;
    hal_float_t lo = gf(center) - th2;
    hal_float_t hi = gf(center) + th2;
    hal_float_t in_ = gf(in);

    if(in_ < lo) 
        sf(out, in_ + th2);
    else if(in_ > hi) 
        sf(out, in_ - th2);
    else 
        sf(out, gf(center));

return 0;
}
