ref: 7a6521daf3f38207403d27f6b49d4c6a48288ee3
parent: 6514bb6bdc338fa1c446c08408a30a6434096003
author: Paul Brossier <piem@piem.org>
date: Mon Mar 4 09:28:17 EST 2013
aubiomodule.c: simplify includes
--- a/python/aubio-types.h
+++ b/python/aubio-types.h
@@ -1,13 +1,27 @@
-#include <Python.h>
+#include "Python.h"
#include <structmember.h>
-#define NO_IMPORT_ARRAY
+
//#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
-#include <numpy/arrayobject.h>
+
+// define numpy unique symbols for aubio
+#define PY_ARRAY_UNIQUE_SYMBOL PYAUBIO_ARRAY_API
+#define PY_UFUNC_UNIQUE_SYMBOL PYAUBIO_UFUNC_API
+
+// only import array and ufunc from main module
+#ifndef PY_AUBIO_MODULE_MAIN
+#define NO_IMPORT_ARRAY
+#define NO_IMPORT_UFUNC
+#endif
+
+// import aubio
+#include <numpy/ndarraytypes.h>
+#include <numpy/ufuncobject.h>
+#include <numpy/npy_3kcompat.h>
+
#define AUBIO_UNSTABLE 1
#include <aubio.h>
#define Py_default_vector_length 1024
-#define Py_default_vector_height 1
#define Py_aubio_default_samplerate 44100
--- a/python/aubiomodule.c
+++ b/python/aubiomodule.c
@@ -1,8 +1,4 @@
-#include <Python.h>
-#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API
-//#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
-#include <numpy/arrayobject.h>
-
+#define PY_AUBIO_MODULE_MAIN
#include "aubio-types.h"
#include "generated/aubio-generated.h"
@@ -246,6 +242,7 @@
PyObject *m;
int err;
+ // fvec is defined in __init__.py
if ( (PyType_Ready (&Py_cvecType) < 0)
|| (PyType_Ready (&Py_filterType) < 0)
|| (PyType_Ready (&Py_filterbankType) < 0)
@@ -281,6 +278,6 @@
Py_INCREF (&Py_pvocType);
PyModule_AddObject (m, "pvoc", (PyObject *) & Py_pvocType);
- // generated objects
+ // add generated objects
add_generated_objects(m);
}