Showing the changes to python/ext (1 of 1 file). Show all
Unified · Split
| @@ -11,7 +11,8 @@ typedef struct · 10 unmodified lines | |||
| 11 | cvec_t vec; | 11 | cvec_t vec; |
| 12 | fvec_t freqs; | 12 | fvec_t freqs; |
| 13 | fmat_t coeffs; | 13 | fmat_t coeffs; |
| 14 | fvec_t *out; | 14 | PyObject *out; |
| 15 | fvec_t c_out; | ||
| 15 | } Py_filterbank; | 16 | } Py_filterbank; |
| 16 | 17 | ||
| 17 | static PyObject * | 18 | static PyObject * |
| @@ -64,7 +65,7 @@ Py_filterbank_init (Py_filterbank * self, PyObject * args, PyObject * kwds) · 46 unmodified lines | |||
| 64 | PyErr_SetString (PyExc_RuntimeError, errstr); | 65 | PyErr_SetString (PyExc_RuntimeError, errstr); |
| 65 | return -1; | 66 | return -1; |
| 66 | } | 67 | } |
| 67 | self->out = new_fvec(self->n_filters); | 68 | self->out = new_py_fvec(self->n_filters); |
| 68 | 69 | ||
| 69 | return 0; | 70 | return 0; |
| 70 | } | 71 | } |
| @@ -73,7 +74,7 @@ static void · 2 unmodified lines | |||
| 73 | Py_filterbank_del (Py_filterbank *self, PyObject *unused) | 74 | Py_filterbank_del (Py_filterbank *self, PyObject *unused) |
| 74 | { | 75 | { |
| 75 | del_aubio_filterbank(self->o); | 76 | del_aubio_filterbank(self->o); |
| 76 | del_fvec(self->out); | 77 | Py_DECREF(self->out); |
| 77 | free(self->coeffs.data); | 78 | free(self->coeffs.data); |
| 78 | Py_TYPE(self)->tp_free((PyObject *) self); | 79 | Py_TYPE(self)->tp_free((PyObject *) self); |
| 79 | } | 80 | } |
| @@ -91,9 +92,13 @@ Py_filterbank_do(Py_filterbank * self, PyObject * args) · 11 unmodified lines | |||
| 91 | return NULL; | 92 | return NULL; |
| 92 | } | 93 | } |
| 93 | 94 | ||
| 95 | Py_INCREF(self->out); | ||
| 96 | if (!PyAubio_ArrayToCFvec(self->out, &(self->c_out))) { | ||
| 97 | return NULL; | ||
| 98 | } | ||
| 94 | // compute the function | 99 | // compute the function |
| 95 | aubio_filterbank_do (self->o, &(self->vec), self->out); | 100 | aubio_filterbank_do (self->o, &(self->vec), &(self->c_out)); |
| 96 | return (PyObject *)PyAubio_CFvecToArray(self->out); | 101 | return self->out; |
| 97 | } | 102 | } |
| 98 | 103 | ||
| 99 | static PyMemberDef Py_filterbank_members[] = { | 104 | static PyMemberDef Py_filterbank_members[] = { |