From 31573add9abbe5c25e1611c5d962f5f20c0f843c Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Thu, 12 Jul 2007 15:20:27 +0000 Subject: Negative and zero delays now cause lists to pass straight through without clock_delay and memory allocation/copying. svn path=/trunk/externals/mrpeach/; revision=8046 --- osc/pipelist.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'osc') diff --git a/osc/pipelist.c b/osc/pipelist.c index 14e9e7b..c561fed 100644 --- a/osc/pipelist.c +++ b/osc/pipelist.c @@ -84,19 +84,25 @@ static void pipelist_hang_tick(t_hang *h) static void pipelist_list(t_pipelist *x, t_symbol *s, int ac, t_atom *av) { - t_hang *h = (t_hang *)getbytes(sizeof(t_hang)); - int i; - - h->h_n = ac; - h->h_atoms = (t_atom *)getbytes(h->h_n*sizeof(t_atom)); - - for (i = 0; i < h->h_n; ++i) - h->h_atoms[i] = av[i]; - h->h_next = x->x_hang; - x->x_hang = h; - h->h_owner = x; - h->h_clock = clock_new(h, (t_method)pipelist_hang_tick); - clock_delay(h->h_clock, (x->x_deltime >= 0 ? x->x_deltime : 0)); + if (x->x_deltime > 0) + { /* if delay is real, save the list for output in delay milliseconds */ + t_hang *h; + int i; + + h = (t_hang *)getbytes(sizeof(t_hang)); + h->h_n = ac; + h->h_atoms = (t_atom *)getbytes(h->h_n*sizeof(t_atom)); + + for (i = 0; i < h->h_n; ++i) + h->h_atoms[i] = av[i]; + h->h_next = x->x_hang; + x->x_hang = h; + h->h_owner = x; + h->h_clock = clock_new(h, (t_method)pipelist_hang_tick); + clock_delay(h->h_clock, (x->x_deltime >= 0 ? x->x_deltime : 0)); + } + /* otherwise just pass the list straight through */ + else outlet_list(x->x_pipelistout, &s_list, ac, av); } static void pipelist_flush(t_pipelist *x) -- cgit v1.2.1