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/vd~.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/vd~.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/intern/vd~.c | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/vd~.c b/apps/plugins/pdbox/PDa/intern/vd~.c index 2c68b27e25..471df56753 100644 --- a/apps/plugins/pdbox/PDa/intern/vd~.c +++ b/apps/plugins/pdbox/PDa/intern/vd~.c | |||
@@ -90,95 +90,4 @@ void vd_tilde_setup(void) | |||
90 | class_addmethod(sigvd_class, (t_method)sigvd_dsp, gensym("dsp"), 0); | 90 | class_addmethod(sigvd_class, (t_method)sigvd_dsp, gensym("dsp"), 0); |
91 | CLASS_MAINSIGNALIN(sigvd_class, t_sigvd, x_f); | 91 | CLASS_MAINSIGNALIN(sigvd_class, t_sigvd, x_f); |
92 | } | 92 | } |
93 | #include <m_pd.h> | ||
94 | #include <m_fixed.h> | ||
95 | |||
96 | #include "delay.h" | ||
97 | |||
98 | extern int ugen_getsortno(void); | ||
99 | |||
100 | #define DEFDELVS 64 /* LATER get this from canvas at DSP time */ | ||
101 | static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */ | ||
102 | |||
103 | static t_class *sigvd_class; | ||
104 | |||
105 | typedef struct _sigvd | ||
106 | { | ||
107 | t_object x_obj; | ||
108 | t_symbol *x_sym; | ||
109 | t_sample x_sr; /* samples per msec */ | ||
110 | int x_zerodel; /* 0 or vecsize depending on read/write order */ | ||
111 | float x_f; | ||
112 | } t_sigvd; | ||
113 | |||
114 | static void *sigvd_new(t_symbol *s) | ||
115 | { | ||
116 | t_sigvd *x = (t_sigvd *)pd_new(sigvd_class); | ||
117 | if (!*s->s_name) s = gensym("vd~"); | ||
118 | x->x_sym = s; | ||
119 | x->x_sr = 1; | ||
120 | x->x_zerodel = 0; | ||
121 | outlet_new(&x->x_obj, &s_signal); | ||
122 | x->x_f = 0; | ||
123 | return (x); | ||
124 | } | ||
125 | 93 | ||
126 | |||
127 | static t_int *sigvd_perform(t_int *w) | ||
128 | { | ||
129 | t_sample *in = (t_sample *)(w[1]); | ||
130 | t_sample *out = (t_sample *)(w[2]); | ||
131 | t_delwritectl *ctl = (t_delwritectl *)(w[3]); | ||
132 | t_sigvd *x = (t_sigvd *)(w[4]); | ||
133 | int n = (int)(w[5]); | ||
134 | |||
135 | int nsamps = ctl->c_n; | ||
136 | int fn = n; | ||
137 | t_sample limit = nsamps - n - 1; | ||
138 | t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; | ||
139 | t_sample zerodel = x->x_zerodel; | ||
140 | while (n--) | ||
141 | { | ||
142 | t_time delsamps = ((long long) mult((*in++),ftofix(44.1)));//- itofix(zerodel); | ||
143 | int index = fixtoi(delsamps); | ||
144 | t_sample frac; | ||
145 | // post("%d: index %d f %lld",index,findex,*in); | ||
146 | |||
147 | frac = delsamps - itofix(index); | ||
148 | index+=fn; | ||
149 | if (index < 1 ) index += nsamps ; | ||
150 | if (index > limit) index-= nsamps; | ||
151 | bp = wp - index; | ||
152 | if (bp < vp + 2) bp += nsamps; | ||
153 | *out++ = bp[-1] + mult(frac,bp[-1]-bp[0]); | ||
154 | wp++; | ||
155 | } | ||
156 | return (w+6); | ||
157 | } | ||
158 | |||
159 | |||
160 | |||
161 | static void sigvd_dsp(t_sigvd *x, t_signal **sp) | ||
162 | { | ||
163 | t_sigdelwrite *delwriter = | ||
164 | (t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class); | ||
165 | x->x_sr = sp[0]->s_sr * 0.001; | ||
166 | if (delwriter) | ||
167 | { | ||
168 | sigdelwrite_checkvecsize(delwriter, sp[0]->s_n); | ||
169 | x->x_zerodel = (delwriter->x_sortno == ugen_getsortno() ? | ||
170 | 0 : delwriter->x_vecsize); | ||
171 | dsp_add(sigvd_perform, 5, | ||
172 | sp[0]->s_vec, sp[1]->s_vec, | ||
173 | &delwriter->x_cspace, x, sp[0]->s_n); | ||
174 | } | ||
175 | else error("vd~: %s: no such delwrite~",x->x_sym->s_name); | ||
176 | } | ||
177 | |||
178 | void vd_tilde_setup(void) | ||
179 | { | ||
180 | sigvd_class = class_new(gensym("vd~"), (t_newmethod)sigvd_new, 0, | ||
181 | sizeof(t_sigvd), 0, A_DEFSYM, 0); | ||
182 | class_addmethod(sigvd_class, (t_method)sigvd_dsp, gensym("dsp"), 0); | ||
183 | CLASS_MAINSIGNALIN(sigvd_class, t_sigvd, x_f); | ||
184 | } | ||