Changeset 1458de5
- Timestamp:
- Jul 11, 2012, 3:41:33 AM (12 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 988f580
- Parents:
- c71e405
- Location:
- interfaces/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
interfaces/python/aubio-types.h
rc71e405 r1458de5 2 2 #include <structmember.h> 3 3 #define NO_IMPORT_ARRAY 4 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 4 5 #include <numpy/arrayobject.h> 5 6 #define AUBIO_UNSTABLE 1 -
interfaces/python/aubiomodule.c
rc71e405 r1458de5 1 1 #include <Python.h> 2 2 #define PY_ARRAY_UNIQUE_SYMBOL PyArray_API 3 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION 3 4 #include <numpy/arrayobject.h> 4 5 … … 132 133 } 133 134 135 m = Py_InitModule3 ("_aubio", aubio_methods, aubio_module_doc); 136 137 if (m == NULL) { 138 return; 139 } 140 134 141 err = _import_array (); 135 142 … … 137 144 fprintf (stderr, 138 145 "Unable to import Numpy C API from aubio module (error %d)\n", err); 139 }140 141 m = Py_InitModule3 ("_aubio", aubio_methods, aubio_module_doc);142 143 if (m == NULL) {144 return;145 146 } 146 147 -
interfaces/python/aubioproxy.c
rc71e405 r1458de5 13 13 14 14 // we got an array, convert it to an fvec 15 if (PyArray_NDIM ( input) == 0) {15 if (PyArray_NDIM ((PyArrayObject *)input) == 0) { 16 16 PyErr_SetString (PyExc_ValueError, "input array is a scalar"); 17 17 goto fail; 18 } else if (PyArray_NDIM ( input) > 1) {18 } else if (PyArray_NDIM ((PyArrayObject *)input) > 1) { 19 19 PyErr_SetString (PyExc_ValueError, 20 20 "input array has more than one dimensions"); … … 22 22 } 23 23 24 if (!PyArray_ISFLOAT ( input)) {24 if (!PyArray_ISFLOAT ((PyArrayObject *)input)) { 25 25 PyErr_SetString (PyExc_ValueError, "input array should be float"); 26 26 goto fail; 27 } else if (PyArray_TYPE ( input) != AUBIO_NPY_SMPL) {27 } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) { 28 28 PyErr_SetString (PyExc_ValueError, "input array should be float32"); 29 29 goto fail; … … 36 36 // no need to really allocate fvec, just its struct member 37 37 vec = (fvec_t *)malloc(sizeof(fvec_t)); 38 vec->length = PyArray_SIZE ( array);39 vec->data = (smpl_t *) PyArray_GETPTR1 ( array, 0);38 vec->length = PyArray_SIZE ((PyArrayObject *)array); 39 vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0); 40 40 41 41 } else if (PyObject_TypeCheck (input, &PyList_Type)) { -
interfaces/python/py-cvec.c
rc71e405 r1458de5 126 126 Py_cvec_set_norm (Py_cvec * vec, PyObject *input, void * closure) 127 127 { 128 Py Object * array;128 PyArrayObject * array; 129 129 if (input == NULL) { 130 130 PyErr_SetString (PyExc_ValueError, "input array is not a python object"); … … 134 134 135 135 // we got an array, convert it to a cvec.norm 136 if (PyArray_NDIM ( input) == 0) {136 if (PyArray_NDIM ((PyArrayObject *)input) == 0) { 137 137 PyErr_SetString (PyExc_ValueError, "input array is a scalar"); 138 138 goto fail; 139 } else if (PyArray_NDIM ( input) > 2) {139 } else if (PyArray_NDIM ((PyArrayObject *)input) > 2) { 140 140 PyErr_SetString (PyExc_ValueError, 141 141 "input array has more than two dimensions"); … … 143 143 } 144 144 145 if (!PyArray_ISFLOAT ( input)) {145 if (!PyArray_ISFLOAT ((PyArrayObject *)input)) { 146 146 PyErr_SetString (PyExc_ValueError, "input array should be float"); 147 147 goto fail; 148 } else if (PyArray_TYPE ( input) != AUBIO_NPY_SMPL) {148 } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) { 149 149 PyErr_SetString (PyExc_ValueError, "input array should be float32"); 150 150 goto fail; 151 151 } 152 array = input;152 array = (PyArrayObject *)input; 153 153 154 154 // check input array dimensions … … 162 162 PyErr_Format (PyExc_ValueError, 163 163 "input array has length %d, but cvec has length %d", 164 PyArray_SIZE (array), vec->o->length);164 (int)PyArray_SIZE (array), vec->o->length); 165 165 goto fail; 166 166 } … … 184 184 Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) 185 185 { 186 Py Object * array;186 PyArrayObject * array; 187 187 if (input == NULL) { 188 188 PyErr_SetString (PyExc_ValueError, "input array is not a python object"); … … 192 192 193 193 // we got an array, convert it to a cvec.phas 194 if (PyArray_NDIM ( input) == 0) {194 if (PyArray_NDIM ((PyArrayObject *)input) == 0) { 195 195 PyErr_SetString (PyExc_ValueError, "input array is a scalar"); 196 196 goto fail; 197 } else if (PyArray_NDIM ( input) > 2) {197 } else if (PyArray_NDIM ((PyArrayObject *)input) > 2) { 198 198 PyErr_SetString (PyExc_ValueError, 199 199 "input array has more than two dimensions"); … … 201 201 } 202 202 203 if (!PyArray_ISFLOAT ( input)) {203 if (!PyArray_ISFLOAT ((PyArrayObject *)input)) { 204 204 PyErr_SetString (PyExc_ValueError, "input array should be float"); 205 205 goto fail; 206 } else if (PyArray_TYPE ( input) != AUBIO_NPY_SMPL) {206 } else if (PyArray_TYPE ((PyArrayObject *)input) != AUBIO_NPY_SMPL) { 207 207 PyErr_SetString (PyExc_ValueError, "input array should be float32"); 208 208 goto fail; 209 209 } 210 array = input;210 array = (PyArrayObject *)input; 211 211 212 212 // check input array dimensions … … 220 220 PyErr_Format (PyExc_ValueError, 221 221 "input array has length %d, but cvec has length %d", 222 PyArray_SIZE (array), vec->o->length);222 (int)PyArray_SIZE (array), vec->o->length); 223 223 goto fail; 224 224 }
Note: See TracChangeset
for help on using the changeset viewer.