Ignore:
Timestamp:
Apr 28, 2016, 6:59:55 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:
6937842
Parents:
1f4d932
Message:

python/ext/py-cvec.c: rewrite and simplify aubio.cvec, safer and better memory usage (see #49)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/aubioproxy.c

    r1f4d932 r92a8800  
    5454  out->data = (smpl_t *) PyArray_GETPTR1 ((PyArrayObject *)input, 0);
    5555  return 1;
    56 }
    57 
    58 PyObject *
    59 PyAubio_CCvecToPyCvec (cvec_t * input, Py_cvec *vec) {
    60   vec->length = input->length;
    61   vec->o = input;
    62   // keep a reference to re-use after returning it
    63   Py_INCREF(vec);
    64   return (PyObject *)vec;
    65 }
    66 
    67 int
    68 PyAubio_ArrayToCCvec (PyObject *input, cvec_t *i) {
    69   if (PyObject_TypeCheck (input, &Py_cvecType)) {
    70       //*i = *(((Py_cvec*)input)->o);
    71       i->norm = ((Py_cvec*)input)->o->norm;
    72       i->phas = ((Py_cvec*)input)->o->phas;
    73       i->length = ((Py_cvec*)input)->o->length;
    74       return 1;
    75   } else {
    76       PyErr_SetString (PyExc_ValueError, "input array should be aubio.cvec");
    77       return 0;
    78   }
    7956}
    8057
Note: See TracChangeset for help on using the changeset viewer.