From 213978fa8a868661dda88e6b4e7cacec1c90677a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADn?= Date: Sun, 7 Sep 2003 21:45:05 +0000 Subject: Updating pdp to current version 0.12.2 svn path=/trunk/externals/pdp/; revision=941 --- modules/generic/Makefile | 15 ++ modules/generic/README | 2 + modules/generic/pdp_convert.c | 104 ++++++++++++++ modules/generic/pdp_del.c | 193 +++++++++++++++++++++++++ modules/generic/pdp_description.c | 98 +++++++++++++ modules/generic/pdp_forthproc.c | 244 +++++++++++++++++++++++++++++++ modules/generic/pdp_inspect.c | 124 ++++++++++++++++ modules/generic/pdp_loop.c | 296 ++++++++++++++++++++++++++++++++++++++ modules/generic/pdp_reg.c | 168 ++++++++++++++++++++++ modules/generic/pdp_route.c | 146 +++++++++++++++++++ modules/generic/pdp_snap.c | 120 ++++++++++++++++ modules/generic/pdp_trigger.c | 192 +++++++++++++++++++++++++ 12 files changed, 1702 insertions(+) create mode 100644 modules/generic/Makefile create mode 100644 modules/generic/README create mode 100644 modules/generic/pdp_convert.c create mode 100644 modules/generic/pdp_del.c create mode 100644 modules/generic/pdp_description.c create mode 100644 modules/generic/pdp_forthproc.c create mode 100644 modules/generic/pdp_inspect.c create mode 100644 modules/generic/pdp_loop.c create mode 100644 modules/generic/pdp_reg.c create mode 100644 modules/generic/pdp_route.c create mode 100644 modules/generic/pdp_snap.c create mode 100644 modules/generic/pdp_trigger.c (limited to 'modules/generic') diff --git a/modules/generic/Makefile b/modules/generic/Makefile new file mode 100644 index 0000000..d075b3e --- /dev/null +++ b/modules/generic/Makefile @@ -0,0 +1,15 @@ +current: all_modules + +include ../../Makefile.config + +PDP_MOD = pdp_reg.o pdp_del.o pdp_snap.o pdp_trigger.o \ + pdp_route.o pdp_inspect.o pdp_loop.o pdp_description.o pdp_convert.o \ + pdp_forthproc.o + +# build generic modules +all_modules: $(PDP_MOD) + +clean: + rm -f *~ + rm -f *.o + diff --git a/modules/generic/README b/modules/generic/README new file mode 100644 index 0000000..2c8bff0 --- /dev/null +++ b/modules/generic/README @@ -0,0 +1,2 @@ +This directory contains generic packet processors (i.e. containers). +Should work with any packet type. diff --git a/modules/generic/pdp_convert.c b/modules/generic/pdp_convert.c new file mode 100644 index 0000000..cc7dd8c --- /dev/null +++ b/modules/generic/pdp_convert.c @@ -0,0 +1,104 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" + + +typedef struct pdp_convert_struct +{ + t_object x_obj; + t_symbol *x_type_mask; + t_outlet *x_outlet0; + int x_packet0; + +} t_pdp_convert; + + + +static void pdp_convert_type_mask(t_pdp_convert *x, t_symbol *s) +{ + x->x_type_mask = s; +} + +static void pdp_convert_input_0(t_pdp_convert *x, t_symbol *s, t_floatarg f) +{ + int p = (int)f; + int passes, i; + + if (s== gensym("register_ro")){ + pdp_packet_mark_unused(x->x_packet0); + if (x->x_type_mask->s_name[0]) + x->x_packet0 = pdp_packet_convert_ro(p, pdp_gensym(x->x_type_mask->s_name)); + else + x->x_packet0 = pdp_packet_copy_ro(p); + } + + + if ((s == gensym("process")) && (-1 != x->x_packet0)){ + pdp_packet_pass_if_valid(x->x_outlet0, &x->x_packet0); + } +} + + +t_class *pdp_convert_class; + + + +void pdp_convert_free(t_pdp_convert *x) +{ + pdp_packet_mark_unused(x->x_packet0); +} + +void *pdp_convert_new(t_symbol *s) +{ + t_pdp_convert *x = (t_pdp_convert *)pd_new(pdp_convert_class); + + x->x_type_mask = s; + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + x->x_packet0 = -1; + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_convert_setup(void) +{ + + + pdp_convert_class = class_new(gensym("pdp_convert"), (t_newmethod)pdp_convert_new, + (t_method)pdp_convert_free, sizeof(t_pdp_convert), 0, A_DEFSYMBOL, A_NULL); + + + class_addmethod(pdp_convert_class, (t_method)pdp_convert_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addsymbol(pdp_convert_class, (t_method)pdp_convert_type_mask); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_del.c b/modules/generic/pdp_del.c new file mode 100644 index 0000000..4b51023 --- /dev/null +++ b/modules/generic/pdp_del.c @@ -0,0 +1,193 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" + + +typedef struct pdp_del_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet0; + + t_outlet **x_outlet; + + int *x_packet; + int x_order; + int x_head; + int x_delay; +} t_pdp_del; + + + + + +static void pdp_del_input_0(t_pdp_del *x, t_symbol *s, t_floatarg f) +{ + int in; + int out; + int packet; + + /* if this is a register_ro message or register_rw message, register with packet factory */ + /* if this is a process message, start the processing + propagate stuff to outputs */ + + if (s == gensym("register_ro")){ + in = (x->x_head % x->x_order); + //post("pdp_del: marking unused packed id=%d on loc %d", x->x_packet[0], in); + pdp_packet_mark_unused(x->x_packet[in]); + packet = pdp_packet_copy_ro((int)f); + + + // TODO TODO TODO !!!! + + //pdp_packet_print_debug((int)f); + + + + + x->x_packet[in] = packet; + //post("pdp_del: writing packed id=%d on loc %d", packet, in); + } + else if (s == gensym("process")){ + out = (((x->x_head + x->x_delay)) % x->x_order); + packet = x->x_packet[out]; + pdp_packet_pass_if_valid(x->x_outlet0, &x->x_packet[out]); + +/* + if (-1 != packet){ + //post("pdp_del: packet %d has id %d", out, packet); + pdp_packet_mark_unused(packet); + outlet_pdp(x->x_outlet0, packet); + x->x_packet[out] = -1; + } + + + else { + //post("pdp_del: packet %d is empty", out); + } +*/ + + x->x_head = (x->x_head + x->x_order - 1) % x->x_order; + } + + +} + + + + + +static void pdp_del_delay(t_pdp_del *x, t_floatarg fdel) +{ + int del = (int)fdel; + if (del < 0) del = 0; + if (del >= x->x_order) del = x->x_order - 1; + + x->x_delay = del; + +} + +static void pdp_del_reset(t_pdp_del *x) +{ + int i; + for (i=0; ix_order; i++) { + pdp_packet_mark_unused(x->x_packet[i]); + x->x_packet[i] = -1; + } + x->x_head = 0; + +} + +static void pdp_del_debug(t_pdp_del *x) +{ + int i; + post ("order %d", x->x_order); + post ("delay %d", x->x_delay); + post ("head %d", x->x_head); + for (i=0; ix_order; i++) { + post("%d ", x->x_packet[i]); + } +} + +static void pdp_del_free(t_pdp_del *x) +{ + pdp_del_reset(x); + pdp_dealloc (x->x_packet); +} + +t_class *pdp_del_class; + + + +void *pdp_del_new(t_floatarg forder, t_floatarg fdel) +{ + int order = (int)forder; + int del; + int logorder; + int i; + t_pdp_del *x = (t_pdp_del *)pd_new(pdp_del_class); + + del = order; + order++; + + if (del < 0) del = 0; + if (order <= 2) order = 2; + + //post("pdp_del: order = %d", order); + + x->x_order = order; + x->x_packet = (int *)pdp_alloc(sizeof(int)*order); + for(i=0; ix_packet[i] = -1; + x->x_delay = del; + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("delay")); + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_del_setup(void) +{ + + + pdp_del_class = class_new(gensym("pdp_del"), (t_newmethod)pdp_del_new, + (t_method)pdp_del_free, sizeof(t_pdp_del), 0, A_DEFFLOAT, A_NULL); + + class_addmethod(pdp_del_class, (t_method)pdp_del_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_del_class, (t_method)pdp_del_delay, gensym("delay"), A_DEFFLOAT, A_NULL); + class_addmethod(pdp_del_class, (t_method)pdp_del_reset, gensym("reset"), A_NULL); + + class_addmethod(pdp_del_class, (t_method)pdp_del_debug, gensym("_debug"), A_NULL); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_description.c b/modules/generic/pdp_description.c new file mode 100644 index 0000000..7da684b --- /dev/null +++ b/modules/generic/pdp_description.c @@ -0,0 +1,98 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" + + + +typedef struct pdp_description_struct +{ + t_object x_obj; + t_outlet *x_outlet; + +} t_pdp_description; + + + + +static void pdp_description_input_pdp(t_pdp_description *x, t_symbol *s, t_floatarg f) +{ + int p = (int)f; + t_symbol *rro = pdp_sym_rro(); + + if (rro == s){ + outlet_symbol(x->x_outlet, gensym(pdp_packet_get_description(p)->s_name)); + } +} + +static void pdp_description_input_dpd(t_pdp_description *x, t_symbol *s, t_floatarg f) +{ + int p = (int)f; + t_symbol *ins = pdp_sym_ins(); + + if (ins == s){ + outlet_symbol(x->x_outlet, gensym(pdp_packet_get_description(p)->s_name)); + } +} + + +static void pdp_description_free(t_pdp_description *x) +{ + +} + +t_class *pdp_description_class; + + + +static void *pdp_description_new(t_symbol *s, int argc, t_atom *argv) +{ + t_pdp_description *x = (t_pdp_description *)pd_new(pdp_description_class); + + x->x_outlet = outlet_new(&x->x_obj, &s_symbol); + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_description_setup(void) +{ + + + pdp_description_class = class_new(gensym("pdp_description"), (t_newmethod)pdp_description_new, + (t_method)pdp_description_free, sizeof(t_pdp_description), 0, A_NULL); + + class_addmethod(pdp_description_class, (t_method)pdp_description_input_pdp, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_description_class, (t_method)pdp_description_input_dpd, gensym("dpd"), A_SYMBOL, A_DEFFLOAT, A_NULL); + + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_forthproc.c b/modules/generic/pdp_forthproc.c new file mode 100644 index 0000000..011396f --- /dev/null +++ b/modules/generic/pdp_forthproc.c @@ -0,0 +1,244 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +/* + +example object definitions: + +; stack: (mix_float in_packet state_packet) + +(motion-blur + ((in 1) (feedback 0)) + ((out 0)) + (ip ip 0.0) + (dup down mix dup down down)) + + +; stack: (ouput_packet packet_type) + +(noise-gen + ((bang -1) (type 1)) + ((out 0)) + (image/YCrCb/320x240 ip) + (dup noise)) + +; constraints: +; if a processor accepts more than one atom message (float, list, pdp) +; of the same type they MUST be remapped to other inlets + +(pd-mappings + (motion-blur ((in 0) (feedback 1) (out 0))) + (noise ((out 0)))) + + +*/ + + +#include "pdp.h" +#include "pdp_forth.h" + +#define MAXINLETS 4 + +/* this object instantiates a forth processor */ + +typedef struct pdp_forthproc_struct +{ + t_object x_obj; + t_pdp_list *x_processor; // the processor definition + + + t_pdp_list *x_passive_stack; // we're still into thread processing + t_pdp_list *x_stack; + t_pdp_list *x_program; + +} t_pdp_forthproc; + + + +static int _check_portlist(t_pdp_list *l) +{ + t_pdp_atom *a; + post ("number of ports = %d", l->elements); + for (a = l->first; a; a=a->next){ + t_pdp_atom *b; + if (a->t != a_list) goto error; + if (a->w.w_list->elements != 2) goto error; + b = a->w.w_list->first; + if ((b->t != a_symbol) && (b->t != a_int)) goto error; + b = b->next; + if (b->t != a_int) goto error; + } + post ("port mappings:"); + for (a = l->first; a; a=a->next) pdp_list_print(a->w.w_list); + return 1; + error: + return 0; +} + +static int _check_processor(t_pdp_list *p) +{ + t_pdp_atom *a; + t_pdp_list *l; + + post ("list elements = %d", p->elements); + if (p->elements != 4) goto error; + for (a=p->first; a; a=a->next) if (a->t != a_list) goto error; + post ("all elements are lists: OK"); + + a = p->first; + post ("checking inlets"); + if (!_check_portlist(a->w.w_list)) goto error; + + a = a->next; + post ("checking outlets"); + if (!_check_portlist(a->w.w_list)) goto error; + + a = a->next; post ("init program:"); pdp_list_print(a->w.w_list); + a = a->next; post ("loop program:"); pdp_list_print(a->w.w_list); + + + return 1; + + error: + post("not a valid processor"); + return 0; +} + +/* this function maps an input symbol to a type (how to interpret the + anything message) and a stack index */ +static inline void pdp_forthproc_map_symbol(t_pdp_forthproc *x, t_symbol *s, + t_pdp_word_type *t, int *i) +{ +} + +/* this function stores a new item in an index on the stack + and executes the forth process if this is an active location */ +static inline void pdp_forthproc_write_stack(t_pdp_forthproc *x, int i, t_pdp_word w) +{ +} + +static void pdp_forthproc_anything(t_pdp_forthproc *x, t_symbol *s, int argc, t_atom *argv) +{ + /* if the symbol's length is one character, it's a remapped input. + this instance contains a mapping from symbol->(type, stack entry) */ + + t_pdp_word_type type = a_undef; + t_pdp_word word = (t_pdp_word)0; + int index = -1; + + /* determine what we got and where we need to put it */ + pdp_forthproc_map_symbol(x, s, &type, &index); + + /* interprete the anything message according to expected type. + and put the result in w */ + + /* TODO: put pd list <-> pdp list code in core (also in pdp_guile) */ + switch(type){ + case a_float: + case a_int: + case a_symbol: + case a_list: + case a_packet: + default: + post("got %s, and dunno what to do with it", s->s_name); + return; + + } + + /* write the word to the stack + and run the word if this was an active location */ + pdp_forthproc_write_stack(x, index, word); + +} + +static void pdp_forthproc_free(t_pdp_forthproc *x) +{ + pdp_tree_strip_packets(x->x_stack); + pdp_tree_free(x->x_stack); +} + +t_class *pdp_forthproc_class; + + +void *pdp_forthproc_new(t_symbol *s) +{ + t_pdp_forthproc *x; + + /* get processor */ + t_pdp_symbol *procname = pdp_gensym(s->s_name); + if (!procname->s_processor) return 0; + + /* allocate */ + x = (t_pdp_forthproc *)pd_new(pdp_forthproc_class); + x->x_processor = procname->s_processor; + post("pdp_forthproc %s", s->s_name); + pdp_list_print(x->x_processor); + + + if (_check_processor(x->x_processor)) post ("processor OK"); + + /* create state stack */ + x->x_stack = pdp_stack_new(); + x->x_passive_stack = pdp_stack_new(); + pdp_forth_execute_def(x->x_stack, x->x_processor->first->next->next->w.w_list); + pdp_forth_execute_def(x->x_passive_stack, x->x_processor->first->next->next->w.w_list); + post("initial stack:"); + pdp_list_print(x->x_stack); + + + /* create inlets from description */ + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_bang, gensym("A")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_bang, gensym("B")); + + + + return (void *)x; +} + + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_forthproc_setup(void) +{ + int i; + char iname[] = "i1"; + char def[] = "(((0 1) (1 0)) ((0 0)) (ip ip 0.0) (dup down mix dup down down))"; + + /* create a test processor */ + pdp_gensym("testproc")->s_processor = pdp_forth_compile_def(def); + + /* create a standard pd class */ + pdp_forthproc_class = class_new(gensym("pdp_forthproc"), (t_newmethod)pdp_forthproc_new, + (t_method)pdp_forthproc_free, sizeof(t_pdp_forthproc), 0, A_SYMBOL, A_NULL); + + /* add global message handler */ + class_addanything(pdp_forthproc_class, (t_method)pdp_forthproc_anything); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_inspect.c b/modules/generic/pdp_inspect.c new file mode 100644 index 0000000..b669475 --- /dev/null +++ b/modules/generic/pdp_inspect.c @@ -0,0 +1,124 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" + +/* adapted from the pd trigger object */ + +#define TR_BANG 0 +#define TR_FLOAT 1 +#define TR_SYMBOL 2 +#define TR_POINTER 3 +#define TR_LIST 4 +#define TR_ANYTHING 5 +#define TR_PDP 6 + +/* + +$$$TODO: emplement so that it behaves like the standard trigger object + +i.e. [trigger bang pdp pdp bang pdp] + +register_ro and register_rw messages pass right trough, +since they're not action events, only configure events. +a bang is made equivalent to a process event. + +*/ + +typedef struct pdp_inspect_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet; + +} t_pdp_inspect; + + + + +static void pdp_inspect_input_0(t_pdp_inspect *x, t_symbol *s, t_floatarg f) +{ + t_atom atom[2]; + t_symbol *pdp = gensym("pdp"); + t_symbol *prc = gensym("process"); + t_symbol *rro = gensym("register_ro"); + int i; + + + /* if there is a reg_ro, shortcut the right outlet */ + if (s == rro){ + SETSYMBOL(atom+0, s); + SETFLOAT(atom+1, f); + outlet_anything(x->x_outlet, pdp, 2, atom); + SETSYMBOL(atom+0, prc); + outlet_anything(x->x_outlet, pdp, 1, atom); + } + + +} + + + +static void pdp_inspect_free(t_pdp_inspect *x) +{ + +} + +t_class *pdp_inspect_class; + + + +static void *pdp_inspect_new(void) +{ + t_pdp_inspect *x = (t_pdp_inspect *)pd_new(pdp_inspect_class); + + + x->x_outlet = outlet_new(&x->x_obj, &s_anything); + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_inspect_setup(void) +{ + + + pdp_inspect_class = class_new(gensym("pdp_inspect_ro"), (t_newmethod)pdp_inspect_new, + (t_method)pdp_inspect_free, sizeof(t_pdp_inspect), 0, A_GIMME, A_NULL); + + class_addcreator((t_newmethod)pdp_inspect_new, gensym("pdp_t"), A_GIMME, 0); + + class_addmethod(pdp_inspect_class, (t_method)pdp_inspect_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_loop.c b/modules/generic/pdp_loop.c new file mode 100644 index 0000000..259eb8f --- /dev/null +++ b/modules/generic/pdp_loop.c @@ -0,0 +1,296 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +/* + + pdp_loop: a looping packet delay line + messages: + record x: start recording at position x (default = 0) + stop: stop recording + float: output packet at position + bang: output next packet + rewind: rewind + loop: set looping mode + +*/ + + +#include "pdp.h" +#include "pdp_internals.h" + + +typedef struct pdp_loop_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet0; + t_outlet *x_outlet1; + + int *x_packet; + int x_order; /* size of the packet loop */ + int x_play_head; /* next position to play back */ + int x_record_head; /* next position to record to */ + + int x_loop; + int x_recording_frames; /* nb frames left to record */ + //int x_recording_shot; /* single frame recording is on */ +} t_pdp_loop; + + + + + +static void pdp_loop_input_0(t_pdp_loop *x, t_symbol *s, t_floatarg f) +{ + int in; + int out; + int packet; + + + /* if recording is off, ignore packet */ + if ((!x->x_recording_frames)) return; + + /* store a packet on register ro */ + if (s == gensym("register_ro")){ + + /* delete old & store new */ + in = x->x_record_head; //% x->x_order; + pdp_packet_mark_unused(x->x_packet[in]); + packet = pdp_packet_copy_ro((int)f); + x->x_packet[in] = packet; + + /* advance head & decrease record counter */ + x->x_recording_frames--; + x->x_record_head++; + + /* turn off recording if we are at the end */ + if (x->x_record_head == x->x_order) x->x_recording_frames = 0; + } +} + + +static void pdp_loop_bang(t_pdp_loop *x){ + int out; + int packet; + + out = x->x_play_head; + + /* don't play if we're at the end of the sequence and looping is disabled */ + if ((!x->x_loop) && (out >= x->x_order)) return; + + /* wrap index */ + out %= x->x_order; + + /* output the current packet */ + packet = x->x_packet[out]; + outlet_float(x->x_outlet1, (float)out); // output location + if (-1 != packet) outlet_pdp(x->x_outlet0, packet); // output packet + + /* advance playback head */ + x->x_play_head++; + +} + + + + + + +static void pdp_loop_reset(t_pdp_loop *x) +{ + int i; + for (i=0; ix_order; i++) { + pdp_packet_mark_unused(x->x_packet[i]); + x->x_packet[i] = -1; + } + x->x_play_head = 0; + x->x_record_head = 0; + +} + +static void pdp_loop_record(t_pdp_loop *x, t_floatarg fstart, t_floatarg fdur) +{ + int istart = (int)fstart; + int idur = (int)fdur; + istart %= x->x_order; + if (istart<0) istart+= x->x_order; + if (idur <= 0) idur = x->x_order - istart; + + x->x_record_head = istart; + x->x_recording_frames = idur; +} + +static void pdp_loop_store(t_pdp_loop *x, t_floatarg f) +{ + int i = (int)f; + i %= x->x_order; + if (i<0) i+= x->x_order; + + x->x_record_head = i; + x->x_recording_frames = 1; +} + +static void pdp_loop_seek(t_pdp_loop *x, t_floatarg f) +{ + int i = (int)f; + i %= x->x_order; + if (i<0) i+= x->x_order; + + x->x_play_head = i; +} + +static void pdp_loop_seek_hot(t_pdp_loop *x, t_floatarg f) +{ + pdp_loop_seek(x, f); + pdp_loop_bang(x); +} + + +static void pdp_loop_stop(t_pdp_loop *x) +{ + x->x_recording_frames = 0; +} + +static void pdp_loop_loop(t_pdp_loop *x, t_floatarg f) +{ + if (f == 0.0f) x->x_loop = 0; + if (f == 1.0f) x->x_loop = 1; + +} +static void pdp_loop_free(t_pdp_loop *x) +{ + pdp_loop_reset(x); + pdp_dealloc (x->x_packet); +} + +static int pdp_loop_realsize(float f) +{ + int order = (int)f; + if (order <= 2) order = 2; + return order; +} + + +static void pdp_loop_resize(t_pdp_loop *x, t_floatarg f) +{ + int i; + int order = pdp_loop_realsize(f); + int *newloop; + + /* if size didn't change, do nothing */ + if (x->x_order == order) return; + + /* create new array */ + newloop = (int *)pdp_alloc(sizeof(int) * order); + + + /* extend it */ + if (x->x_order < order){ + + /* copy old packets */ + for (i=0; ix_order; i++) newloop[i] = x->x_packet[i]; + + /* loop extend the rest */ + for (i=x->x_order; ix_packet[i % x->x_order]); + + } + + /* or shrink it */ + else { + /* copy part of old packets */ + for (i=0; ix_packet[i]; + + /* delete the other part of old packets */ + for (i=order; ix_order; i++) pdp_packet_mark_unused(x->x_packet[i]); + + /* adjust heads */ + x->x_play_head %= order; + x->x_record_head %= order; + + } + + /* delete old line & store new */ + pdp_dealloc (x->x_packet); + x->x_packet = newloop; + x->x_order = order; + + +} + + +t_class *pdp_loop_class; + + + +void *pdp_loop_new(t_floatarg f) +{ + int i; + int order = pdp_loop_realsize(f); + t_pdp_loop *x = (t_pdp_loop *)pd_new(pdp_loop_class); + + x->x_order = order; + x->x_packet = (int *)pdp_alloc(sizeof(int)*order); + for(i=0; ix_packet[i] = -1; + + x->x_play_head = 0; + x->x_record_head = 0; + x->x_recording_frames = 0; + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("seek")); + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + x->x_outlet1 = outlet_new(&x->x_obj, &s_anything); + + x->x_loop = 1; + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_loop_setup(void) +{ + + + pdp_loop_class = class_new(gensym("pdp_loop"), (t_newmethod)pdp_loop_new, + (t_method)pdp_loop_free, sizeof(t_pdp_loop), 0, A_DEFFLOAT, A_NULL); + + class_addmethod(pdp_loop_class, (t_method)pdp_loop_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_record, gensym("record"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_store, gensym("store"), A_DEFFLOAT, A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_reset, gensym("reset"), A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_bang, gensym("bang"), A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_stop, gensym("stop"), A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_seek, gensym("seek"), A_DEFFLOAT, A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_resize, gensym("size"), A_FLOAT, A_NULL); + class_addmethod(pdp_loop_class, (t_method)pdp_loop_loop, gensym("loop"), A_FLOAT, A_NULL); + class_addfloat(pdp_loop_class, (t_method)pdp_loop_seek_hot); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_reg.c b/modules/generic/pdp_reg.c new file mode 100644 index 0000000..8b07c14 --- /dev/null +++ b/modules/generic/pdp_reg.c @@ -0,0 +1,168 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" +#include "pdp_png.h" +#include "pdp_internals.h" + + +typedef struct pdp_reg_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet0; + + int x_packet0; + +} t_pdp_reg; + + +static void pdp_reg_load_png(t_pdp_reg *x, t_pdp_symbol *s) +{ + int packet = pdp_packet_bitmap_from_png_file(s->s_name); + if (-1 == packet){ + post("pdp_reg: error loading png file %s", s->s_name); + } + else{ + pdp_packet_mark_unused(x->x_packet0); + x->x_packet0 = packet; + } + +} + +static void pdp_reg_save_png(t_pdp_reg *x, t_pdp_symbol *s) +{ + int newpacket = pdp_packet_convert_ro(x->x_packet0, pdp_gensym("bitmap/*/*")); + + if (-1 == newpacket){ + post("pdp_reg: nothing to save"); + return; + } + + if (!(pdp_packet_bitmap_save_png_file(newpacket, s->s_name))){ + post("pdp_reg: error saving png file %s", s->s_name); + } + + pdp_packet_mark_unused(newpacket); + +} + + +static void pdp_reg_bang(t_pdp_reg *x) +{ + + if (-1 != x->x_packet0) outlet_pdp(x->x_outlet0, x->x_packet0); + +} + + + +static void pdp_reg_input_0(t_pdp_reg *x, t_symbol *s, t_floatarg f) +{ + + /* if this is a register_ro message or register_rw message, register with packet factory */ + + /* if this is a process message, start the processing + propagate stuff to outputs */ + + if (s == gensym("register_ro")){ + pdp_packet_mark_unused(x->x_packet0); + x->x_packet0 = pdp_packet_copy_ro((int)f); + //post("in0ro: requested %d, got %d", (int)f, x->x_packet0); + } + else if (s == gensym("process")){ + pdp_reg_bang(x); + + } + + +} + + +static void pdp_reg_input_1(t_pdp_reg *x, t_symbol *s, t_floatarg f) +{ + + /* if this is a register_ro message or register_rw message, register with packet factory */ + + /* if this is a process message, start the processing + propagate stuff to outputs */ + + if (s == gensym("register_ro")){ + pdp_packet_mark_unused(x->x_packet0); + x->x_packet0 = pdp_packet_copy_ro((int)f); + //post("in0ro: requested %d, got %d", (int)f, x->x_packet0); + } + +} + + + +static void pdp_reg_free(t_pdp_reg *x) +{ + pdp_packet_mark_unused(x->x_packet0); + +} + +t_class *pdp_reg_class; + + + +void *pdp_reg_new(void) +{ + t_pdp_reg *x = (t_pdp_reg *)pd_new(pdp_reg_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("pdp"), gensym("pdp1")); + + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + + x->x_packet0 = -1; + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_reg_setup(void) +{ + + + pdp_reg_class = class_new(gensym("pdp_reg"), (t_newmethod)pdp_reg_new, + (t_method)pdp_reg_free, sizeof(t_pdp_reg), 0, A_NULL); + + + class_addmethod(pdp_reg_class, (t_method)pdp_reg_bang, gensym("bang"), A_NULL); + + class_addmethod(pdp_reg_class, (t_method)pdp_reg_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_reg_class, (t_method)pdp_reg_input_1, gensym("pdp1"), A_SYMBOL, A_DEFFLOAT, A_NULL); + + class_addmethod(pdp_reg_class, (t_method)pdp_reg_save_png, gensym("save_png"), A_SYMBOL, A_NULL); + class_addmethod(pdp_reg_class, (t_method)pdp_reg_load_png, gensym("load_png"), A_SYMBOL, A_NULL); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_route.c b/modules/generic/pdp_route.c new file mode 100644 index 0000000..c410d1f --- /dev/null +++ b/modules/generic/pdp_route.c @@ -0,0 +1,146 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" +#include "pdp_internals.h" + +// dynamic ???? +#define PDP_ROUTE_MAX_NB_OUTLETS 100 + +typedef struct pdp_route_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet[PDP_ROUTE_MAX_NB_OUTLETS]; + + int x_nb_outlets; + int x_route; + int x_route_next; + + +} t_pdp_route; + + +static void pdp_route_input_0(t_pdp_route *x, t_symbol *s, t_floatarg f) +{ + t_atom atom[2]; + t_symbol *pdp = gensym("pdp"); + + + /* trigger on register_ro */ + if (s == gensym("register_ro")){ + x->x_route = x->x_route_next; + } + + /* propagate the pdp message */ + SETSYMBOL(atom+0, s); + SETFLOAT(atom+1, f); + outlet_anything(x->x_outlet[x->x_route], pdp, 2, atom); + +} + +static void pdp_route_input_0_dpd(t_pdp_route *x, t_symbol *s, t_floatarg f) +{ + + /* trigger on accumulate */ + if (s == gensym("accumulate")){ + x->x_route = x->x_route_next; + } + + /* propagate the dpd message */ + outlet_dpd(x->x_outlet[x->x_route], (int)f); + +} + + + +static void pdp_route_route(t_pdp_route *x, t_floatarg f) +{ + int route = (int)f; + + if (route < 0) route = 0; + if (route >= x->x_nb_outlets) route = x->x_nb_outlets - 1; + + x->x_route_next = route; + +} + + + +static void pdp_route_free(t_pdp_route *x) +{ + +} + +t_class *pdp_route_class; + + + +void *pdp_route_new(t_floatarg f) +{ + int nboutlets = (int)f; + int i; + + t_pdp_route *x = (t_pdp_route *)pd_new(pdp_route_class); + + + if (nboutlets < 2) nboutlets = 2; + if (nboutlets >= PDP_ROUTE_MAX_NB_OUTLETS) nboutlets = PDP_ROUTE_MAX_NB_OUTLETS - 1; + + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("route")); + + x->x_nb_outlets = nboutlets; + x->x_route = 0; + x->x_route_next = 0; + + for (i=0; ix_outlet[i] = outlet_new(&x->x_obj, &s_anything); + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_route_setup(void) +{ + + + pdp_route_class = class_new(gensym("pdp_route"), (t_newmethod)pdp_route_new, + (t_method)pdp_route_free, sizeof(t_pdp_route), 0, A_DEFFLOAT, A_NULL); + + + class_addmethod(pdp_route_class, (t_method)pdp_route_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_route_class, (t_method)pdp_route_input_0_dpd, gensym("dpd"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_route_class, (t_method)pdp_route_route, gensym("route"), A_DEFFLOAT, A_NULL); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_snap.c b/modules/generic/pdp_snap.c new file mode 100644 index 0000000..73ec26c --- /dev/null +++ b/modules/generic/pdp_snap.c @@ -0,0 +1,120 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" +#include "pdp_internals.h" + +typedef struct pdp_snap_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet0; + + int x_packet0; + bool x_snapnext; + +} t_pdp_snap; + + +static void pdp_snap_bang(t_pdp_snap *x) +{ + + if (-1 != x->x_packet0) + outlet_pdp(x->x_outlet0, x->x_packet0); + +} + + + + +static void pdp_snap_input_1(t_pdp_snap *x, t_symbol *s, t_floatarg f) +{ + + /* if this is a register_ro message or register_rw message, register with packet factory */ + + /* if this is a process message, start the processing + propagate stuff to outputs */ + + if (s == gensym("register_ro")){ + if(x->x_snapnext) { + pdp_packet_mark_unused(x->x_packet0); + x->x_packet0 = pdp_packet_copy_ro((int)f); + x->x_snapnext = false; + } + } + +} + +static void pdp_snap_snap(t_pdp_snap *x) +{ + x->x_snapnext = true; +} + +static void pdp_snap_free(t_pdp_snap *x) +{ + pdp_packet_mark_unused(x->x_packet0); + +} + +t_class *pdp_snap_class; + + + +void *pdp_snap_new(void) +{ + t_pdp_snap *x = (t_pdp_snap *)pd_new(pdp_snap_class); + + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("pdp"), gensym("pdp1")); + + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + + x->x_packet0 = -1; + x->x_snapnext = false; + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_snap_setup(void) +{ + + + pdp_snap_class = class_new(gensym("pdp_snap"), (t_newmethod)pdp_snap_new, + (t_method)pdp_snap_free, sizeof(t_pdp_snap), 0, A_NULL); + + + class_addmethod(pdp_snap_class, (t_method)pdp_snap_bang, gensym("bang"), A_NULL); + class_addmethod(pdp_snap_class, (t_method)pdp_snap_snap, gensym("snap"), A_NULL); + + class_addmethod(pdp_snap_class, (t_method)pdp_snap_input_1, gensym("pdp1"), A_SYMBOL, A_DEFFLOAT, A_NULL); + +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/generic/pdp_trigger.c b/modules/generic/pdp_trigger.c new file mode 100644 index 0000000..4bac9d1 --- /dev/null +++ b/modules/generic/pdp_trigger.c @@ -0,0 +1,192 @@ +/* + * Pure Data Packet module. + * Copyright (c) by Tom Schouten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + + +#include "pdp.h" +#include "pdp_internals.h" + +/* adapted from the pd trigger object */ + +#define TR_BANG 0 +#define TR_FLOAT 1 +#define TR_SYMBOL 2 +#define TR_POINTER 3 +#define TR_LIST 4 +#define TR_ANYTHING 5 +#define TR_PDP 6 + +/* + +$$$TODO: emplement so that it behaves like the standard trigger object + +i.e. [trigger bang pdp pdp bang pdp] + +register_ro and register_rw messages pass right trough, +since they're not action events, only configure events. +a bang is made equivalent to a process event. + +*/ + +typedef struct triggerout +{ + int u_type; /* outlet type from above */ + t_outlet *u_outlet; +} t_triggerout; + + +typedef struct pdp_trigger_struct +{ + t_object x_obj; + t_float x_f; + + int x_n; + t_triggerout *x_vec; + +} t_pdp_trigger; + + + + +static void pdp_trigger_input_pdp(t_pdp_trigger *x, t_symbol *s, t_floatarg f) +{ + t_atom atom[2]; + t_symbol *pdp = pdp_sym_pdp(); + t_symbol *prc = pdp_sym_prc(); + t_triggerout *u; + int i; + + for (i = x->x_n, u = x->x_vec + i; u--, i--;){ + /* trigger bang outlet only when a process event is recieved */ + if ((u->u_type == TR_BANG) && (s == prc)){ + outlet_bang(u->u_outlet); + } + /* just pass the message if it is a pdp outlet */ + if ((u->u_type) == TR_PDP){ + SETSYMBOL(atom+0, s); + SETFLOAT(atom+1, f); + if (s == prc) outlet_anything(u->u_outlet, pdp, 1, atom); + else outlet_anything(u->u_outlet, pdp, 2, atom); + + } + } + +} + +static void pdp_trigger_input_dpd(t_pdp_trigger *x, t_symbol *s, t_floatarg f) +{ + t_atom atom[2]; + t_symbol *dpd = pdp_sym_dpd(); + t_symbol *acc = pdp_sym_acc(); + t_triggerout *u; + int i; + int p = (int)f; + + for (i = x->x_n, u = x->x_vec + i; u--, i--;){ + /* trigger outlet only when an accumulate event is recieved */ + if (s == acc){ + + /* output bang */ + if (u->u_type == TR_BANG) outlet_bang(u->u_outlet); + + /* output a complete dpd message if it is a pdp outlet */ + if ((u->u_type) == TR_PDP){ + outlet_dpd(u->u_outlet, p); + } + } + } + +} + + +static void pdp_trigger_free(t_pdp_trigger *x) +{ + pdp_dealloc(x->x_vec); +} + +t_class *pdp_trigger_class; + + + +static void *pdp_trigger_new(t_symbol *s, int argc, t_atom *argv) +{ + t_pdp_trigger *x = (t_pdp_trigger *)pd_new(pdp_trigger_class); + t_atom defarg[2], *ap; + t_triggerout *u; + int i; + + + if (!argc) + { + argv = defarg; + argc = 2; + SETSYMBOL(&defarg[0], gensym("pdp")); + SETSYMBOL(&defarg[1], gensym("bang")); + } + + x->x_n = argc; + x->x_vec = pdp_alloc(argc * sizeof(*x->x_vec)); + + for (i = 0, ap = argv, u = x->x_vec; i < argc; u++, ap++, i++) + { + t_atomtype thistype = ap->a_type; + char c; + if (thistype == TR_SYMBOL) c = ap->a_w.w_symbol->s_name[0]; + else c = 0; + if (c == 'p') + u->u_type = TR_PDP, + u->u_outlet = outlet_new(&x->x_obj, &s_anything); + else if (c == 'b') + u->u_type = TR_BANG, u->u_outlet = outlet_new(&x->x_obj, &s_bang); + else + { + pd_error(x, "pdp_trigger: %s: bad type", ap->a_w.w_symbol->s_name); + u->u_type = TR_BANG, u->u_outlet = outlet_new(&x->x_obj, &s_bang); + } + } + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_trigger_setup(void) +{ + + + pdp_trigger_class = class_new(gensym("pdp_trigger"), (t_newmethod)pdp_trigger_new, + (t_method)pdp_trigger_free, sizeof(t_pdp_trigger), 0, A_GIMME, A_NULL); + + class_addcreator((t_newmethod)pdp_trigger_new, gensym("pdp_t"), A_GIMME, 0); + + class_addmethod(pdp_trigger_class, (t_method)pdp_trigger_input_pdp, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_trigger_class, (t_method)pdp_trigger_input_dpd, gensym("dpd"), A_SYMBOL, A_DEFFLOAT, A_NULL); + + +} + +#ifdef __cplusplus +} +#endif -- cgit v1.2.1