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/tabwrite.c | |
| parent | 4f2dfcc01b260d946044ef2b6af5fe36cb772c8d (diff) | |
| download | rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.zip rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.tar.gz rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.tar.bz2 rockbox-526b5580dabbfed7cfe5439dc3a90ec727f563c2.tar.xz | |
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/tabwrite.c')
| -rw-r--r-- | apps/plugins/pdbox/PDa/intern/tabwrite.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/apps/plugins/pdbox/PDa/intern/tabwrite.c b/apps/plugins/pdbox/PDa/intern/tabwrite.c index 8d6a6c0..ff4e40d 100644 --- a/apps/plugins/pdbox/PDa/intern/tabwrite.c +++ b/apps/plugins/pdbox/PDa/intern/tabwrite.c @@ -82,87 +82,4 @@ void tabwrite_setup(void) class_addfloat(tabwrite_class, (t_method)tabwrite_float); class_addmethod(tabwrite_class, (t_method)tabwrite_set, gensym("set"), A_SYMBOL, 0); } -#include <m_pd.h> -/* ------------------ tabwrite: control ------------------------ */ - -static t_class *tabwrite_class; - -typedef struct _tabwrite -{ - t_object x_obj; - t_symbol *x_arrayname; - t_clock *x_clock; - float x_ft1; - double x_updtime; - int x_set; -} t_tabwrite; - -static void tabwrite_tick(t_tabwrite *x) -{ - t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class); - if (!a) bug("tabwrite_tick"); - else garray_redraw(a); - x->x_set = 0; - x->x_updtime = clock_getsystime(); -} -static void tabwrite_float(t_tabwrite *x, t_float f) -{ - int i, vecsize; - t_garray *a; - t_sample *vec; - - if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) - pd_error(x, "%s: no such array", x->x_arrayname->s_name); - else if (!garray_getfloatarray(a, &vecsize, &vec)) - pd_error(x, "%s: bad template for tabwrite", x->x_arrayname->s_name); - else - { - int n = x->x_ft1; - double timesince = clock_gettimesince(x->x_updtime); - if (n < 0) n = 0; - else if (n >= vecsize) n = vecsize-1; - vec[n] = ftofix(f); - if (timesince > 1000) - { - tabwrite_tick(x); - } - else - { - if (x->x_set == 0) - { - clock_delay(x->x_clock, 1000 - timesince); - x->x_set = 1; - } - } - } -} - -static void tabwrite_set(t_tabwrite *x, t_symbol *s) -{ - x->x_arrayname = s; -} - -static void tabwrite_free(t_tabwrite *x) -{ - clock_free(x->x_clock); -} - -static void *tabwrite_new(t_symbol *s) -{ - t_tabwrite *x = (t_tabwrite *)pd_new(tabwrite_class); - x->x_ft1 = 0; - x->x_arrayname = s; - x->x_updtime = clock_getsystime(); - x->x_clock = clock_new(x, (t_method)tabwrite_tick); - floatinlet_new(&x->x_obj, &x->x_ft1); - return (x); -} - -void tabwrite_setup(void) -{ - tabwrite_class = class_new(gensym("tabwrite"), (t_newmethod)tabwrite_new, - (t_method)tabwrite_free, sizeof(t_tabwrite), 0, A_DEFSYM, 0); - class_addfloat(tabwrite_class, (t_method)tabwrite_float); - class_addmethod(tabwrite_class, (t_method)tabwrite_set, gensym("set"), A_SYMBOL, 0); -} |