[ff74460] | 1 | #include <Python.h> |
---|
[ae6e15c] | 2 | #include <structmember.h> |
---|
[7a6521d] | 3 | |
---|
[a89ed31] | 4 | #include "aubio-generated.h" |
---|
| 5 | |
---|
[b0fbd88] | 6 | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION |
---|
[7a6521d] | 7 | |
---|
| 8 | // define numpy unique symbols for aubio |
---|
| 9 | #define PY_ARRAY_UNIQUE_SYMBOL PYAUBIO_ARRAY_API |
---|
| 10 | #define PY_UFUNC_UNIQUE_SYMBOL PYAUBIO_UFUNC_API |
---|
| 11 | |
---|
| 12 | // only import array and ufunc from main module |
---|
| 13 | #ifndef PY_AUBIO_MODULE_MAIN |
---|
| 14 | #define NO_IMPORT_ARRAY |
---|
[ad5203c] | 15 | #endif |
---|
| 16 | #include <numpy/arrayobject.h> |
---|
| 17 | #ifndef PY_AUBIO_MODULE_UFUNC |
---|
[7a6521d] | 18 | #define NO_IMPORT_UFUNC |
---|
[ad5203c] | 19 | #else |
---|
| 20 | #include <numpy/ufuncobject.h> |
---|
[7a6521d] | 21 | #endif |
---|
| 22 | |
---|
[ad5203c] | 23 | //#include <numpy/npy_3kcompat.h> |
---|
[7a6521d] | 24 | |
---|
[a315be7] | 25 | // import aubio |
---|
[7db3477] | 26 | #define AUBIO_UNSTABLE 1 |
---|
[223e2fe] | 27 | #ifdef USE_LOCAL_AUBIO |
---|
[ad5203c] | 28 | #include "aubio.h" |
---|
[41399bd] | 29 | #else |
---|
| 30 | #include "aubio/aubio.h" |
---|
| 31 | #endif |
---|
[ae6e15c] | 32 | |
---|
[96fe713] | 33 | #define Py_default_vector_length 1024 |
---|
[9b23eb31] | 34 | |
---|
[2f9af5d] | 35 | #define Py_aubio_default_samplerate 44100 |
---|
[352fd5f] | 36 | |
---|
[615ac7d] | 37 | #if HAVE_AUBIO_DOUBLE |
---|
[c6388f4] | 38 | #warning "double mode needs love" |
---|
[615ac7d] | 39 | #define AUBIO_NPY_SMPL NPY_DOUBLE |
---|
[c6388f4] | 40 | #define AUBIO_NPY_SMPL_STR "float64" |
---|
| 41 | #define AUBIO_NPY_SMPL_CHR "d" |
---|
[352fd5f] | 42 | #else |
---|
[615ac7d] | 43 | #define AUBIO_NPY_SMPL NPY_FLOAT |
---|
[c6388f4] | 44 | #define AUBIO_NPY_SMPL_STR "float32" |
---|
| 45 | #define AUBIO_NPY_SMPL_CHR "f" |
---|
[352fd5f] | 46 | #endif |
---|
| 47 | |
---|
[770b9e7] | 48 | // compat with Python < 2.6 |
---|
| 49 | #ifndef Py_TYPE |
---|
| 50 | #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) |
---|
| 51 | #endif |
---|
| 52 | |
---|
[9b23eb31] | 53 | extern PyTypeObject Py_cvecType; |
---|
| 54 | |
---|
[ede5d38] | 55 | PyObject * new_py_fvec(uint_t length); |
---|
| 56 | PyObject * new_py_cvec(uint_t length); |
---|
| 57 | PyObject * new_py_fmat(uint_t height, uint_t length); |
---|
| 58 | |
---|
[03c3450] | 59 | // defined in aubio-proxy.c |
---|
| 60 | extern PyObject *PyAubio_CFvecToArray (fvec_t * self); |
---|
[bfe8256] | 61 | extern int PyAubio_ArrayToCFvec (PyObject * self, fvec_t *out); |
---|
[03c3450] | 62 | |
---|
[92a8800] | 63 | extern PyObject * PyAubio_CCvecToPyCvec (cvec_t * self); |
---|
| 64 | extern int PyAubio_PyCvecToCCvec (PyObject *input, cvec_t *i); |
---|
[03c3450] | 65 | |
---|
| 66 | extern PyObject *PyAubio_CFmatToArray (fmat_t * self); |
---|
[bfe8256] | 67 | extern int PyAubio_ArrayToCFmat (PyObject *input, fmat_t *out); |
---|
[03c3450] | 68 | |
---|
| 69 | // hand written wrappers |
---|
[9b23eb31] | 70 | extern PyTypeObject Py_filterType; |
---|
| 71 | |
---|
[615ac7d] | 72 | extern PyTypeObject Py_filterbankType; |
---|
[352fd5f] | 73 | |
---|
[615ac7d] | 74 | extern PyTypeObject Py_fftType; |
---|
| 75 | |
---|
| 76 | extern PyTypeObject Py_pvocType; |
---|
[03c3450] | 77 | |
---|
[d27634d] | 78 | extern PyTypeObject Py_sourceType; |
---|
| 79 | |
---|
[f1100a4] | 80 | extern PyTypeObject Py_sinkType; |
---|