shithub: aubio

Download patch

ref: a52d3ae4c6d2ae1872739d5dbb12b2488bbe9c67
parent: c04d250d409e9c178a9f56bdeae3536189266976
author: Paul Brossier <piem@piem.org>
date: Thu Dec 24 23:45:18 EST 2009

py-filter.c: use new proxy function, switch to mono

--- a/interfaces/python/py-filter.c
+++ b/interfaces/python/py-filter.c
@@ -16,7 +16,7 @@
   Py_filter *self;
   static char *kwlist[] = { "order", NULL };
 
-  if (!PyArg_ParseTupleAndKeywords (args, kwds, "|II", kwlist,
+  if (!PyArg_ParseTupleAndKeywords (args, kwds, "|I", kwlist,
           &order)) {
     return NULL;
   }
@@ -59,10 +59,10 @@
 }
 
 static PyObject * 
-Py_filter_do(PyObject * self, PyObject * args)
+Py_filter_do(Py_filter * self, PyObject * args)
 {
   PyObject *input;
-  Py_fvec *vec;
+  fvec_t *vec;
 
   if (!PyArg_ParseTuple (args, "O:digital_filter.do", &input)) {
     return NULL;
@@ -72,7 +72,7 @@
     return NULL;
   }
 
-  vec = PyAubio_ArrayToFvec (input);
+  vec = PyAubio_ArrayToCFvec (input);
 
   if (vec == NULL) {
     return NULL;
@@ -79,16 +79,9 @@
   }
 
   // compute the function
-#if 1
-  aubio_filter_do (((Py_filter *)self)->o, vec->o);
-  PyArray_INCREF((PyArrayObject*)vec);
-  return (PyObject *)vec;
-#else
-  Py_fvec *copy = (Py_fvec*) PyObject_New (Py_fvec, &Py_fvecType);
-  copy->o = new_fvec(vec->o->length);
-  aubio_filter_do_outplace (((Py_filter *)self)->o, vec->o, copy->o);
-  return (PyObject *)copy;
-#endif
+  fvec_t * out = new_fvec(vec->length);
+  aubio_filter_do_outplace (self->o, vec, out);
+  return PyAubio_CFvecToArray(out);
 }
 
 static PyObject *