[ff74460] | 1 | #include <Python.h> |
---|
[ae6e15c] | 2 | #include <structmember.h> |
---|
[7a6521d] | 3 | |
---|
[7703f2a] | 4 | #include "aubio-docstrings.h" |
---|
[a89ed31] | 5 | #include "aubio-generated.h" |
---|
| 6 | |
---|
[b0fbd88] | 7 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION |
---|
[7a6521d] | 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 |
---|
[ad5203c] | 16 | #endif |
---|
| 17 | #include <numpy/arrayobject.h> |
---|
| 18 | #ifndef PY_AUBIO_MODULE_UFUNC |
---|
[7a6521d] | 19 | #define NO_IMPORT_UFUNC |
---|
[ad5203c] | 20 | #else |
---|
| 21 | #include <numpy/ufuncobject.h> |
---|
[7a6521d] | 22 | #endif |
---|
| 23 | |
---|
[ad5203c] | 24 | //#include <numpy/npy_3kcompat.h> |
---|
[7a6521d] | 25 | |
---|
[a315be7] | 26 | // import aubio |
---|
[7db3477] | 27 | #define AUBIO_UNSTABLE 1 |
---|
[223e2fe] | 28 | #ifdef USE_LOCAL_AUBIO |
---|
[ad5203c] | 29 | #include "aubio.h" |
---|
[41399bd] | 30 | #else |
---|
[911bea80] | 31 | #include <aubio/aubio.h> |
---|
[41399bd] | 32 | #endif |
---|
[ae6e15c] | 33 | |
---|
[96fe713] | 34 | #define Py_default_vector_length 1024 |
---|
[9b23eb31] | 35 | |
---|
[2f9af5d] | 36 | #define Py_aubio_default_samplerate 44100 |
---|
[352fd5f] | 37 | |
---|
[615ac7d] | 38 | #if HAVE_AUBIO_DOUBLE |
---|
[e99242a] | 39 | // 64 bit precision with HAVE_AUBIO_DOUBLE=1 |
---|
[615ac7d] | 40 | #define AUBIO_NPY_SMPL NPY_DOUBLE |
---|
[c6388f4] | 41 | #define AUBIO_NPY_SMPL_STR "float64" |
---|
| 42 | #define AUBIO_NPY_SMPL_CHR "d" |
---|
[352fd5f] | 43 | #else |
---|
[e99242a] | 44 | // default is 32 bit precision |
---|
[615ac7d] | 45 | #define AUBIO_NPY_SMPL NPY_FLOAT |
---|
[c6388f4] | 46 | #define AUBIO_NPY_SMPL_STR "float32" |
---|
| 47 | #define AUBIO_NPY_SMPL_CHR "f" |
---|
[352fd5f] | 48 | #endif |
---|
| 49 | |
---|
[410a157] | 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 | |
---|
[770b9e7] | 58 | // compat with Python < 2.6 |
---|
| 59 | #ifndef Py_TYPE |
---|
| 60 | #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
---|
| 61 | #endif |
---|
| 62 | |
---|
[b6230d8] | 63 | extern PyTypeObject Py_cvecType; |
---|
[9b23eb31] | 64 | |
---|
[ede5d38] | 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 | |
---|
[03c3450] | 69 | // defined in aubio-proxy.c |
---|
[b6230d8] | 70 | extern int PyAubio_IsValidVector (PyObject *input); |
---|
[34d0c25] | 71 | |
---|
[b6230d8] | 72 | extern PyObject *PyAubio_CFvecToArray (fvec_t * self); |
---|
| 73 | extern int PyAubio_ArrayToCFvec (PyObject * self, fvec_t *out); |
---|
[03c3450] | 74 | |
---|
[b6230d8] | 75 | extern int PyAubio_PyCvecToCCvec (PyObject *input, cvec_t *i); |
---|
[03c3450] | 76 | |
---|
[b6230d8] | 77 | extern PyObject *PyAubio_CFmatToArray (fmat_t * self); |
---|
| 78 | extern int PyAubio_ArrayToCFmat (PyObject *input, fmat_t *out); |
---|
[03c3450] | 79 | |
---|
| 80 | // hand written wrappers |
---|
[b6230d8] | 81 | extern PyTypeObject Py_filterType; |
---|
[9b23eb31] | 82 | |
---|
[b6230d8] | 83 | extern PyTypeObject Py_filterbankType; |
---|
[352fd5f] | 84 | |
---|
[b6230d8] | 85 | extern PyTypeObject Py_fftType; |
---|
[615ac7d] | 86 | |
---|
[b6230d8] | 87 | extern PyTypeObject Py_pvocType; |
---|
[03c3450] | 88 | |
---|
[b6230d8] | 89 | extern PyTypeObject Py_sourceType; |
---|
[d27634d] | 90 | |
---|
[b6230d8] | 91 | extern PyTypeObject Py_sinkType; |
---|