Changeset ce4bfe3


Ignore:
Timestamp:
Dec 25, 2009, 4:49:14 AM (14 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:
7d9ec37
Parents:
363ce7a
Message:

aubiomodule.c: swith to new proxy functions, remove py_fvec and py_fmat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • interfaces/python/aubiomodule.c

    r363ce7a rce4bfe3  
    1212{
    1313  PyObject *input;
    14   Py_fvec *vec;
     14  fvec_t *vec;
    1515  smpl_t alpha;
    1616  PyObject *result;
     
    2424  }
    2525
    26   vec = PyAubio_ArrayToFvec (input);
     26  vec = PyAubio_ArrayToCFvec (input);
    2727
    2828  if (vec == NULL) {
     
    3131
    3232  // compute the function
    33   result = Py_BuildValue ("f", fvec_alpha_norm (vec->o, alpha));
     33  result = Py_BuildValue ("f", fvec_alpha_norm (vec, alpha));
    3434  if (result == NULL) {
    3535    return NULL;
     
    4545{
    4646  PyObject *input;
    47   Py_fvec *vec;
     47  fvec_t *vec;
    4848  PyObject *result;
    4949
     
    5656  }
    5757
    58   vec = PyAubio_ArrayToFvec (input);
     58  vec = PyAubio_ArrayToCFvec (input);
    5959
    6060  if (vec == NULL) {
     
    6363
    6464  // compute the function
    65   result = Py_BuildValue ("f", aubio_zero_crossing_rate (vec->o));
     65  result = Py_BuildValue ("f", aubio_zero_crossing_rate (vec));
    6666  if (result == NULL) {
    6767    return NULL;
     
    7373static char Py_min_removal_doc[] = "compute zero crossing rate";
    7474
    75 static PyObject * 
     75static PyObject *
    7676Py_min_removal(PyObject * self, PyObject * args)
    7777{
    7878  PyObject *input;
    79   Py_fvec *vec;
     79  fvec_t *vec;
    8080
    8181  if (!PyArg_ParseTuple (args, "O:min_removal", &input)) {
     
    8787  }
    8888
    89   vec = PyAubio_ArrayToFvec (input);
     89  vec = PyAubio_ArrayToCFvec (input);
    9090
    9191  if (vec == NULL) {
     
    9494
    9595  // compute the function
    96   fvec_min_removal (vec->o);
     96  fvec_min_removal (vec);
    9797
    9898  // since this function does not return, we could return None
    9999  //return Py_None;
    100   // however it is convenient to return the modified vector 
    101   return (PyObject *) PyAubio_FvecToArray(vec);
     100  // however it is convenient to return the modified vector
     101  return (PyObject *) PyAubio_CFvecToArray(vec);
    102102  // or even without converting it back to an array
    103103  //Py_INCREF(vec);
     
    107107static PyMethodDef aubio_methods[] = {
    108108  {"alpha_norm", Py_alpha_norm, METH_VARARGS, Py_alpha_norm_doc},
    109   {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS, 
     109  {"zero_crossing_rate", Py_zero_crossing_rate, METH_VARARGS,
    110110    Py_zero_crossing_rate_doc},
    111111  {"min_removal", Py_min_removal, METH_VARARGS, Py_min_removal_doc},
     
    121121  int err;
    122122
    123   if ((PyType_Ready (&Py_fvecType) < 0)
    124       || (PyType_Ready (&Py_fmatType) < 0)
    125       || (PyType_Ready (&Py_cvecType) < 0)
    126       || (PyType_Ready (&Py_filterType) < 0)
    127       || (PyType_Ready (&Py_filterbankType) < 0)
    128       || (PyType_Ready (&Py_fftType) < 0)
    129       || (PyType_Ready (&Py_pvocType) < 0)
     123  if (   (PyType_Ready (&Py_cvecType) < 0)
     124      || (PyType_Ready (&Py_filterType) < 0)
     125      || (PyType_Ready (&Py_filterbankType) < 0)
     126      || (PyType_Ready (&Py_fftType) < 0)
     127      || (PyType_Ready (&Py_pvocType) < 0)
    130128      // generated objects
    131129      || (generated_types_ready() < 0 )
     
    147145  }
    148146
    149   Py_INCREF (&Py_fvecType);
    150   PyModule_AddObject (m, "fvec", (PyObject *) & Py_fvecType);
    151   Py_INCREF (&Py_fmatType);
    152   PyModule_AddObject (m, "fmat", (PyObject *) & Py_fmatType);
    153147  Py_INCREF (&Py_cvecType);
    154148  PyModule_AddObject (m, "cvec", (PyObject *) & Py_cvecType);
Note: See TracChangeset for help on using the changeset viewer.