source: python/aubiowraphell.h @ 25c9f9a

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

move new python module to the top

  • Property mode set to 100644
File size: 2.4 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_INIT(NAME, PARAMS... ) \
11static int \
12Py_ ## NAME ## _init (Py_ ## NAME * self, PyObject * args, PyObject * kwds) \
13{ \
14  self->o = new_aubio_## NAME ( PARAMS ); \
15  if (self->o == NULL) { \
16    PyErr_SetString (PyExc_StandardError, "error creating object"); \
17    return -1; \
18  } \
19\
20  return 0; \
21}
22
23#define AUBIO_DEL(NAME) \
24static void \
25Py_ ## NAME ## _del ( Py_ ## NAME * self) \
26{ \
27  del_aubio_ ## NAME (self->o); \
28  self->ob_type->tp_free ((PyObject *) self); \
29}
30
31#define AUBIO_MEMBERS_START(NAME) \
32static PyMemberDef Py_ ## NAME ## _members[] = {
33
34#define AUBIO_MEMBERS_STOP(NAME) \
35  {NULL} \
36};
37
38#define AUBIO_METHODS(NAME) \
39static PyMethodDef Py_ ## NAME ## _methods[] = { \
40  {NULL} \
41};
42
43
44#define AUBIO_TYPEOBJECT(NAME, PYNAME) \
45PyTypeObject Py_ ## NAME ## Type = { \
46  PyObject_HEAD_INIT (NULL)    \
47  0,                           \
48  PYNAME,                      \
49  sizeof (Py_ ## NAME),          \
50  0,                           \
51  (destructor) Py_ ## NAME ## _del,  \
52  0,                           \
53  0,                           \
54  0,                           \
55  0,                           \
56  0,                           \
57  0,                           \
58  0,                           \
59  0,                           \
60  0,                           \
61  (ternaryfunc)Py_ ## NAME ## _do,   \
62  0,                           \
63  0,                           \
64  0,                           \
65  0,                           \
66  Py_TPFLAGS_DEFAULT,          \
67  Py_ ## NAME ## _doc,               \
68  0,                           \
69  0,                           \
70  0,                           \
71  0,                           \
72  0,                           \
73  0,                           \
74  Py_ ## NAME ## _methods,           \
75  Py_ ## NAME ## _members,           \
76  0,                           \
77  0,                           \
78  0,                           \
79  0,                           \
80  0,                           \
81  0,                           \
82  (initproc) Py_ ## NAME ## _init,   \
83  0,                           \
84  Py_ ## NAME ## _new,               \
85};
86
87// some more helpers
88#define AUBIO_NEW_VEC(name, type, lengthval) \
89  name = (type *) PyObject_New (type, & type ## Type); \
90  name->length = lengthval;
Note: See TracBrowser for help on using the repository browser.