Merge branch 'aybe-patch-2' of feature/vcpkg_docs
[aubio.git] / python / ext / aubio-types.h
1 #include <Python.h>
2 #include <structmember.h>
3
4 #include "aubio-docstrings.h"
5 #include "aubio-generated.h"
6
7 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
8
9 // define numpy unique symbols for aubio
10 #define PY_ARRAY_UNIQUE_SYMBOL PYAUBIO_ARRAY_API
11 #define PY_UFUNC_UNIQUE_SYMBOL PYAUBIO_UFUNC_API
12
13 // only import array and ufunc from main module
14 #ifndef PY_AUBIO_MODULE_MAIN
15 #define NO_IMPORT_ARRAY
16 #endif
17 #include <numpy/arrayobject.h>
18 #ifndef PY_AUBIO_MODULE_UFUNC
19 #define NO_IMPORT_UFUNC
20 #else
21 #include <numpy/ufuncobject.h>
22 #endif
23
24 //#include <numpy/npy_3kcompat.h>
25
26 // import aubio
27 #define AUBIO_UNSTABLE 1
28 #ifdef USE_LOCAL_AUBIO
29 #include "aubio.h"
30 #else
31 #include <aubio/aubio.h>
32 #endif
33
34 #define Py_default_vector_length 1024
35
36 #define Py_aubio_default_samplerate 44100
37
38 #if HAVE_AUBIO_DOUBLE
39 // 64 bit precision with HAVE_AUBIO_DOUBLE=1
40 #define AUBIO_NPY_SMPL NPY_DOUBLE
41 #define AUBIO_NPY_SMPL_STR "float64"
42 #define AUBIO_NPY_SMPL_CHR "d"
43 #else
44 // default is 32 bit precision
45 #define AUBIO_NPY_SMPL NPY_FLOAT
46 #define AUBIO_NPY_SMPL_STR "float32"
47 #define AUBIO_NPY_SMPL_CHR "f"
48 #endif
49
50 #ifndef PATH_MAX
51 #ifdef MAX_PATH
52 #define PATH_MAX MAX_PATH
53 #else
54 #define PATH_MAX 1024
55 #endif
56 #endif
57
58 // compat with Python < 2.6
59 #ifndef Py_TYPE
60 #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
61 #endif
62
63 extern PyTypeObject Py_cvecType;
64
65 PyObject * new_py_fvec(uint_t length);
66 PyObject * new_py_cvec(uint_t length);
67 PyObject * new_py_fmat(uint_t height, uint_t length);
68
69 // defined in aubio-proxy.c
70 extern int PyAubio_IsValidVector (PyObject *input);
71
72 extern PyObject *PyAubio_CFvecToArray (fvec_t * self);
73 extern int PyAubio_ArrayToCFvec (PyObject * self, fvec_t *out);
74
75 extern int PyAubio_PyCvecToCCvec (PyObject *input, cvec_t *i);
76
77 extern PyObject *PyAubio_CFmatToArray (fmat_t * self);
78 extern int PyAubio_ArrayToCFmat (PyObject *input, fmat_t *out);
79
80 // hand written wrappers
81 extern PyTypeObject Py_filterType;
82
83 extern PyTypeObject Py_filterbankType;
84
85 extern PyTypeObject Py_fftType;
86
87 extern PyTypeObject Py_pvocType;
88
89 extern PyTypeObject Py_sourceType;
90
91 extern PyTypeObject Py_sinkType;