ref: 7b56229d3b025e3c417d762607c8599034481a39
parent: f1100a49500036d9d901ce7869ce92f5c806dde3
author: Paul Brossier <[email protected]>
date: Thu Jan 23 17:22:28 EST 2014
python/ext/py-{sink,source}.c: add close function
--- a/python/ext/py-sink.c
+++ b/python/ext/py-sink.c
@@ -89,8 +89,17 @@
{"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 */
};
--- 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,10 +123,20 @@
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 */
};