From 1f5a5bbe0f5f0fc07d5635d499eee149b2c83843 Mon Sep 17 00:00:00 2001 From: Martin Peach Date: Tue, 16 Mar 2010 17:22:15 +0000 Subject: Output valid state only when it changes. svn path=/trunk/externals/mrpeach/; revision=13216 --- net/udpreceive~.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/udpreceive~.c b/net/udpreceive~.c index 5b88088..74d49fc 100644 --- a/net/udpreceive~.c +++ b/net/udpreceive~.c @@ -476,13 +476,21 @@ static t_int *udpreceive_tilde_perform(t_int *w) } else x->x_blockssincerecv++; - if (x->x_valid != 1) outlet_float(x->x_validout, 1); + if (x->x_valid != 1) + { + x->x_valid = 1; + outlet_float(x->x_validout, x->x_valid); + } return (w + offset + x->x_noutlets); bail: /* set output to zero */ while (n--) for (i = 0; i < x->x_noutlets; i++) *(out[i]++) = 0.; - if (x->x_valid != 0) outlet_float(x->x_validout, 0); + if (x->x_valid != 0) + { + x->x_valid = 0; + outlet_float(x->x_validout, x->x_valid); + } return (w + offset + x->x_noutlets); } -- cgit v1.2.1