From faada59567f8cb252f4a909116595ce309ff5828 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 23 May 2003 12:29:55 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r647, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/miXed/; revision=648 --- cyclone/hammer/onebang.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cyclone/hammer/onebang.c (limited to 'cyclone/hammer/onebang.c') diff --git a/cyclone/hammer/onebang.c b/cyclone/hammer/onebang.c new file mode 100644 index 0000000..a4132dc --- /dev/null +++ b/cyclone/hammer/onebang.c @@ -0,0 +1,46 @@ +/* Copyright (c) 2002-2003 krzYszcz and others. + * For information on usage and redistribution, and for a DISCLAIMER OF ALL + * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ + +#include "m_pd.h" + +typedef struct _onebang +{ + t_object x_ob; + int x_isopen; +} t_onebang; + +static t_class *onebang_class; + +static void onebang_bang(t_onebang *x) +{ + if (x->x_isopen) + { + outlet_bang(((t_object *)x)->ob_outlet); + x->x_isopen = 0; + } +} + +static void onebang_bang1(t_onebang *x) +{ + x->x_isopen = 1; +} + +static void *onebang_new(t_floatarg f) +{ + t_onebang *x = (t_onebang *)pd_new(onebang_class); + x->x_isopen = ((int)f != 0); /* CHECKED */ + inlet_new((t_object *)x, (t_pd *)x, &s_bang, gensym("bang1")); + outlet_new((t_object *)x, &s_bang); + return (x); +} + +void onebang_setup(void) +{ + onebang_class = class_new(gensym("onebang"), + (t_newmethod)onebang_new, 0, + sizeof(t_onebang), 0, A_DEFFLOAT, 0); + class_addbang(onebang_class, onebang_bang); + class_addmethod(onebang_class, (t_method)onebang_bang1, + gensym("bang1"), 0); +} -- cgit v1.2.1