Changeset 21234ee for python/ext/aubioproxy.c
- Timestamp:
- Dec 18, 2013, 8:07:27 AM (11 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:
- 6465d7f
- Parents:
- 1573b16 (diff), c3c6305 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/aubioproxy.c
r1573b16 r21234ee 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 ((PyArrayObject *)array); 38 long length = PyArray_SIZE ((PyArrayObject *)array); 39 if (length > 0) { 40 vec->length = (uint_t)length; 41 } else { 42 PyErr_SetString (PyExc_ValueError, "input array size should be greater than 0"); 43 goto fail; 44 } 39 45 vec->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)array, 0); 40 46 … … 131 137 // no need to really allocate fvec, just its struct member 132 138 mat = (fmat_t *)malloc(sizeof(fmat_t)); 133 mat->length = PyArray_DIM ((PyArrayObject *)array, 1); 134 mat->height = PyArray_DIM ((PyArrayObject *)array, 0); 139 long length = PyArray_DIM ((PyArrayObject *)array, 1); 140 if (length > 0) { 141 mat->length = (uint_t)length; 142 } else { 143 PyErr_SetString (PyExc_ValueError, "input array dimension 1 should be greater than 0"); 144 goto fail; 145 } 146 long height = PyArray_DIM ((PyArrayObject *)array, 0); 147 if (height > 0) { 148 mat->height = (uint_t)height; 149 } else { 150 PyErr_SetString (PyExc_ValueError, "input array dimension 0 should be greater than 0"); 151 goto fail; 152 } 135 153 mat->data = (smpl_t **)malloc(sizeof(smpl_t*) * mat->height); 136 154 for (i=0; i< mat->height; i++) {
Note: See TracChangeset
for help on using the changeset viewer.