Changeset 569b363 for python/ext/py-musicutils.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/py-musicutils.c
ra35db12 r569b363 26 26 { 27 27 PyObject *input; 28 fvec_t *vec;28 fvec_t vec; 29 29 PyObject *level_lin; 30 30 … … 38 38 } 39 39 40 vec = (fvec_t *)malloc(sizeof(fvec_t)); 41 if (!PyAubio_ArrayToCFvec(input, vec)) { 42 free(vec); 40 if (!PyAubio_ArrayToCFvec(input, &vec)) { 43 41 return NULL; 44 42 } 45 43 46 level_lin = Py_BuildValue("f", aubio_level_lin(vec)); 47 free(vec); 44 level_lin = Py_BuildValue("f", aubio_level_lin(&vec)); 48 45 if (level_lin == NULL) { 49 46 PyErr_SetString (PyExc_ValueError, "failed computing level_lin"); … … 58 55 { 59 56 PyObject *input; 60 fvec_t *vec;57 fvec_t vec; 61 58 PyObject *db_spl; 62 59 … … 70 67 } 71 68 72 vec = (fvec_t *)malloc(sizeof(fvec_t)); 73 if (!PyAubio_ArrayToCFvec(input, vec)) { 74 free(vec); 69 if (!PyAubio_ArrayToCFvec(input, &vec)) { 75 70 return NULL; 76 71 } 77 72 78 db_spl = Py_BuildValue("f", aubio_db_spl(vec)); 79 free(vec); 73 db_spl = Py_BuildValue("f", aubio_db_spl(&vec)); 80 74 if (db_spl == NULL) { 81 75 PyErr_SetString (PyExc_ValueError, "failed computing db_spl"); … … 90 84 { 91 85 PyObject *input; 92 fvec_t *vec;86 fvec_t vec; 93 87 PyObject *silence_detection; 94 88 smpl_t threshold; … … 103 97 } 104 98 105 vec = (fvec_t *)malloc(sizeof(fvec_t)); 106 if (!PyAubio_ArrayToCFvec(input, vec)) { 107 free(vec); 99 if (!PyAubio_ArrayToCFvec(input, &vec)) { 108 100 return NULL; 109 101 } 110 102 111 silence_detection = Py_BuildValue("I", aubio_silence_detection(vec, threshold)); 112 free(vec); 103 silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold)); 113 104 if (silence_detection == NULL) { 114 105 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection"); … … 123 114 { 124 115 PyObject *input; 125 fvec_t *vec;116 fvec_t vec; 126 117 PyObject *level_detection; 127 118 smpl_t threshold; … … 136 127 } 137 128 138 vec = (fvec_t *)malloc(sizeof(fvec_t)); 139 if (!PyAubio_ArrayToCFvec(input, vec)) { 140 free(vec); 129 if (!PyAubio_ArrayToCFvec(input, &vec)) { 141 130 return NULL; 142 131 } 143 132 144 level_detection = Py_BuildValue("f", aubio_level_detection(vec, threshold)); 145 free(vec); 133 level_detection = Py_BuildValue("f", aubio_level_detection(&vec, threshold)); 146 134 if (level_detection == NULL) { 147 135 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
Note: See TracChangeset
for help on using the changeset viewer.