blob: dd49f4c2b5306e7c1b581fe95e4dd5c9925800a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#include "defines.h"
/*--------------- vsum ---------------*/
static t_class *vsum_class;
typedef struct _vsum
{
t_object x_obj;
} t_vsum;
static void vsum_perform(t_vsum *x, t_symbol *s, int argc, t_atom *argv)
{
float sum=0.f;
int i;
for (i = 0; i < argc; i++)
{
sum+= atom_getfloat(&argv[i]);
}
outlet_float(x->x_obj.ob_outlet, sum);
}
static void *vsum_new()
{
t_vsum *x=(t_vsum *)pd_new(vsum_class);
outlet_new(&x->x_obj, gensym("float"));
return (void *)x;
}
void vsum_setup(void)
{
vsum_class = class_new(gensym("vsum"),
(t_newmethod)vsum_new, 0,
sizeof(t_vsum),
CLASS_DEFAULT,
0);
class_addlist(vsum_class, (t_method)vsum_perform);
}
|