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/tabread~.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/tabread~.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/intern/tabread~.c | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/tabread~.c b/apps/plugins/pdbox/PDa/intern/tabread~.c index f1f4fd4729..5a7ea5d57f 100644 --- a/apps/plugins/pdbox/PDa/intern/tabread~.c +++ b/apps/plugins/pdbox/PDa/intern/tabread~.c | |||
@@ -95,100 +95,4 @@ void tabread_tilde_setup(void) | |||
95 | class_addmethod(tabread_tilde_class, (t_method)tabread_tilde_set, | 95 | class_addmethod(tabread_tilde_class, (t_method)tabread_tilde_set, |
96 | gensym("set"), A_SYMBOL, 0); | 96 | gensym("set"), A_SYMBOL, 0); |
97 | } | 97 | } |
98 | #define FIXEDPOINT | ||
99 | #include <m_pd.h> | ||
100 | #include <m_fixed.h> | ||
101 | |||
102 | static t_class *tabread_tilde_class; | ||
103 | |||
104 | typedef struct _tabread_tilde | ||
105 | { | ||
106 | t_object x_obj; | ||
107 | int x_npoints; | ||
108 | t_sample *x_vec; | ||
109 | t_symbol *x_arrayname; | ||
110 | float x_f; | ||
111 | } t_tabread_tilde; | ||
112 | |||
113 | static void *tabread_tilde_new(t_symbol *s) | ||
114 | { | ||
115 | t_tabread_tilde *x = (t_tabread_tilde *)pd_new(tabread_tilde_class); | ||
116 | x->x_arrayname = s; | ||
117 | x->x_vec = 0; | ||
118 | outlet_new(&x->x_obj, gensym("signal")); | ||
119 | x->x_f = 0; | ||
120 | return (x); | ||
121 | } | ||
122 | |||
123 | static t_int *tabread_tilde_perform(t_int *w) | ||
124 | { | ||
125 | t_tabread_tilde *x = (t_tabread_tilde *)(w[1]); | ||
126 | t_sample *in = (t_sample *)(w[2]); | ||
127 | t_sample *out = (t_sample *)(w[3]); | ||
128 | int n = (int)(w[4]); | ||
129 | int maxindex; | ||
130 | t_sample *buf = x->x_vec, *fp; | ||
131 | int i; | ||
132 | |||
133 | maxindex = x->x_npoints - 1; | ||
134 | if (!buf) goto zero; | ||
135 | |||
136 | for (i = 0; i < n; i++) | ||
137 | { | ||
138 | int index = ((long long) mult((*in++),ftofix(44.1)) >> fix1); | ||
139 | if (index < 0) | ||
140 | index = 0; | ||
141 | else if (index > maxindex) | ||
142 | index = maxindex; | ||
143 | *out++ = buf[index]; | ||
144 | } | ||
145 | return (w+5); | ||
146 | zero: | ||
147 | while (n--) *out++ = 0; | ||
148 | |||
149 | return (w+5); | ||
150 | } | ||
151 | |||
152 | void tabread_tilde_set(t_tabread_tilde *x, t_symbol *s) | ||
153 | { | ||
154 | t_garray *a; | ||
155 | |||
156 | x->x_arrayname = s; | ||
157 | if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) | ||
158 | { | ||
159 | if (*s->s_name) | ||
160 | error("tabread~: %s: no such array", x->x_arrayname->s_name); | ||
161 | x->x_vec = 0; | ||
162 | } | ||
163 | else if (!garray_getfloatarray(a, &x->x_npoints, &x->x_vec)) | ||
164 | { | ||
165 | error("%s: bad template for tabread~", x->x_arrayname->s_name); | ||
166 | x->x_vec = 0; | ||
167 | } | ||
168 | else garray_usedindsp(a); | ||
169 | } | ||
170 | 98 | ||
171 | static void tabread_tilde_dsp(t_tabread_tilde *x, t_signal **sp) | ||
172 | { | ||
173 | tabread_tilde_set(x, x->x_arrayname); | ||
174 | |||
175 | dsp_add(tabread_tilde_perform, 4, x, | ||
176 | sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); | ||
177 | |||
178 | } | ||
179 | |||
180 | static void tabread_tilde_free(t_tabread_tilde *x) | ||
181 | { | ||
182 | } | ||
183 | |||
184 | void tabread_tilde_setup(void) | ||
185 | { | ||
186 | tabread_tilde_class = class_new(gensym("tabread~"), | ||
187 | (t_newmethod)tabread_tilde_new, (t_method)tabread_tilde_free, | ||
188 | sizeof(t_tabread_tilde), 0, A_DEFSYM, 0); | ||
189 | CLASS_MAINSIGNALIN(tabread_tilde_class, t_tabread_tilde, x_f); | ||
190 | class_addmethod(tabread_tilde_class, (t_method)tabread_tilde_dsp, | ||
191 | gensym("dsp"), 0); | ||
192 | class_addmethod(tabread_tilde_class, (t_method)tabread_tilde_set, | ||
193 | gensym("set"), A_SYMBOL, 0); | ||
194 | } | ||