[PD] Dev question

Krzysztof Czaja czaja at chopin.edu.pl
Wed Jan 30 14:38:16 CET 2002


hi Orm,

append (and prepend) has only one inlet, and I do not know about join.
But anyway having other than leftmost inlet to accept various messages
is not that difficult.  To give you a clue how this may be done, here
is an excerpt from my `spying' code:

static void *spy_new(...)
{
    t_spy *x = (t_spy *)pd_new(spy_class);
    t_spy *x1 = (t_spy *)pd_new(s2y_class);  /* proxy for 2nd inlet messages */
... (there are more...)

/* here goes something like: x->x_shadow = x1 */
	inlet_new(&x->x_ob, &x1->x_ob.ob_pd, 0, 0);  /* create 2nd inlet */
...
}

static void spy_free(t_spy *x)
{
...
/* here goes something like: x1 = x->x_shadow */
	    pd_free(&x1->x_ob.ob_pd);  /* this has to be done explicitly */
...
}

void spy_setup(void)
{
...
    spy_class = class_new(gensym("spy"), (t_newmethod)spy_new,
			  (t_method)spy_free, sizeof(t_spy), 0, ..., 0);
...
    s2y_class = class_new(gensym("spy (second inlet)"), 0, 0,
			  sizeof(t_spy), /* this may need to be changed */
			  CLASS_PD | CLASS_NOINLET, 0);
...
    class_addmethod(spy_class, ...
...
    class_addmethod(s2y_class, ...
...
}

Krzysztof

Orm Finnendahl wrote:
...
> I would like to know, how to implement the proxy, your're
> mentioning. I had the same problem, trying to mimik the list objects
> from Max/MSP like join and append. There is a way around that, like



More information about the Pd-list mailing list