Ignore:
Timestamp:
Mar 10, 2017, 2:26:32 PM (2 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
ee8a57c
Parents:
00d0275 (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into awhitening

File:
1 edited

Legend:

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

    r00d0275 r155cc10  
    66  aubio_filter_t * o;
    77  uint_t order;
     8  fvec_t vec;
     9  PyObject *out;
     10  fvec_t c_out;
    811} Py_filter;
    912
     
    4851    return -1;
    4952  }
    50 
     53  self->out = NULL;
    5154  return 0;
    5255}
     
    5558Py_filter_del (Py_filter * self)
    5659{
     60  Py_XDECREF(self->out);
    5761  del_aubio_filter (self->o);
    58   self->ob_type->tp_free ((PyObject *) self);
    59 }
    60 
    61 static PyObject * 
     62  Py_TYPE(self)->tp_free ((PyObject *) self);
     63}
     64
     65static PyObject *
    6266Py_filter_do(Py_filter * self, PyObject * args)
    6367{
    6468  PyObject *input;
    65   fvec_t *vec;
    6669
    6770  if (!PyArg_ParseTuple (args, "O:digital_filter.do", &input)) {
     
    7376  }
    7477
    75   vec = PyAubio_ArrayToCFvec (input);
    76 
    77   if (vec == NULL) {
    78     return NULL;
    79   }
    80 
     78  if (!PyAubio_ArrayToCFvec(input, &(self->vec))) {
     79    return NULL;
     80  }
     81
     82  // initialize output now
     83  if (self->out == NULL) {
     84    self->out = new_py_fvec(self->vec.length);
     85  }
     86
     87  Py_INCREF(self->out);
     88  if (!PyAubio_ArrayToCFvec(self->out, &(self->c_out)) ) {
     89    return NULL;
     90  }
    8191  // compute the function
    82   fvec_t * out = new_fvec(vec->length);
    83   aubio_filter_do_outplace (self->o, vec, out);
    84   return PyAubio_CFvecToArray(out);
    85 }
    86 
    87 static PyObject *
     92  aubio_filter_do_outplace (self->o, &(self->vec), &(self->c_out));
     93  return self->out;
     94}
     95
     96static PyObject *
    8897Py_filter_set_c_weighting (Py_filter * self, PyObject *args)
    8998{
     
    103112}
    104113
    105 static PyObject * 
     114static PyObject *
    106115Py_filter_set_a_weighting (Py_filter * self, PyObject *args)
    107116{
     
    157166
    158167PyTypeObject Py_filterType = {
    159   PyObject_HEAD_INIT (NULL)
    160   0,                            /* ob_size           */
     168  PyVarObject_HEAD_INIT(NULL, 0)
    161169  "aubio.digital_filter",       /* tp_name           */
    162170  sizeof (Py_filter),           /* tp_basicsize      */
     
    196204  0,                            /* tp_alloc          */
    197205  Py_filter_new,                /* tp_new            */
     206  0,
     207  0,
     208  0,
     209  0,
     210  0,
     211  0,
     212  0,
     213  0,
     214  0,
    198215};
Note: See TracChangeset for help on using the changeset viewer.