History

[py] musicutils also use Pyfloat_FromDouble

Paul Brossier committed 7 years ago

Commit a617bf31 parent df66c371 file · +4 −4Browse files

Showing the changes to python/ext (1 of 1 file). Show all

Unified · Split

python/ext/py-musicutils.c+4−4
@@ -39,7 +39,7 @@ Py_aubio_level_lin(PyObject *self, PyObject *args) · 38 unmodified lines
39 return NULL;39 return NULL;
40 }40 }
41 41
42 level_lin = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_lin(&vec));42 level_lin = PyFloat_FromDouble(aubio_level_lin(&vec));
43 if (level_lin == NULL) {43 if (level_lin == NULL) {
44 PyErr_SetString (PyExc_ValueError, "failed computing level_lin");44 PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
45 return NULL;45 return NULL;
@@ -67,7 +67,7 @@ Py_aubio_db_spl(PyObject *self, PyObject *args) · 21 unmodified lines
67 return NULL;67 return NULL;
68 }68 }
69 69
70 db_spl = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_db_spl(&vec));70 db_spl = PyFloat_FromDouble(aubio_db_spl(&vec));
71 if (db_spl == NULL) {71 if (db_spl == NULL) {
72 PyErr_SetString (PyExc_ValueError, "failed computing db_spl");72 PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
73 return NULL;73 return NULL;
@@ -96,7 +96,7 @@ Py_aubio_silence_detection(PyObject *self, PyObject *args) · 22 unmodified lines
96 return NULL;96 return NULL;
97 }97 }
98 98
99 silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold));99 silence_detection = PyLong_FromLong(aubio_silence_detection(&vec, threshold));
100 if (silence_detection == NULL) {100 if (silence_detection == NULL) {
101 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");101 PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
102 return NULL;102 return NULL;
@@ -125,7 +125,7 @@ Py_aubio_level_detection(PyObject *self, PyObject *args) · 22 unmodified lines
125 return NULL;125 return NULL;
126 }126 }
127 127
128 level_detection = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_detection(&vec, threshold));128 level_detection = PyFloat_FromDouble(aubio_level_detection(&vec, threshold));
129 if (level_detection == NULL) {129 if (level_detection == NULL) {
130 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");130 PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
131 return NULL;131 return NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t