diff options
Diffstat (limited to 'old')
-rw-r--r-- | old/destroysend-help.pd | 13 | ||||
-rw-r--r-- | old/destroysend.c | 50 |
2 files changed, 63 insertions, 0 deletions
diff --git a/old/destroysend-help.pd b/old/destroysend-help.pd new file mode 100644 index 0000000..8b8f45b --- /dev/null +++ b/old/destroysend-help.pd @@ -0,0 +1,13 @@ +#N canvas 455 76 573 366 10; +#X obj 241 236 print DESTROYED; +#X text 225 139 <- Create and destroy this external. It will send a +bang to [receive test] everythime it is destroyed.; +#X obj 241 203 receive test; +#X obj 84 82 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 +-1; +#X obj 84 142 destroysend test; +#X obj 84 303 destroysend; +#X text 170 300 <- If it is created without an argument \, you can +set the target through the right inlet.; +#X connect 2 0 0 0; +#X connect 3 0 4 0; diff --git a/old/destroysend.c b/old/destroysend.c new file mode 100644 index 0000000..fbf3466 --- /dev/null +++ b/old/destroysend.c @@ -0,0 +1,50 @@ +// Made by tof@danslchamp.prg + +#include "m_pd.h" +#include <string.h> +#include <stdio.h> + +static t_class *destroysend_class; + +typedef struct _destroysend { + t_object x_obj; + t_symbol *x_sym; //from pd_send +} t_destroysend; + +void destroysend_bang(t_destroysend *x) +{ + //post("Hello world !!"); +//From pd_send + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); +//END +} + + +void *destroysend_new(t_symbol *s) //Added args from pd send +{ + t_destroysend *x = (t_destroysend *)pd_new(destroysend_class); + +//From pd_send + + if (!*s->s_name) symbolinlet_new(&x->x_obj, &x->x_sym); + x->x_sym = s; + +//END + + return (void *)x; //return (x); +} + + +void *destroysend_free(t_destroysend *x)
+{ + if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing);
+ //post("Killing !!");
+ return 0;
+} + +void destroysend_setup(void) { + + destroysend_class = class_new(gensym("destroysend"),(t_newmethod)destroysend_new,(t_method)destroysend_free, +sizeof(t_destroysend),0, A_DEFSYM, 0); + class_addbang(destroysend_class, destroysend_bang); +} |