Hey,
I've been writing small externals in C using pd-lib-builder (as in this tutorial) for a while, all the time not really understanding what on earth is being done with all this object-oriented business I'm writing. All the stuff that comes to and from the pure data environment is in some sort of wrapper data-type shenanigan, i.e. a float that is passed into an inlet of a pd object might be a (t_atom) with symbol "float" or it might be a (t_float) sometimes ?? And in order to interact with any of this I use a getter method, or just treat it as what it should be and cross my fingers (maybe with some forced typing now and then too). I don't like not understanding my data types, and I don't really know what documentation I can look at beyond that git repo I linked above.
anyway I'm just trying to write an object with a construction argument of one (1) float that won't crash Pd when given garbage/nothing on construction.
I'm looking for some kind of check for <t_floatarg f> that it is a ) populated and b ) actually a float.
//constructor called when a new instance is made
void *rms_tilde_new(t_floatarg f) {
t_rms_tilde *x = (t_rms_tilde *) pd_new(rms_tilde_class);
//creating a signal outlet
x->signalout = outlet_new(&x->x_obj, &s_signal);
//passing creation arguments to internal variables
x->windowsize = 64;
if(f >= 1) {
x->windowsize = f;
}
return (void *)x;
}