source: python/ext/aubio-types.h @ b4e1438

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

python/{ext,lib}: prepare for double precision

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#include <Python.h>
2#include <structmember.h>
3
4#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
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
13#endif
14#include <numpy/arrayobject.h>
15#ifndef PY_AUBIO_MODULE_UFUNC
16#define NO_IMPORT_UFUNC
17#else
18#include <numpy/ufuncobject.h>
19#endif
20
21//#include <numpy/npy_3kcompat.h>
22
23// import aubio
24#define AUBIO_UNSTABLE 1
25#ifdef USE_LOCAL_AUBIO
26#include "aubio.h"
27#else
28#include "aubio/aubio.h"
29#endif
30
31#define Py_default_vector_length 1024
32
33#define Py_aubio_default_samplerate 44100
34
35#if HAVE_AUBIO_DOUBLE
36#warning "double mode needs love"
37#define AUBIO_NPY_SMPL NPY_DOUBLE
38#define AUBIO_NPY_SMPL_STR "float64"
39#define AUBIO_NPY_SMPL_CHR "d"
40#else
41#define AUBIO_NPY_SMPL NPY_FLOAT
42#define AUBIO_NPY_SMPL_STR "float32"
43#define AUBIO_NPY_SMPL_CHR "f"
44#endif
45
46// compat with Python < 2.6
47#ifndef Py_TYPE
48#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
49#endif
50
51// special python type for cvec
52typedef struct
53{
54  PyObject_HEAD
55  cvec_t * o;
56  uint_t length;
57} Py_cvec;
58extern PyTypeObject Py_cvecType;
59
60// defined in aubio-proxy.c
61extern PyObject *PyAubio_CFvecToArray (fvec_t * self);
62extern int PyAubio_ArrayToCFvec (PyObject * self, fvec_t *out);
63
64extern PyObject * PyAubio_CCvecToPyCvec (cvec_t * self, Py_cvec *out);
65extern int PyAubio_ArrayToCCvec (PyObject *input, cvec_t *i);
66
67extern PyObject *PyAubio_CFmatToArray (fmat_t * self);
68extern int PyAubio_ArrayToCFmat (PyObject *input, fmat_t *out);
69
70// hand written wrappers
71extern PyTypeObject Py_filterType;
72
73extern PyTypeObject Py_filterbankType;
74
75extern PyTypeObject Py_fftType;
76
77extern PyTypeObject Py_pvocType;
78
79extern PyTypeObject Py_sourceType;
80
81extern PyTypeObject Py_sinkType;
Note: See TracBrowser for help on using the repository browser.