History

aubiomodule.c: simplify includes

Paul Brossier committed 13 years ago

Commit 7a6521d1 parent 6514bb62 files · +21 −10Browse files

Showing the changes to python (2 of 2 files). Show all

Unified · Split

2 files
  1. python/aubio-types.h +18 −4
  2. python/aubiomodule.c +3 −6
python/aubio-types.h+18−4
@@ -1,13 +1,27 @@
1−#include <Python.h>
1+#include "Python.h"
22 #include <structmember.h>
3−#define NO_IMPORT_ARRAY
3+
44 //#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
5−#include <numpy/arrayobject.h>
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+#define NO_IMPORT_UFUNC
14+#endif
15+
16+// import aubio
17+#include <numpy/ndarraytypes.h>
18+#include <numpy/ufuncobject.h>
19+#include <numpy/npy_3kcompat.h>
20+
621 #define AUBIO_UNSTABLE 1
722 #include <aubio.h>
823
924 #define Py_default_vector_length 1024
10−#define Py_default_vector_height 1
1125
1226 #define Py_aubio_default_samplerate 44100
1327
python/aubiomodule.c+3−6
@@ -1,8 +1,4 @@
1−#include <Python.h>
2−#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API
3−//#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
4−#include <numpy/arrayobject.h>
5−
1+#define PY_AUBIO_MODULE_MAIN
62 #include "aubio-types.h"
73 #include "generated/aubio-generated.h"
84
@@ -246,6 +242,7 @@ init_aubio (void) · 237 unmodified lines
246242 PyObject *m;
247243 int err;
248244
245+ // fvec is defined in __init__.py
249246 if ( (PyType_Ready (&Py_cvecType) < 0)
250247 || (PyType_Ready (&Py_filterType) < 0)
251248 || (PyType_Ready (&Py_filterbankType) < 0)
@@ -281,6 +278,6 @@ init_aubio (void) · 29 unmodified lines
281278 Py_INCREF (&Py_pvocType);
282279 PyModule_AddObject (m, "pvoc", (PyObject *) & Py_pvocType);
283280
284− // generated objects
281+ // add generated objects
285282 add_generated_objects(m);
286283 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t