source: interfaces/python/aubiowraphell.h @ 96fe713

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 96fe713 was 96fe713, checked in by Paul Brossier <piem@piem.org>, 14 years ago

interfaces/python: towards mono

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#include "aubio-types.h"
2
3#define AUBIO_DECLARE(NAME, PARAMS...) \
4typedef struct { \
5  PyObject_HEAD \
6  aubio_ ## NAME ## _t * o; \
7  PARAMS; \
8} Py_## NAME;
9
10#define AUBIO_NEW(NAME) \
11static PyObject * \
12Py_ ## NAME ## _new (PyTypeObject * type, PyObject * args, PyObject * kwds) \
13{ \
14  Py_ ## NAME * self; \
15  self = (Py_ ## NAME *) type->tp_alloc (type, 0); \
16  return (PyObject *)self; \
17}
18
19#define AUBIO_INIT(NAME, PARAMS... ) \
20static int \
21Py_ ## NAME ## _init (Py_ ## NAME * self, PyObject * args, PyObject * kwds) \
22{ \
23  self->o = new_aubio_## NAME ( PARAMS ); \
24  if (self->o == NULL) { \
25    return -1; \
26  } \
27\
28  return 0; \
29}
30
31#define AUBIO_DEL(NAME) \
32static void \
33Py_ ## NAME ## _del ( Py_ ## NAME * self) \
34{ \
35  del_aubio_ ## NAME (self->o); \
36  self->ob_type->tp_free ((PyObject *) self); \
37}
38
39#define AUBIO_MEMBERS_START(NAME) \
40static PyMemberDef Py_ ## NAME ## _members[] = {
41
42#define AUBIO_MEMBERS_STOP(NAME) \
43  {NULL} \
44};
45
46#define AUBIO_METHODS(NAME) \
47static PyMethodDef Py_ ## NAME ## _methods[] = { \
48  {NULL} \
49};
50
51
52#define AUBIO_TYPEOBJECT(NAME, PYNAME) \
53PyTypeObject Py_ ## NAME ## Type = { \
54  PyObject_HEAD_INIT (NULL)    \
55  0,                           \
56  PYNAME,                      \
57  sizeof (Py_ ## NAME),          \
58  0,                           \
59  (destructor) Py_ ## NAME ## _del,  \
60  0,                           \
61  0,                           \
62  0,                           \
63  0,                           \
64  0,                           \
65  0,                           \
66  0,                           \
67  0,                           \
68  0,                           \
69  (ternaryfunc)Py_ ## NAME ## _do,   \
70  0,                           \
71  0,                           \
72  0,                           \
73  0,                           \
74  Py_TPFLAGS_DEFAULT,          \
75  Py_ ## NAME ## _doc,               \
76  0,                           \
77  0,                           \
78  0,                           \
79  0,                           \
80  0,                           \
81  0,                           \
82  Py_ ## NAME ## _methods,           \
83  Py_ ## NAME ## _members,           \
84  0,                           \
85  0,                           \
86  0,                           \
87  0,                           \
88  0,                           \
89  0,                           \
90  (initproc) Py_ ## NAME ## _init,   \
91  0,                           \
92  Py_ ## NAME ## _new,               \
93};
94
95// some more helpers
96#define AUBIO_NEW_VEC(name, type, lengthval) \
97  name = (type *) PyObject_New (type, & type ## Type); \
98  name->length = lengthval;
Note: See TracBrowser for help on using the repository browser.