Changes in python/ext/py-musicutils.c [9c8c8a6:ff89a06]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/ext/py-musicutils.c
r9c8c8a6 rff89a06 9 9 10 10 if (!PyArg_ParseTuple (args, "|sI", &wintype, &winlen)) { 11 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");12 11 return NULL; 13 12 } … … 26 25 { 27 26 PyObject *input; 28 fvec_t *vec;27 fvec_t vec; 29 28 PyObject *level_lin; 30 29 31 30 if (!PyArg_ParseTuple (args, "O:level_lin", &input)) { 32 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");33 31 return NULL; 34 32 } … … 38 36 } 39 37 40 vec = PyAubio_ArrayToCFvec (input); 41 if (vec == NULL) { 38 if (!PyAubio_ArrayToCFvec(input, &vec)) { 42 39 return NULL; 43 40 } 44 41 45 level_lin = Py_BuildValue( "f", aubio_level_lin(vec));42 level_lin = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_lin(&vec)); 46 43 if (level_lin == NULL) { 47 44 PyErr_SetString (PyExc_ValueError, "failed computing level_lin"); … … 56 53 { 57 54 PyObject *input; 58 fvec_t *vec;55 fvec_t vec; 59 56 PyObject *db_spl; 60 57 61 58 if (!PyArg_ParseTuple (args, "O:db_spl", &input)) { 62 PyErr_SetString (PyExc_ValueError, "failed parsing arguments");63 59 return NULL; 64 60 } … … 68 64 } 69 65 70 vec = PyAubio_ArrayToCFvec (input); 71 if (vec == NULL) { 66 if (!PyAubio_ArrayToCFvec(input, &vec)) { 72 67 return NULL; 73 68 } 74 69 75 db_spl = Py_BuildValue( "f", aubio_db_spl(vec));70 db_spl = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_db_spl(&vec)); 76 71 if (db_spl == NULL) { 77 72 PyErr_SetString (PyExc_ValueError, "failed computing db_spl"); … … 86 81 { 87 82 PyObject *input; 88 fvec_t *vec;83 fvec_t vec; 89 84 PyObject *silence_detection; 90 85 smpl_t threshold; 91 86 92 if (!PyArg_ParseTuple (args, "Of:silence_detection", &input, &threshold)) { 93 PyErr_SetString (PyExc_ValueError, "failed parsing arguments"); 87 if (!PyArg_ParseTuple (args, "O" AUBIO_NPY_SMPL_CHR ":silence_detection", &input, &threshold)) { 94 88 return NULL; 95 89 } … … 99 93 } 100 94 101 vec = PyAubio_ArrayToCFvec (input); 102 if (vec == NULL) { 95 if (!PyAubio_ArrayToCFvec(input, &vec)) { 103 96 return NULL; 104 97 } 105 98 106 silence_detection = Py_BuildValue("I", aubio_silence_detection( vec, threshold));99 silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold)); 107 100 if (silence_detection == NULL) { 108 101 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection"); … … 117 110 { 118 111 PyObject *input; 119 fvec_t *vec;112 fvec_t vec; 120 113 PyObject *level_detection; 121 114 smpl_t threshold; 122 115 123 if (!PyArg_ParseTuple (args, "Of:level_detection", &input, &threshold)) { 124 PyErr_SetString (PyExc_ValueError, "failed parsing arguments"); 116 if (!PyArg_ParseTuple (args, "O" AUBIO_NPY_SMPL_CHR ":level_detection", &input, &threshold)) { 125 117 return NULL; 126 118 } … … 130 122 } 131 123 132 vec = PyAubio_ArrayToCFvec (input); 133 if (vec == NULL) { 124 if (!PyAubio_ArrayToCFvec(input, &vec)) { 134 125 return NULL; 135 126 } 136 127 137 level_detection = Py_BuildValue( "f", aubio_level_detection(vec, threshold));128 level_detection = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_detection(&vec, threshold)); 138 129 if (level_detection == NULL) { 139 130 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
Note: See TracChangeset
for help on using the changeset viewer.