shithub: aubio

Download patch

ref: 0f045b2d57fd5f6d20f71c90694284499fba165c
parent: 96fe713cccdf01faf343d5ac629381d9348fca68
author: Paul Brossier <piem@piem.org>
date: Fri Dec 4 20:45:08 EST 2009

interfaces/python: towards mono (setup.py and py-phasevoc.c)

--- a/interfaces/python/py-phasevoc.c
+++ b/interfaces/python/py-phasevoc.c
@@ -2,18 +2,18 @@
 
 static char Py_pvoc_doc[] = "pvoc object";
 
-AUBIO_DECLARE(pvoc, uint_t win_s; uint_t hop_s; uint_t channels)
+AUBIO_DECLARE(pvoc, uint_t win_s; uint_t hop_s)
 
 //AUBIO_NEW(pvoc)
 static PyObject *
 Py_pvoc_new (PyTypeObject * type, PyObject * args, PyObject * kwds)
 {
-  int win_s = 0, hop_s = 0, channels = 0;
+  int win_s = 0, hop_s = 0;
   Py_pvoc *self;
-  static char *kwlist[] = { "win_s", "hop_s", "channels", NULL };
+  static char *kwlist[] = { "win_s", "hop_s", NULL };
 
-  if (!PyArg_ParseTupleAndKeywords (args, kwds, "|III", kwlist,
-          &win_s, &hop_s, &channels)) {
+  if (!PyArg_ParseTupleAndKeywords (args, kwds, "|II", kwlist,
+          &win_s, &hop_s)) {
     return NULL;
   }
 
@@ -25,7 +25,6 @@
 
   self->win_s = Py_default_vector_length;
   self->hop_s = Py_default_vector_length/2;
-  self->channels = Py_default_vector_channels;
 
   if (self == NULL) {
     return NULL;
@@ -47,19 +46,11 @@
     return NULL;
   }
 
-  if (channels > 0) {
-    self->channels = channels;
-  } else if (channels < 0) {
-    PyErr_SetString (PyExc_ValueError,
-        "can not use negative number of filters");
-    return NULL;
-  }
-
   return (PyObject *) self;
 }
 
 
-AUBIO_INIT(pvoc, self->win_s, self->hop_s, self->channels)
+AUBIO_INIT(pvoc, self->win_s, self->hop_s)
 
 AUBIO_DEL(pvoc)
 
@@ -81,9 +72,8 @@
   }
 
   output = (Py_cvec*) PyObject_New (Py_cvec, &Py_cvecType);
-  output->channels = vec->channels;
   output->length = ((Py_pvoc *) self)->win_s;
-  output->o = new_cvec(((Py_pvoc *) self)->win_s, vec->channels);
+  output->o = new_cvec(((Py_pvoc *) self)->win_s);
 
   // compute the function
   aubio_pvoc_do (((Py_pvoc *)self)->o, vec->o, output->o);
@@ -97,8 +87,6 @@
     "size of the window"},
   {"hop_s", T_INT, offsetof (Py_pvoc, hop_s), READONLY,
     "size of the hop"},
-  {"channels", T_INT, offsetof (Py_pvoc, channels), READONLY,
-    "number of channels"},
 AUBIO_MEMBERS_STOP(pvoc)
 
 static PyObject * 
@@ -119,9 +107,8 @@
   }
 
   output = (Py_fvec*) PyObject_New (Py_fvec, &Py_fvecType);
-  output->channels = vec->channels;
   output->length = ((Py_pvoc *) self)->hop_s;
-  output->o = new_fvec(output->length, output->channels);
+  output->o = new_fvec(output->length);
 
   // compute the function
   aubio_pvoc_rdo (((Py_pvoc *)self)->o, vec->o, output->o);
--- a/interfaces/python/setup.py
+++ b/interfaces/python/setup.py
@@ -10,6 +10,7 @@
         Extension("_aubio",
             ["aubiomodule.c",
             "py-fvec.c",
+            "py-fmat.c",
             "py-cvec.c",
             "py-filter.c",
             # macroised