diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/tabreceive~.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/intern/tabreceive~.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/tabreceive~.c b/apps/plugins/pdbox/PDa/intern/tabreceive~.c index 82f2ff388a..e51a5c015e 100644 --- a/apps/plugins/pdbox/PDa/intern/tabreceive~.c +++ b/apps/plugins/pdbox/PDa/intern/tabreceive~.c | |||
@@ -59,64 +59,3 @@ void tabreceive_tilde_setup(void) | |||
59 | gensym("dsp"), 0); | 59 | gensym("dsp"), 0); |
60 | } | 60 | } |
61 | 61 | ||
62 | #include <m_pd.h> | ||
63 | #include <m_fixed.h> | ||
64 | |||
65 | static t_class *tabreceive_class; | ||
66 | |||
67 | typedef struct _tabreceive | ||
68 | { | ||
69 | t_object x_obj; | ||
70 | t_sample *x_vec; | ||
71 | t_symbol *x_arrayname; | ||
72 | } t_tabreceive; | ||
73 | |||
74 | static t_int *tabreceive_perform(t_int *w) | ||
75 | { | ||
76 | t_tabreceive *x = (t_tabreceive *)(w[1]); | ||
77 | t_sample *out = (t_sample *)(w[2]); | ||
78 | int n = w[3]; | ||
79 | t_sample *from = x->x_vec; | ||
80 | if (from) while (n--) *out++ = *from++; | ||
81 | else while (n--) *out++ = 0; | ||
82 | return (w+4); | ||
83 | } | ||
84 | |||
85 | static void tabreceive_dsp(t_tabreceive *x, t_signal **sp) | ||
86 | { | ||
87 | t_garray *a; | ||
88 | int vecsize; | ||
89 | |||
90 | if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) | ||
91 | { | ||
92 | if (*x->x_arrayname->s_name) | ||
93 | error("tabsend~: %s: no such array", x->x_arrayname->s_name); | ||
94 | } | ||
95 | else if (!garray_getfloatarray(a, &vecsize, &x->x_vec)) | ||
96 | error("%s: bad template for tabreceive~", x->x_arrayname->s_name); | ||
97 | else | ||
98 | { | ||
99 | int n = sp[0]->s_n; | ||
100 | if (n < vecsize) vecsize = n; | ||
101 | garray_usedindsp(a); | ||
102 | dsp_add(tabreceive_perform, 3, x, sp[0]->s_vec, vecsize); | ||
103 | } | ||
104 | } | ||
105 | |||
106 | static void *tabreceive_new(t_symbol *s) | ||
107 | { | ||
108 | t_tabreceive *x = (t_tabreceive *)pd_new(tabreceive_class); | ||
109 | x->x_arrayname = s; | ||
110 | outlet_new(&x->x_obj, &s_signal); | ||
111 | return (x); | ||
112 | } | ||
113 | |||
114 | void tabreceive_tilde_setup(void) | ||
115 | { | ||
116 | tabreceive_class = class_new(gensym("tabreceive~"), | ||
117 | (t_newmethod)tabreceive_new, 0, | ||
118 | sizeof(t_tabreceive), 0, A_DEFSYM, 0); | ||
119 | class_addmethod(tabreceive_class, (t_method)tabreceive_dsp, | ||
120 | gensym("dsp"), 0); | ||
121 | } | ||
122 | |||