From 3922cb5abcd451238047713829456e50f94dade2 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Fri, 6 Jul 2007 21:44:56 +0000 Subject: adapting to new flext lockfree structures much better detach method handling (one thread for all object instances) use PyGILState_\*() functionality (enabled with PY_USE_GIL) ooops, fixing typo fixing numpy initialization quirks pyext._init is now called after __init__ enabled use of inofficial PD functionality for search and help path access (#define PY_USE_INOFFICIAL) added sketch for new pye (Python expression) object buffer protocol adapted for Python 2.5 svn path=/trunk/; revision=7903 --- externals/grill/py/source/pybuffer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'externals/grill/py/source/pybuffer.cpp') diff --git a/externals/grill/py/source/pybuffer.cpp b/externals/grill/py/source/pybuffer.cpp index 5452c254..4f7155ea 100644 --- a/externals/grill/py/source/pybuffer.cpp +++ b/externals/grill/py/source/pybuffer.cpp @@ -186,28 +186,45 @@ static PyMethodDef buffer_methods[] = { // support the buffer protocol + +#if PY_VERSION_HEX >= 0x02050000 +static Py_ssize_t buffer_readbuffer(PyObject *obj, Py_ssize_t segment, void **ptrptr) +#else static int buffer_readbuffer(PyObject *obj, int segment, void **ptrptr) +#endif { flext::buffer *b = ((pySamplebuffer *)obj)->buf; ptrptr[0] = b->Data(); return b->Channels()*b->Frames()*sizeof(t_sample); } +#if PY_VERSION_HEX >= 0x02050000 +static Py_ssize_t buffer_writebuffer(PyObject *obj, Py_ssize_t segment, void **ptrptr) +#else static int buffer_writebuffer(PyObject *obj, int segment, void **ptrptr) +#endif { flext::buffer *b = ((pySamplebuffer *)obj)->buf; ptrptr[0] = b->Data(); return b->Channels()*b->Frames()*sizeof(t_sample); } +#if PY_VERSION_HEX >= 0x02050000 +static Py_ssize_t buffer_segcount(PyObject *obj, Py_ssize_t *lenp) +#else static int buffer_segcount(PyObject *obj, int *lenp) +#endif { flext::buffer *b = ((pySamplebuffer *)obj)->buf; if(lenp) lenp[0] = b->Channels()*b->Frames()*sizeof(t_sample); return 1; } +#if PY_VERSION_HEX >= 0x02050000 +static Py_ssize_t buffer_charbuffer(PyObject *obj, Py_ssize_t segment, char **ptrptr) +#else static int buffer_charbuffer(PyObject *obj, int segment, const char **ptrptr) +#endif { flext::buffer *b = ((pySamplebuffer *)obj)->buf; ptrptr[0] = (char *)b->Data(); -- cgit v1.2.1