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