summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/intern/sig~.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/sig~.c')
-rw-r--r--apps/plugins/pdbox/PDa/intern/sig~.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/sig~.c b/apps/plugins/pdbox/PDa/intern/sig~.c
index 70a616ce23..6cee184134 100644
--- a/apps/plugins/pdbox/PDa/intern/sig~.c
+++ b/apps/plugins/pdbox/PDa/intern/sig~.c
@@ -65,70 +65,4 @@ void sig_tilde_setup(void)
65 class_addfloat(sig_tilde_class, (t_method)sig_tilde_float); 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); 66 class_addmethod(sig_tilde_class, (t_method)sig_tilde_dsp, gensym("dsp"), 0);
67} 67}
68#include <m_pd.h>
69#include <m_fixed.h>
70
71static t_class *sig_tilde_class;
72
73typedef struct _sig
74{
75 t_object x_obj;
76 t_sample x_f;
77} t_sig;
78
79static t_int *sig_tilde_perform(t_int *w)
80{
81 t_sample f = *(t_sample *)(w[1]);
82 t_sample *out = (t_sample *)(w[2]);
83 int n = (int)(w[3]);
84 while (n--)
85 *out++ = f;
86 return (w+4);
87}
88
89static t_int *sig_tilde_perf8(t_int *w)
90{
91 t_sample f = *(t_sample *)(w[1]);
92 t_sample *out = (t_sample *)(w[2]);
93 int n = (int)(w[3]);
94
95 for (; n; n -= 8, out += 8)
96 {
97 out[0] = f;
98 out[1] = f;
99 out[2] = f;
100 out[3] = f;
101 out[4] = f;
102 out[5] = f;
103 out[6] = f;
104 out[7] = f;
105 }
106 return (w+4);
107}
108 68
109
110static void sig_tilde_float(t_sig *x, t_float f)
111{
112 x->x_f = ftofix(f);
113}
114
115static void sig_tilde_dsp(t_sig *x, t_signal **sp)
116{
117 dsp_add(sig_tilde_perform, 3, &x->x_f, sp[0]->s_vec, sp[0]->s_n);
118}
119
120static void *sig_tilde_new(t_floatarg f)
121{
122 t_sig *x = (t_sig *)pd_new(sig_tilde_class);
123 x->x_f = ftofix(f);
124 outlet_new(&x->x_obj, gensym("signal"));
125 return (x);
126}
127
128void sig_tilde_setup(void)
129{
130 sig_tilde_class = class_new(gensym("sig~"), (t_newmethod)sig_tilde_new, 0,
131 sizeof(t_sig), 0, A_DEFFLOAT, 0);
132 class_addfloat(sig_tilde_class, (t_method)sig_tilde_float);
133 class_addmethod(sig_tilde_class, (t_method)sig_tilde_dsp, gensym("dsp"), 0);
134}