Changeset 569b363 for python/ext/aubiomodule.c
- Timestamp:
- Apr 24, 2016, 6:23:14 PM (8 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:
- 51b9c83
- Parents:
- a35db12
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/aubiomodule.c
ra35db12 r569b363 84 84 { 85 85 PyObject *input; 86 fvec_t *vec;86 fvec_t vec; 87 87 smpl_t alpha; 88 88 PyObject *result; … … 96 96 } 97 97 98 vec = (fvec_t *)malloc(sizeof(fvec_t)); 99 if (!PyAubio_ArrayToCFvec(input, vec)) { 100 free(vec); 98 if (!PyAubio_ArrayToCFvec(input, &vec)) { 101 99 return NULL; 102 100 } 103 101 104 102 // compute the function 105 result = Py_BuildValue ("f", fvec_alpha_norm (vec, alpha)); 106 free(vec); 103 result = Py_BuildValue ("f", fvec_alpha_norm (&vec, alpha)); 107 104 if (result == NULL) { 108 105 return NULL; … … 176 173 { 177 174 PyObject *input; 178 fvec_t *vec;175 fvec_t vec; 179 176 PyObject *result; 180 177 … … 187 184 } 188 185 189 vec = (fvec_t *)malloc(sizeof(fvec_t)); 190 if (!PyAubio_ArrayToCFvec(input, vec)) { 191 free(vec); 186 if (!PyAubio_ArrayToCFvec(input, &vec)) { 192 187 return NULL; 193 188 } 194 189 195 190 // compute the function 196 result = Py_BuildValue ("f", aubio_zero_crossing_rate (vec)); 197 free(vec); 191 result = Py_BuildValue ("f", aubio_zero_crossing_rate (&vec)); 198 192 if (result == NULL) { 199 193 return NULL; … … 207 201 { 208 202 PyObject *input; 209 fvec_t *vec;203 fvec_t vec; 210 204 211 205 if (!PyArg_ParseTuple (args, "O:min_removal", &input)) { … … 217 211 } 218 212 219 vec = (fvec_t *)malloc(sizeof(fvec_t)); 220 if (!PyAubio_ArrayToCFvec(input, vec)) { 221 free(vec); 213 if (!PyAubio_ArrayToCFvec(input, &vec)) { 222 214 return NULL; 223 215 } 224 216 225 217 // compute the function 226 fvec_min_removal ( vec);218 fvec_min_removal (&vec); 227 219 228 220 // since this function does not return, we could return None 229 221 //Py_RETURN_NONE; 230 222 // however it is convenient to return the modified vector 231 return (PyObject *) PyAubio_CFvecToArray( vec);223 return (PyObject *) PyAubio_CFvecToArray(&vec); 232 224 // or even without converting it back to an array 233 225 //Py_INCREF(vec);
Note: See TracChangeset
for help on using the changeset viewer.