Re: Creating an external with a left inlet allowing floats

Hi,

oops.

To get a float in the leftmost inlet you just need to use “class_addmethod” in your main method.

int main(void)
{
    c = class_new("flop", (method)flop_new, NULL, (long)(sizeof(t_flop)), 0L, A_GIMME, 0);
    class_addmethod(c, (method)flop_float, "float", A_FLOAT, 0);
    class_register(CLASS_BOX, c);
    flop_class = c;

    return 0;
}

void flop_float(t_flop *x, double f)
{
    post("%lf", f);
}
Attachments:
  1. flop.c
Apr 1, 2013 at 4:08pm #242700