1
/******************************************************
3
* zexy - implementation file
5
* copyleft (c) IOhannes m zm�lnig
7
* 1999:forum::f�r::uml�ute:2004
9
* institute of electronic music and acoustics (iem)
11
******************************************************
13
* license: GNU General Public License v.2
15
******************************************************/
19
/* minmax :: get minimum and maximum of a list */
21
static t_class *minmax_class;
23
typedef struct _minmax
29
t_outlet *mino, *maxo;
32
static void minmax_bang(t_minmax *x)
34
outlet_float(x->maxo,x->max);
35
outlet_float(x->mino,x->min);
38
static void minmax_list(t_minmax *x, t_symbol *s, int argc, t_atom *argv)
42
t_float min = atom_getfloat(argv++);
47
t_float f = atom_getfloat(argv++);
58
static void *minmax_new(void)
60
t_minmax *x = (t_minmax *)pd_new(minmax_class);
62
x->mino=outlet_new(&x->x_obj, &s_float);
63
x->maxo=outlet_new(&x->x_obj, &s_float);
70
static void minmax_help(void)
72
post("minmax\t:: get minimum and maximum of a list of floats");
75
void minmax_setup(void)
77
minmax_class = class_new(gensym("minmax"), (t_newmethod)minmax_new, 0,
78
sizeof(t_minmax), 0, A_DEFFLOAT, 0);
80
class_addlist(minmax_class, (t_method)minmax_list);
81
class_addbang(minmax_class, (t_method)minmax_bang);
82
class_addmethod(minmax_class, (t_method)minmax_help, gensym("help"), 0);
84
zexy_register("minmax");