component muxnv2 "Select from one of N input values";
pin_ptr in s32 sel = 0;
pin_ptr out float out "Follows the value of \\fBin<M>\\fR whereas M is the value of the \\fBsel\\fR input. \
If \\fBsel\\fR is not in the range of available inputs 0 is output.";
pin_ptr in float in#.[pincount];

instanceparam int pincount = 2;

option MAXCOUNT 16;

function _;
license "GPL";
author "Alexander Roessler";
;;
FUNCTION(_)
{
    if ((gs(sel) >= 0) && (gs(sel) < local_pincount))
    {
        sf(out, gf(in_(gs(sel))));
    }
    else
    {
        sf(out, 0.0);
    }

    return 0;
}
