diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-11-19 23:14:18 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-11-19 23:14:18 +0000 |
commit | 21859fabaa92215068d7176e504ac0d59d4301a5 (patch) | |
tree | a5b931be928608a0f1bebec4de951f2cc979ad23 /externals/grill/py/source | |
parent | f8829b0e8b2ef42dd371e2520161d244c6c7adb3 (diff) |
added Buffer.resize example
add Buffer.resize method
svn path=/trunk/; revision=3980
Diffstat (limited to 'externals/grill/py/source')
-rw-r--r-- | externals/grill/py/source/pybuffer.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/externals/grill/py/source/pybuffer.cpp b/externals/grill/py/source/pybuffer.cpp index 13d428c4..afc35e45 100644 --- a/externals/grill/py/source/pybuffer.cpp +++ b/externals/grill/py/source/pybuffer.cpp @@ -156,8 +156,29 @@ static PyObject *buffer_dirty(PyObject *obj) return Py_None;
}
+static PyObject *buffer_resize(PyObject *obj,PyObject *args,PyObject *kwds)
+{
+ flext::buffer *b = ((pySamplebuffer *)obj)->buf;
+ if(b) {
+ int frames,keep = 1,zero = 1;
+ static char *kwlist[] = {"frames", "keep", "zero", NULL};
+ if(!PyArg_ParseTupleAndKeywords(args, kwds, "i|ii", kwlist, &frames, &keep, &zero))
+ return NULL;
+
+ b->Frames(frames,keep != 0,zero != 0);
+
+ Py_INCREF(obj);
+ return obj;
+ }
+ else {
+ PyErr_SetString(PyExc_RuntimeError,"Invalid buffer");
+ return NULL;
+ }
+}
+
static PyMethodDef buffer_methods[] = {
{"dirty", (PyCFunction)buffer_dirty,METH_NOARGS,"Mark buffer as dirty"},
+ {"resize", (PyCFunction)buffer_resize,METH_VARARGS|METH_KEYWORDS,"Resize buffer"},
{NULL} /* Sentinel */
};
|