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 | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/tabread.c b/apps/plugins/pdbox/PDa/intern/tabread.c index 5cd51b3036..16beb5977a 100644 --- a/apps/plugins/pdbox/PDa/intern/tabread.c +++ b/apps/plugins/pdbox/PDa/intern/tabread.c | |||
@@ -50,55 +50,4 @@ void tabread_setup(void) | |||
50 | class_addmethod(tabread_class, (t_method)tabread_set, gensym("set"), | 50 | class_addmethod(tabread_class, (t_method)tabread_set, gensym("set"), |
51 | A_SYMBOL, 0); | 51 | A_SYMBOL, 0); |
52 | } | 52 | } |
53 | #include <m_pd.h> | ||
54 | |||
55 | /* ---------- tabread: control, non-interpolating ------------------------ */ | ||
56 | |||
57 | static t_class *tabread_class; | ||
58 | |||
59 | typedef struct _tabread | ||
60 | { | ||
61 | t_object x_obj; | ||
62 | t_symbol *x_arrayname; | ||
63 | } t_tabread; | ||
64 | |||
65 | static void tabread_float(t_tabread *x, t_float f) | ||
66 | { | ||
67 | t_garray *a; | ||
68 | int npoints; | ||
69 | t_sample *vec; | ||
70 | 53 | ||
71 | if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) | ||
72 | pd_error(x, "%s: no such array", x->x_arrayname->s_name); | ||
73 | else if (!garray_getfloatarray(a, &npoints, &vec)) | ||
74 | pd_error(x, "%s: bad template for tabread", x->x_arrayname->s_name); | ||
75 | else | ||
76 | { | ||
77 | int n = f; | ||
78 | if (n < 0) n = 0; | ||
79 | else if (n >= npoints) n = npoints - 1; | ||
80 | outlet_float(x->x_obj.ob_outlet, (npoints ? fixtof(vec[n]) : 0)); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static void tabread_set(t_tabread *x, t_symbol *s) | ||
85 | { | ||
86 | x->x_arrayname = s; | ||
87 | } | ||
88 | |||
89 | static void *tabread_new(t_symbol *s) | ||
90 | { | ||
91 | t_tabread *x = (t_tabread *)pd_new(tabread_class); | ||
92 | x->x_arrayname = s; | ||
93 | outlet_new(&x->x_obj, &s_float); | ||
94 | return (x); | ||
95 | } | ||
96 | |||
97 | void tabread_setup(void) | ||
98 | { | ||
99 | tabread_class = class_new(gensym("tabread"), (t_newmethod)tabread_new, | ||
100 | 0, sizeof(t_tabread), 0, A_DEFSYM, 0); | ||
101 | class_addfloat(tabread_class, (t_method)tabread_float); | ||
102 | class_addmethod(tabread_class, (t_method)tabread_set, gensym("set"), | ||
103 | A_SYMBOL, 0); | ||
104 | } | ||