Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-musicutils.c

    rff89a06 r9c8c8a6  
    99
    1010  if (!PyArg_ParseTuple (args, "|sI", &wintype, &winlen)) {
     11    PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
    1112    return NULL;
    1213  }
     
    2526{
    2627  PyObject *input;
    27   fvec_t vec;
     28  fvec_t *vec;
    2829  PyObject *level_lin;
    2930
    3031  if (!PyArg_ParseTuple (args, "O:level_lin", &input)) {
     32    PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
    3133    return NULL;
    3234  }
     
    3638  }
    3739
    38   if (!PyAubio_ArrayToCFvec(input, &vec)) {
     40  vec = PyAubio_ArrayToCFvec (input);
     41  if (vec == NULL) {
    3942    return NULL;
    4043  }
    4144
    42   level_lin = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_level_lin(&vec));
     45  level_lin = Py_BuildValue("f", aubio_level_lin(vec));
    4346  if (level_lin == NULL) {
    4447    PyErr_SetString (PyExc_ValueError, "failed computing level_lin");
     
    5356{
    5457  PyObject *input;
    55   fvec_t vec;
     58  fvec_t *vec;
    5659  PyObject *db_spl;
    5760
    5861  if (!PyArg_ParseTuple (args, "O:db_spl", &input)) {
     62    PyErr_SetString (PyExc_ValueError, "failed parsing arguments");
    5963    return NULL;
    6064  }
     
    6468  }
    6569
    66   if (!PyAubio_ArrayToCFvec(input, &vec)) {
     70  vec = PyAubio_ArrayToCFvec (input);
     71  if (vec == NULL) {
    6772    return NULL;
    6873  }
    6974
    70   db_spl = Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_db_spl(&vec));
     75  db_spl = Py_BuildValue("f", aubio_db_spl(vec));
    7176  if (db_spl == NULL) {
    7277    PyErr_SetString (PyExc_ValueError, "failed computing db_spl");
     
    8186{
    8287  PyObject *input;
    83   fvec_t vec;
     88  fvec_t *vec;
    8489  PyObject *silence_detection;
    8590  smpl_t threshold;
    8691
    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");
    8894    return NULL;
    8995  }
     
    9399  }
    94100
    95   if (!PyAubio_ArrayToCFvec(input, &vec)) {
     101  vec = PyAubio_ArrayToCFvec (input);
     102  if (vec == NULL) {
    96103    return NULL;
    97104  }
    98105
    99   silence_detection = Py_BuildValue("I", aubio_silence_detection(&vec, threshold));
     106  silence_detection = Py_BuildValue("I", aubio_silence_detection(vec, threshold));
    100107  if (silence_detection == NULL) {
    101108    PyErr_SetString (PyExc_ValueError, "failed computing silence_detection");
     
    110117{
    111118  PyObject *input;
    112   fvec_t vec;
     119  fvec_t *vec;
    113120  PyObject *level_detection;
    114121  smpl_t threshold;
    115122
    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");
    117125    return NULL;
    118126  }
     
    122130  }
    123131
    124   if (!PyAubio_ArrayToCFvec(input, &vec)) {
     132  vec = PyAubio_ArrayToCFvec (input);
     133  if (vec == NULL) {
    125134    return NULL;
    126135  }
    127136
    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));
    129138  if (level_detection == NULL) {
    130139    PyErr_SetString (PyExc_ValueError, "failed computing level_detection");
Note: See TracChangeset for help on using the changeset viewer.