Update of /cvsroot/pure-data/externals/grill/py/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24770/source
Modified Files:
pybuffer.cpp
Log Message:
added Buffer.resize example
add Buffer.resize method
Index: pybuffer.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/source/pybuffer.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** pybuffer.cpp 8 Jul 2005 14:30:31 -0000 1.8
--- pybuffer.cpp 19 Nov 2005 23:14:18 -0000 1.9
***************
*** 157,162 ****
--- 157,183 ----
}
+ 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 */
};