Changeset 307fdfc for python/ext


Ignore:
Timestamp:
Apr 29, 2016, 9:49:57 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
b055b4e
Parents:
1ee5e21
Message:

python/ext/py-phasevoc.c: use new_py_fvec, new_py_cvec

File:
1 edited

Legend:

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

    r1ee5e21 r307fdfc  
    1010  uint_t hop_s;
    1111  fvec_t vecin;
    12   cvec_t *output;
    1312  cvec_t cvecin;
    14   fvec_t *routput;
     13  PyObject *output;
     14  cvec_t c_output;
     15  PyObject *routput;
     16  fvec_t c_routput;
    1517} Py_pvoc;
    1618
     
    7173  }
    7274
    73   self->output = new_cvec(self->win_s);
    74   self->routput = new_fvec(self->hop_s);
     75  self->output = new_py_cvec(self->win_s);
     76  self->routput = new_py_fvec(self->hop_s);
    7577
    7678  return 0;
     
    8183Py_pvoc_del (Py_pvoc *self, PyObject *unused)
    8284{
     85  Py_XDECREF(self->output);
     86  Py_XDECREF(self->routput);
    8387  del_aubio_pvoc(self->o);
    84   del_cvec(self->output);
    85   del_fvec(self->routput);
    8688  Py_TYPE(self)->tp_free((PyObject *) self);
    8789}
     
    101103  }
    102104
     105  Py_INCREF(self->output);
     106  if (!PyAubio_PyCvecToCCvec (self->output, &(self->c_output))) {
     107    return NULL;
     108  }
    103109  // compute the function
    104   aubio_pvoc_do (self->o, &(self->vecin), self->output);
    105   // convert cvec to py_cvec
    106   return PyAubio_CCvecToPyCvec(self->output);
     110  aubio_pvoc_do (self->o, &(self->vecin), &(self->c_output));
     111  return self->output;
    107112}
    108113
     
    115120};
    116121
    117 static PyObject * 
     122static PyObject *
    118123Py_pvoc_rdo(Py_pvoc * self, PyObject * args)
    119124{
     
    127132  }
    128133
     134  Py_INCREF(self->routput);
     135  if (!PyAubio_ArrayToCFvec(self->routput, &(self->c_routput)) ) {
     136    return NULL;
     137  }
    129138  // compute the function
    130   aubio_pvoc_rdo (self->o, &(self->cvecin), self->routput);
    131   return PyAubio_CFvecToArray(self->routput);
     139  aubio_pvoc_rdo (self->o, &(self->cvecin), &(self->c_routput));
     140  return self->routput;
    132141}
    133142
Note: See TracChangeset for help on using the changeset viewer.