diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-24 21:28:16 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-24 21:28:16 +0000 |
commit | 526b5580dabbfed7cfe5439dc3a90ec727f563c2 (patch) | |
tree | 22b1af92348785daad16714ee5e2b633017e0e48 /apps/plugins/pdbox/PDa/intern/clip~.c | |
parent | 4f2dfcc01b260d946044ef2b6af5fe36cb772c8d (diff) | |
download | rockbox-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/clip~.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/intern/clip~.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/clip~.c b/apps/plugins/pdbox/PDa/intern/clip~.c index e2c697d1d8..83bcc80c53 100644 --- a/apps/plugins/pdbox/PDa/intern/clip~.c +++ b/apps/plugins/pdbox/PDa/intern/clip~.c | |||
@@ -56,61 +56,4 @@ void clip_tilde_setup(void) | |||
56 | CLASS_MAINSIGNALIN(clip_class, t_clip, x_f); | 56 | CLASS_MAINSIGNALIN(clip_class, t_clip, x_f); |
57 | class_addmethod(clip_class, (t_method)clip_dsp, gensym("dsp"), 0); | 57 | class_addmethod(clip_class, (t_method)clip_dsp, gensym("dsp"), 0); |
58 | } | 58 | } |
59 | #include <m_pd.h> | ||
60 | #include <m_fixed.h> | ||
61 | |||
62 | static t_class *clip_class; | ||
63 | 59 | ||
64 | typedef struct _clip | ||
65 | { | ||
66 | t_object x_obj; | ||
67 | float x_f; | ||
68 | t_float x_lo; | ||
69 | t_float x_hi; | ||
70 | } t_clip; | ||
71 | |||
72 | static void *clip_new(t_floatarg lo, t_floatarg hi) | ||
73 | { | ||
74 | t_clip *x = (t_clip *)pd_new(clip_class); | ||
75 | x->x_lo = lo; | ||
76 | x->x_hi = hi; | ||
77 | outlet_new(&x->x_obj, gensym("signal")); | ||
78 | floatinlet_new(&x->x_obj, &x->x_lo); | ||
79 | floatinlet_new(&x->x_obj, &x->x_hi); | ||
80 | x->x_f = 0; | ||
81 | return (x); | ||
82 | } | ||
83 | |||
84 | static t_int *clip_perform(t_int *w) | ||
85 | { | ||
86 | t_clip *x = (t_clip *)(w[1]); | ||
87 | t_sample *in = (t_sample *)(w[2]); | ||
88 | t_sample *out = (t_sample *)(w[3]); | ||
89 | int n = (int)(w[4]); | ||
90 | t_sample lo; | ||
91 | t_sample hi; | ||
92 | lo = ftofix(x->x_lo); | ||
93 | hi = ftofix(x->x_hi); | ||
94 | |||
95 | while (n--) | ||
96 | { | ||
97 | t_sample f = *in++; | ||
98 | if (f < lo) f = lo; | ||
99 | if (f > hi) f = hi; | ||
100 | *out++ = f; | ||
101 | } | ||
102 | return (w+5); | ||
103 | } | ||
104 | |||
105 | static void clip_dsp(t_clip *x, t_signal **sp) | ||
106 | { | ||
107 | dsp_add(clip_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); | ||
108 | } | ||
109 | |||
110 | void clip_tilde_setup(void) | ||
111 | { | ||
112 | clip_class = class_new(gensym("clip~"), (t_newmethod)clip_new, 0, | ||
113 | sizeof(t_clip), 0, A_DEFFLOAT, A_DEFFLOAT, 0); | ||
114 | CLASS_MAINSIGNALIN(clip_class, t_clip, x_f); | ||
115 | class_addmethod(clip_class, (t_method)clip_dsp, gensym("dsp"), 0); | ||
116 | } | ||