[ff74460] | 1 | #include <Python.h> |
---|
[ae6e15c] | 2 | #include <structmember.h> |
---|
[7a6521d] | 3 | |
---|
[b0fbd88] | 4 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION |
---|
[7a6521d] | 5 | |
---|
| 6 | // define numpy unique symbols for aubio |
---|
| 7 | #define PY_ARRAY_UNIQUE_SYMBOL PYAUBIO_ARRAY_API |
---|
| 8 | #define PY_UFUNC_UNIQUE_SYMBOL PYAUBIO_UFUNC_API |
---|
| 9 | |
---|
| 10 | // only import array and ufunc from main module |
---|
| 11 | #ifndef PY_AUBIO_MODULE_MAIN |
---|
| 12 | #define NO_IMPORT_ARRAY |
---|
[ad5203c] | 13 | #endif |
---|
| 14 | #include <numpy/arrayobject.h> |
---|
| 15 | #ifndef PY_AUBIO_MODULE_UFUNC |
---|
[7a6521d] | 16 | #define NO_IMPORT_UFUNC |
---|
[ad5203c] | 17 | #else |
---|
| 18 | #include <numpy/ufuncobject.h> |
---|
[7a6521d] | 19 | #endif |
---|
| 20 | |
---|
[ad5203c] | 21 | //#include <numpy/npy_3kcompat.h> |
---|
[7a6521d] | 22 | |
---|
[a315be7] | 23 | // import aubio |
---|
[7db3477] | 24 | #define AUBIO_UNSTABLE 1 |
---|
[223e2fe] | 25 | #ifdef USE_LOCAL_AUBIO |
---|
[ad5203c] | 26 | #include "aubio.h" |
---|
[41399bd] | 27 | #else |
---|
| 28 | #include "aubio/aubio.h" |
---|
| 29 | #endif |
---|
[ae6e15c] | 30 | |
---|
[96fe713] | 31 | #define Py_default_vector_length 1024 |
---|
[9b23eb31] | 32 | |
---|
[2f9af5d] | 33 | #define Py_aubio_default_samplerate 44100 |
---|
[352fd5f] | 34 | |
---|
[615ac7d] | 35 | #if HAVE_AUBIO_DOUBLE |
---|
| 36 | #error "Ouch! Python interface for aubio has not been much tested yet." |
---|
| 37 | #define AUBIO_NPY_SMPL NPY_DOUBLE |
---|
[352fd5f] | 38 | #else |
---|
[615ac7d] | 39 | #define AUBIO_NPY_SMPL NPY_FLOAT |
---|
[352fd5f] | 40 | #endif |
---|
| 41 | |
---|
[03c3450] | 42 | // special python type for cvec |
---|
[96fe713] | 43 | typedef struct |
---|
| 44 | { |
---|
| 45 | PyObject_HEAD |
---|
[615ac7d] | 46 | cvec_t * o; |
---|
| 47 | uint_t length; |
---|
| 48 | uint_t channels; |
---|
| 49 | } Py_cvec; |
---|
[9b23eb31] | 50 | extern PyTypeObject Py_cvecType; |
---|
| 51 | |
---|
[03c3450] | 52 | // defined in aubio-proxy.c |
---|
| 53 | extern PyObject *PyAubio_CFvecToArray (fvec_t * self); |
---|
| 54 | extern fvec_t *PyAubio_ArrayToCFvec (PyObject * self); |
---|
| 55 | |
---|
| 56 | extern Py_cvec *PyAubio_CCvecToPyCvec (cvec_t * self); |
---|
| 57 | extern cvec_t *PyAubio_ArrayToCCvec (PyObject *input); |
---|
| 58 | |
---|
| 59 | extern PyObject *PyAubio_CFmatToArray (fmat_t * self); |
---|
| 60 | extern fmat_t *PyAubio_ArrayToCFmat (PyObject *input); |
---|
| 61 | |
---|
| 62 | // hand written wrappers |
---|
[9b23eb31] | 63 | extern PyTypeObject Py_filterType; |
---|
| 64 | |
---|
[615ac7d] | 65 | extern PyTypeObject Py_filterbankType; |
---|
[352fd5f] | 66 | |
---|
[615ac7d] | 67 | extern PyTypeObject Py_fftType; |
---|
| 68 | |
---|
| 69 | extern PyTypeObject Py_pvocType; |
---|
[03c3450] | 70 | |
---|
[d27634d] | 71 | extern PyTypeObject Py_sourceType; |
---|
| 72 | |
---|
[f1100a4] | 73 | extern PyTypeObject Py_sinkType; |
---|