Fix pdbox makefile to actually take part in dependency generation
[kugel-rb.git] / apps / plugins / pdbox / PDa / intern / sig~.c
blob1cff614f7c517047e722736b04d899f6fdf524e6
1 #include "../src/m_pd.h"
2 #include <../src/m_fixed.h>
4 static t_class *sig_tilde_class;
6 typedef struct _sig
8 t_object x_obj;
9 t_sample x_f;
10 } t_sig;
12 static t_int *sig_tilde_perform(t_int *w)
14 t_sample f = *(t_sample *)(w[1]);
15 t_sample *out = (t_sample *)(w[2]);
16 int n = (int)(w[3]);
17 while (n--)
18 *out++ = f;
19 return (w+4);
22 static t_int *sig_tilde_perf8(t_int *w)
24 t_sample f = *(t_sample *)(w[1]);
25 t_sample *out = (t_sample *)(w[2]);
26 int n = (int)(w[3]);
28 for (; n; n -= 8, out += 8)
30 out[0] = f;
31 out[1] = f;
32 out[2] = f;
33 out[3] = f;
34 out[4] = f;
35 out[5] = f;
36 out[6] = f;
37 out[7] = f;
39 return (w+4);
43 static void sig_tilde_float(t_sig *x, t_float f)
45 x->x_f = ftofix(f);
48 static void sig_tilde_dsp(t_sig *x, t_signal **sp)
50 dsp_add(sig_tilde_perform, 3, &x->x_f, sp[0]->s_vec, sp[0]->s_n);
53 static void *sig_tilde_new(t_floatarg f)
55 t_sig *x = (t_sig *)pd_new(sig_tilde_class);
56 x->x_f = ftofix(f);
57 outlet_new(&x->x_obj, gensym("signal"));
58 return (x);
61 void sig_tilde_setup(void)
63 sig_tilde_class = class_new(gensym("sig~"), (t_newmethod)sig_tilde_new, 0,
64 sizeof(t_sig), 0, A_DEFFLOAT, 0);
65 class_addfloat(sig_tilde_class, (t_method)sig_tilde_float);
66 class_addmethod(sig_tilde_class, (t_method)sig_tilde_dsp, gensym("dsp"), 0);