summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/extra/zerox~.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/extra/zerox~.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/extra/zerox~.c')
-rw-r--r--apps/plugins/pdbox/PDa/extra/zerox~.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/zerox~.c b/apps/plugins/pdbox/PDa/extra/zerox~.c
index f97f412308..5476583501 100644
--- a/apps/plugins/pdbox/PDa/extra/zerox~.c
+++ b/apps/plugins/pdbox/PDa/extra/zerox~.c
@@ -55,60 +55,4 @@ void zerox_tilde_setup(void)
55 class_addmethod(zerox_class, (t_method)zerox_dsp, gensym("dsp"), 0); 55 class_addmethod(zerox_class, (t_method)zerox_dsp, gensym("dsp"), 0);
56 class_addbang(zerox_class, (t_method)zerox_bang); 56 class_addbang(zerox_class, (t_method)zerox_bang);
57} 57}
58#include "m_pd.h"
59
60static t_class *zerox_class;
61
62typedef struct _zerox
63{
64 t_object x_obj;
65 t_sample x_f;
66 t_int x_zeros;
67} t_zerox;
68
69
70static t_int *zerox_perform(t_int *w)
71{
72 t_zerox* x = (t_zerox*)w[1];
73 t_sample *in = (t_sample *)(w[2]);
74 int n = (int)(w[3]) ;
75
76 if (*in * x->x_f < 0) x->x_zeros++;
77 n--;
78 while (n--)
79 {
80 float f = *(in++);
81 x->x_zeros += f * *in < 0;
82 }
83 return (w+4);
84}
85
86static void zerox_dsp(t_zerox *x, t_signal **sp)
87{
88 dsp_add(zerox_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
89}
90
91
92static void zerox_bang(t_zerox* x)
93{
94 outlet_float(x->x_obj.ob_outlet,x->x_zeros);
95 x->x_zeros=0;
96}
97
98static void *zerox_new(void)
99{
100 t_zerox *x = (t_zerox *)pd_new(zerox_class);
101 outlet_new(&x->x_obj, gensym("float"));
102 x->x_f = 0;
103 x->x_zeros=0;
104 return (x);
105}
106 58
107void zerox_tilde_setup(void)
108{
109 zerox_class = class_new(gensym("zerox~"), (t_newmethod)zerox_new, 0,
110 sizeof(t_zerox), 0, A_DEFFLOAT, 0);
111 CLASS_MAINSIGNALIN(zerox_class, t_zerox, x_f);
112 class_addmethod(zerox_class, (t_method)zerox_dsp, gensym("dsp"), 0);
113 class_addbang(zerox_class, (t_method)zerox_bang);
114}