aboutsummaryrefslogtreecommitdiff
path: root/max2pd.h
blob: 2f06217756bc932a33ce3a1ea68865f3796b79db (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
41
42
43
44
45
46
/*
 * this header aims to make it easy to port Max objects to Pd
 */

/* name changes */
#define SETSYM SETSYMBOL

/* Pd doesn't have longs */
#define SETLONG SETFLOAT

/* different names for the same thing */
#define Atom t_atom
#define Symbol t_symbol

/* allocate memory */
#define sysmem_newptr(size) getbytes(128)
#define sysmem_freeptr(ptr) freebytes(ptr, 128)

/* standard object API functions */
#define atom_getlong(atom)          atom_getfloatarg(0, 1, atom)
#define atom_getsym(atom)           atom_getsymbolarg(0, 1, atom)
#define object_alloc(obj_class)     pd_new(obj_class)
#define object_free(obj)            pd_free((t_pd*)obj)
#define newobject(class)            pd_new(class)
#define outlet_int(outlet, number)  outlet_float(outlet, number)

/* debug things */
#define _enable_trace sys_verbose

/* these are NOT included here because they would cause more problems than
 * they would solve.  Usually, they are used in the setup() and new()
 * functions, where most of the differences are between the Max and PD APIs */

/* macros */
// A_DEFLONG

/* types */
// method
// Object

/* functions */
// addint()
// addmess()
// newobject()
// outlet_new()
// setup()