summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/intern/tabsend~.c
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-05-24 21:28:16 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-05-24 21:28:16 +0000
commit526b5580dabbfed7cfe5439dc3a90ec727f563c2 (patch)
tree22b1af92348785daad16714ee5e2b633017e0e48 /apps/plugins/pdbox/PDa/intern/tabsend~.c
parent4f2dfcc01b260d946044ef2b6af5fe36cb772c8d (diff)
downloadrockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.tar.gz
rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.zip
Cut the files in half and it might work better (note to self: check your tree is really clean before patching)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21070 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/tabsend~.c')
-rw-r--r--apps/plugins/pdbox/PDa/intern/tabsend~.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/tabsend~.c b/apps/plugins/pdbox/PDa/intern/tabsend~.c
index 4d7ac9007e..9021bac951 100644
--- a/apps/plugins/pdbox/PDa/intern/tabsend~.c
+++ b/apps/plugins/pdbox/PDa/intern/tabsend~.c
@@ -97,100 +97,3 @@ void tabsend_tilde_setup(void)
97 class_addmethod(tabsend_class, (t_method)tabsend_dsp, gensym("dsp"), 0); 97 class_addmethod(tabsend_class, (t_method)tabsend_dsp, gensym("dsp"), 0);
98} 98}
99 99
100#include <m_pd.h>
101#include <m_fixed.h>
102static t_class *tabsend_class;
103
104typedef struct _tabsend
105{
106 t_object x_obj;
107 t_sample *x_vec;
108 int x_graphperiod;
109 int x_graphcount;
110 t_symbol *x_arrayname;
111 t_clock *x_clock;
112 float x_f;
113} t_tabsend;
114
115static void tabsend_tick(t_tabsend *x);
116
117static void *tabsend_new(t_symbol *s)
118{
119 t_tabsend *x = (t_tabsend *)pd_new(tabsend_class);
120 x->x_graphcount = 0;
121 x->x_arrayname = s;
122 x->x_clock = clock_new(x, (t_method)tabsend_tick);
123 x->x_f = 0;
124 return (x);
125}
126
127static t_int *tabsend_perform(t_int *w)
128{
129 t_tabsend *x = (t_tabsend *)(w[1]);
130 t_sample *in = (t_sample *)(w[2]);
131 int n = w[3];
132 t_sample *dest = x->x_vec;
133 int i = x->x_graphcount;
134 if (!x->x_vec) goto bad;
135
136 while (n--)
137 {
138 t_sample f = *in++;
139 if (PD_BADFLOAT(f))
140 f = 0;
141 *dest++ = f;
142 }
143 if (!i--)
144 {
145 clock_delay(x->x_clock, 0);
146 i = x->x_graphperiod;
147 }
148 x->x_graphcount = i;
149bad:
150 return (w+4);
151}
152
153static void tabsend_dsp(t_tabsend *x, t_signal **sp)
154{
155 int i, vecsize;
156 t_garray *a;
157
158 if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
159 {
160 if (*x->x_arrayname->s_name)
161 error("tabsend~: %s: no such array", x->x_arrayname->s_name);
162 }
163 else if (!garray_getfloatarray(a, &vecsize, &x->x_vec))
164 error("%s: bad template for tabsend~", x->x_arrayname->s_name);
165 else
166 {
167 int n = sp[0]->s_n;
168 int ticksper = sp[0]->s_sr/n;
169 if (ticksper < 1) ticksper = 1;
170 x->x_graphperiod = ticksper;
171 if (x->x_graphcount > ticksper) x->x_graphcount = ticksper;
172 if (n < vecsize) vecsize = n;
173 garray_usedindsp(a);
174 dsp_add(tabsend_perform, 3, x, sp[0]->s_vec, vecsize);
175 }
176}
177
178static void tabsend_tick(t_tabsend *x)
179{
180 t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class);
181 if (!a) bug("tabsend_tick");
182 else garray_redraw(a);
183}
184
185static void tabsend_free(t_tabsend *x)
186{
187 clock_free(x->x_clock);
188}
189
190void tabsend_tilde_setup(void)
191{
192 tabsend_class = class_new(gensym("tabsend~"), (t_newmethod)tabsend_new,
193 (t_method)tabsend_free, sizeof(t_tabsend), 0, A_DEFSYM, 0);
194 CLASS_MAINSIGNALIN(tabsend_class, t_tabsend, x_f);
195 class_addmethod(tabsend_class, (t_method)tabsend_dsp, gensym("dsp"), 0);
196}