diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
commit | 513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch) | |
tree | 10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/PDa/intern/ftom~.c | |
parent | 95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff) | |
download | rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip |
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/intern/ftom~.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/intern/ftom~.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/ftom~.c b/apps/plugins/pdbox/PDa/intern/ftom~.c new file mode 100644 index 0000000000..253fd7bf73 --- /dev/null +++ b/apps/plugins/pdbox/PDa/intern/ftom~.c | |||
@@ -0,0 +1,88 @@ | |||
1 | #include <m_pd.h> | ||
2 | #include <m_fixed.h> | ||
3 | |||
4 | typedef struct ftom_tilde | ||
5 | { | ||
6 | t_object x_obj; | ||
7 | float x_f; | ||
8 | } t_ftom_tilde; | ||
9 | |||
10 | t_class *ftom_tilde_class; | ||
11 | |||
12 | static void *ftom_tilde_new(void) | ||
13 | { | ||
14 | t_ftom_tilde *x = (t_ftom_tilde *)pd_new(ftom_tilde_class); | ||
15 | outlet_new(&x->x_obj, gensym("signal")); | ||
16 | x->x_f = 0; | ||
17 | return (x); | ||
18 | } | ||
19 | |||
20 | static t_int *ftom_tilde_perform(t_int *w) | ||
21 | { | ||
22 | t_sample *in = *(t_sample **)(w+1), *out = *(t_float **)(w+2); | ||
23 | t_int n = *(t_int *)(w+3); | ||
24 | for (; n--; *in++, out++) | ||
25 | { | ||
26 | t_sample f = *in; | ||
27 | *out = ftofix((fixtof(f) > 0 ? 17.3123405046 * log(.12231220585 * fixtof(f)) : -1500)); | ||
28 | } | ||
29 | return (w + 4); | ||
30 | } | ||
31 | |||
32 | static void ftom_tilde_dsp(t_ftom_tilde *x, t_signal **sp) | ||
33 | { | ||
34 | post("warning: %s not usable yet",__FUNCTION__); | ||
35 | dsp_add(ftom_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); | ||
36 | } | ||
37 | |||
38 | void ftom_tilde_setup(void) | ||
39 | { | ||
40 | ftom_tilde_class = class_new(gensym("ftom~"), (t_newmethod)ftom_tilde_new, 0, | ||
41 | sizeof(t_ftom_tilde), 0, 0); | ||
42 | CLASS_MAINSIGNALIN(ftom_tilde_class, t_ftom_tilde, x_f); | ||
43 | class_addmethod(ftom_tilde_class, (t_method)ftom_tilde_dsp, gensym("dsp"), 0); | ||
44 | } | ||
45 | #include <m_pd.h> | ||
46 | #include <m_fixed.h> | ||
47 | |||
48 | typedef struct ftom_tilde | ||
49 | { | ||
50 | t_object x_obj; | ||
51 | float x_f; | ||
52 | } t_ftom_tilde; | ||
53 | |||
54 | t_class *ftom_tilde_class; | ||
55 | |||
56 | static void *ftom_tilde_new(void) | ||
57 | { | ||
58 | t_ftom_tilde *x = (t_ftom_tilde *)pd_new(ftom_tilde_class); | ||
59 | outlet_new(&x->x_obj, gensym("signal")); | ||
60 | x->x_f = 0; | ||
61 | return (x); | ||
62 | } | ||
63 | |||
64 | static t_int *ftom_tilde_perform(t_int *w) | ||
65 | { | ||
66 | t_sample *in = *(t_sample **)(w+1), *out = *(t_float **)(w+2); | ||
67 | t_int n = *(t_int *)(w+3); | ||
68 | for (; n--; *in++, out++) | ||
69 | { | ||
70 | t_sample f = *in; | ||
71 | *out = ftofix((fixtof(f) > 0 ? 17.3123405046 * log(.12231220585 * fixtof(f)) : -1500)); | ||
72 | } | ||
73 | return (w + 4); | ||
74 | } | ||
75 | |||
76 | static void ftom_tilde_dsp(t_ftom_tilde *x, t_signal **sp) | ||
77 | { | ||
78 | post("warning: %s not usable yet",__FUNCTION__); | ||
79 | dsp_add(ftom_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); | ||
80 | } | ||
81 | |||
82 | void ftom_tilde_setup(void) | ||
83 | { | ||
84 | ftom_tilde_class = class_new(gensym("ftom~"), (t_newmethod)ftom_tilde_new, 0, | ||
85 | sizeof(t_ftom_tilde), 0, 0); | ||
86 | CLASS_MAINSIGNALIN(ftom_tilde_class, t_ftom_tilde, x_f); | ||
87 | class_addmethod(ftom_tilde_class, (t_method)ftom_tilde_dsp, gensym("dsp"), 0); | ||
88 | } | ||