shithub: aubio

Download patch

ref: eb93592edfd07e0b698ad1508066f94152fe8df9
parent: c03e7777e63a0202d21f99fa08039ac65f8c581f
author: Paul Brossier <piem@piem.org>
date: Thu Nov 5 19:41:39 EST 2009

py-cvec.c: cvec.length to return the actual length

--- a/interfaces/python/py-cvec.c
+++ b/interfaces/python/py-cvec.c
@@ -28,7 +28,7 @@
 
   self = (Py_cvec *) type->tp_alloc (type, 0);
 
-  self->length = Py_default_vector_length;
+  self->length = Py_default_vector_length / 2 + 1;
   self->channels = Py_default_vector_channels;
 
   if (self == NULL) {
@@ -36,7 +36,7 @@
   }
 
   if (length > 0) {
-    self->length = length;
+    self->length = length / 2 + 1;
   } else if (length < 0) {
     PyErr_SetString (PyExc_ValueError,
         "can not use negative number of elements");
@@ -57,7 +57,7 @@
 static int
 Py_cvec_init (Py_cvec * self, PyObject * args, PyObject * kwds)
 {
-  self->o = new_cvec (self->length, self->channels);
+  self->o = new_cvec ((self->length - 1) * 2, self->channels);
   if (self->o == NULL) {
     return -1;
   }