From: Paul Brossier Date: Fri, 24 Jan 2014 01:22:28 +0000 (-0300) Subject: python/ext/py-{sink,source}.c: add close function X-Git-Tag: 0.4.1~73 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=7b56229d3b025e3c417d762607c8599034481a39;p=aubio.git python/ext/py-{sink,source}.c: add close function --- diff --git a/python/ext/py-sink.c b/python/ext/py-sink.c index 59a2cc18..5636f4a8 100644 --- a/python/ext/py-sink.c +++ b/python/ext/py-sink.c @@ -89,8 +89,17 @@ AUBIO_MEMBERS_START(sink) {"samplerate", T_INT, offsetof (Py_sink, samplerate), READONLY, ""}, AUBIO_MEMBERS_STOP(sink) +static PyObject * +Pyaubio_sink_close (Py_sink *self, PyObject *unused) +{ + del_aubio_sink (self->o); + self->o = NULL; + Py_RETURN_NONE; +} static PyMethodDef Py_sink_methods[] = { + {"close", (PyCFunction) Pyaubio_sink_close, + METH_NOARGS, ""}, {NULL} /* sentinel */ }; diff --git a/python/ext/py-source.c b/python/ext/py-source.c index 82cab06d..c45ada83 100644 --- a/python/ext/py-source.c +++ b/python/ext/py-source.c @@ -1,6 +1,3 @@ -// WARNING: this file is generated, DO NOT EDIT - -// WARNING: if you haven't read the first line yet, please do so #include "aubiowraphell.h" typedef struct @@ -126,11 +123,21 @@ Pyaubio_source_get_channels (Py_source *self, PyObject *unused) return (PyObject *)PyInt_FromLong (tmp); } +static PyObject * +Pyaubio_source_close (Py_source *self, PyObject *unused) +{ + del_aubio_source (self->o); + self->o = NULL; + Py_RETURN_NONE; +} + static PyMethodDef Py_source_methods[] = { {"get_samplerate", (PyCFunction) Pyaubio_source_get_samplerate, METH_NOARGS, ""}, {"get_channels", (PyCFunction) Pyaubio_source_get_channels, METH_NOARGS, ""}, + {"close", (PyCFunction) Pyaubio_source_close, + METH_NOARGS, ""}, {NULL} /* sentinel */ };