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/hip~.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/hip~.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/intern/hip~.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/hip~.c b/apps/plugins/pdbox/PDa/intern/hip~.c index a2a8c40cf2..6c6de41809 100644 --- a/apps/plugins/pdbox/PDa/intern/hip~.c +++ b/apps/plugins/pdbox/PDa/intern/hip~.c | |||
@@ -90,95 +90,4 @@ void hip_tilde_setup(void) | |||
90 | class_addmethod(sighip_class, (t_method)sighip_clear, gensym("clear"), 0); | 90 | class_addmethod(sighip_class, (t_method)sighip_clear, gensym("clear"), 0); |
91 | class_sethelpsymbol(sighip_class, gensym("lop~-help.pd")); | 91 | class_sethelpsymbol(sighip_class, gensym("lop~-help.pd")); |
92 | } | 92 | } |
93 | #include <m_pd.h> | ||
94 | #include <m_fixed.h> | ||
95 | |||
96 | typedef struct hipctl | ||
97 | { | ||
98 | t_sample c_x; | ||
99 | t_sample c_coef; | ||
100 | } t_hipctl; | ||
101 | |||
102 | typedef struct sighip | ||
103 | { | ||
104 | t_object x_obj; | ||
105 | float x_sr; | ||
106 | float x_hz; | ||
107 | t_hipctl x_cspace; | ||
108 | t_hipctl *x_ctl; | ||
109 | float x_f; | ||
110 | } t_sighip; | ||
111 | |||
112 | t_class *sighip_class; | ||
113 | static void sighip_ft1(t_sighip *x, t_floatarg f); | ||
114 | |||
115 | static void *sighip_new(t_floatarg f) | ||
116 | { | ||
117 | t_sighip *x = (t_sighip *)pd_new(sighip_class); | ||
118 | inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("ft1")); | ||
119 | outlet_new(&x->x_obj, gensym("signal")); | ||
120 | x->x_sr = 44100; | ||
121 | x->x_ctl = &x->x_cspace; | ||
122 | x->x_cspace.c_x = 0; | ||
123 | sighip_ft1(x, f); | ||
124 | x->x_f = 0; | ||
125 | return (x); | ||
126 | } | ||
127 | 93 | ||
128 | static void sighip_ft1(t_sighip *x, t_floatarg f) | ||
129 | { | ||
130 | t_float coeff; | ||
131 | if (f < 0.001) f = 10; | ||
132 | x->x_hz = f; | ||
133 | coeff = 1 - f * (2 * 3.14159) / x->x_sr; | ||
134 | if (coeff < 0) coeff = 0; | ||
135 | x->x_ctl->c_coef = ftofix(coeff); | ||
136 | } | ||
137 | |||
138 | static t_int *sighip_perform(t_int *w) | ||
139 | { | ||
140 | t_sample *in = (t_sample *)(w[1]); | ||
141 | t_sample *out = (t_sample *)(w[2]); | ||
142 | t_hipctl *c = (t_hipctl *)(w[3]); | ||
143 | int n = (t_int)(w[4]); | ||
144 | int i; | ||
145 | t_sample last = c->c_x; | ||
146 | t_sample coef = c->c_coef; | ||
147 | for (i = 0; i < n; i++) | ||
148 | { | ||
149 | t_sample new = *in++ + mult(coef,last); | ||
150 | *out++ = new - last; | ||
151 | last = new; | ||
152 | } | ||
153 | if (PD_BADFLOAT(last)) | ||
154 | last = 0; | ||
155 | c->c_x = last; | ||
156 | return (w+5); | ||
157 | } | ||
158 | |||
159 | static void sighip_dsp(t_sighip *x, t_signal **sp) | ||
160 | { | ||
161 | x->x_sr = sp[0]->s_sr; | ||
162 | sighip_ft1(x, x->x_hz); | ||
163 | dsp_add(sighip_perform, 4, | ||
164 | sp[0]->s_vec, sp[1]->s_vec, | ||
165 | x->x_ctl, sp[0]->s_n); | ||
166 | |||
167 | } | ||
168 | |||
169 | static void sighip_clear(t_sighip *x, t_floatarg q) | ||
170 | { | ||
171 | x->x_cspace.c_x = 0; | ||
172 | } | ||
173 | |||
174 | void hip_tilde_setup(void) | ||
175 | { | ||
176 | sighip_class = class_new(gensym("hip~"), (t_newmethod)sighip_new, 0, | ||
177 | sizeof(t_sighip), 0, A_DEFFLOAT, 0); | ||
178 | CLASS_MAINSIGNALIN(sighip_class, t_sighip, x_f); | ||
179 | class_addmethod(sighip_class, (t_method)sighip_dsp, gensym("dsp"), 0); | ||
180 | class_addmethod(sighip_class, (t_method)sighip_ft1, | ||
181 | gensym("ft1"), A_FLOAT, 0); | ||
182 | class_addmethod(sighip_class, (t_method)sighip_clear, gensym("clear"), 0); | ||
183 | class_sethelpsymbol(sighip_class, gensym("lop~-help.pd")); | ||
184 | } | ||