[py] musicutils also use Pyfloat_FromDouble
authorPaul Brossier <piem@piem.org>
Wed, 19 Dec 2018 16:14:59 +0000 (17:14 +0100)
committerPaul Brossier <piem@piem.org>
Wed, 19 Dec 2018 16:14:59 +0000 (17:14 +0100)
python/ext/py-musicutils.c

index 3d90daf..0827ea2 100644 (file)
@@ -39,7 +39,7 @@ Py_aubio_level_lin(PyObject *self, PyObject *args)
     return NULL;
   }
 
     return NULL;
   }
 
-  level_lin = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_lin(&vec));
+  level_lin = PyFloat_FromDouble(aubio_level_lin(&vec));
   if (level_lin == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
     return NULL;
   if (level_lin == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
     return NULL;
@@ -67,7 +67,7 @@ Py_aubio_db_spl(PyObject *self, PyObject *args)
     return NULL;
   }
 
     return NULL;
   }
 
-  db_spl = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_db_spl(&vec));
+  db_spl = PyFloat_FromDouble(aubio_db_spl(&vec));
   if (db_spl == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
     return NULL;
   if (db_spl == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
     return NULL;
@@ -96,7 +96,7 @@ Py_aubio_silence_detection(PyObject *self, PyObject *args)
     return NULL;
   }
 
     return NULL;
   }
 
-  silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold));
+  silence_detection = PyLong_FromLong(aubio_silence_detection(&vec, threshold));
   if (silence_detection == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
     return NULL;
   if (silence_detection == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
     return NULL;
@@ -125,7 +125,7 @@ Py_aubio_level_detection(PyObject *self, PyObject *args)
     return NULL;
   }
 
     return NULL;
   }
 
-  level_detection = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_detection(&vec, threshold));
+  level_detection = PyFloat_FromDouble(aubio_level_detection(&vec, threshold));
   if (level_detection == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
     return NULL;
   if (level_detection == NULL) {
     PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
     return NULL;