summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/intern/wrap~.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/wrap~.c')
-rw-r--r--apps/plugins/pdbox/PDa/intern/wrap~.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/wrap~.c b/apps/plugins/pdbox/PDa/intern/wrap~.c
index dda79f2fcd..c011babdfc 100644
--- a/apps/plugins/pdbox/PDa/intern/wrap~.c
+++ b/apps/plugins/pdbox/PDa/intern/wrap~.c
@@ -51,54 +51,3 @@ void wrap_tilde_setup(void)
51 class_addmethod(sigwrap_class, (t_method)sigwrap_dsp, gensym("dsp"), 0); 51 class_addmethod(sigwrap_class, (t_method)sigwrap_dsp, gensym("dsp"), 0);
52} 52}
53 53
54#include <m_pd.h>
55#include <m_fixed.h>
56
57typedef struct wrap
58{
59 t_object x_obj;
60 float x_f;
61} t_sigwrap;
62
63t_class *sigwrap_class;
64
65static void *sigwrap_new(void)
66{
67 t_sigwrap *x = (t_sigwrap *)pd_new(sigwrap_class);
68 outlet_new(&x->x_obj, gensym("signal"));
69 x->x_f = 0;
70 return (x);
71}
72
73static t_int *sigwrap_perform(t_int *w)
74{
75 t_sample *in = *(t_sample **)(w+1), *out = *(t_sample **)(w+2);
76 t_int n = *(t_int *)(w+3);
77 while (n--)
78 {
79 t_sample f = *in++;
80
81#ifndef FIXEDPOINT
82 int k = f;
83 if (f > 0) *out++ = f-k;
84 else *out++ = f - (k-1);
85#else
86 int k = ftofix(1.) - 1;
87 *out = f&k;
88#endif
89 }
90 return (w + 4);
91}
92
93static void sigwrap_dsp(t_sigwrap *x, t_signal **sp)
94{
95 dsp_add(sigwrap_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
96}
97
98void wrap_tilde_setup(void)
99{
100 sigwrap_class = class_new(gensym("wrap~"), (t_newmethod)sigwrap_new, 0,
101 sizeof(t_sigwrap), 0, 0);
102 CLASS_MAINSIGNALIN(sigwrap_class, t_sigwrap, x_f);
103 class_addmethod(sigwrap_class, (t_method)sigwrap_dsp, gensym("dsp"), 0);
104}