From 53c16e06983f9b03464f41b8c0ed3206382c5538 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Sun, 9 Jan 2005 04:59:30 +0000 Subject: support for Python threads, at last small fixes merged in 20041229-newdetach branch. renamed locking functions svn path=/trunk/; revision=2483 --- externals/grill/py/source/modmeth.cpp | 44 ++++++----------------------------- 1 file changed, 7 insertions(+), 37 deletions(-) (limited to 'externals/grill/py/source/modmeth.cpp') diff --git a/externals/grill/py/source/modmeth.cpp b/externals/grill/py/source/modmeth.cpp index 5a3efd10..88e3290a 100644 --- a/externals/grill/py/source/modmeth.cpp +++ b/externals/grill/py/source/modmeth.cpp @@ -2,7 +2,7 @@ py/pyext - python external object for PD and Max/MSP -Copyright (c) 2002-2004 Thomas Grill (gr@grrrr.org) +Copyright (c)2002-2005 Thomas Grill (gr@grrrr.org) For information on usage and redistribution, and for a DISCLAIMER OF ALL WARRANTIES, see the file, "license.txt," in this distribution. @@ -21,8 +21,6 @@ PyMethodDef py::func_tbl[] = { "_samplerate", py::py_samplerate, METH_NOARGS,"Get system sample rate" }, { "_blocksize", py::py_blocksize, METH_NOARGS,"Get system block size" }, - { "_inchannels", py::py_inchannels, METH_NOARGS,"Get number of audio in channels" }, - { "_outchannels", py::py_outchannels, METH_NOARGS,"Get number of audio out channels" }, #if FLEXT_SYS == FLEXT_SYS_PD { "_getvalue", py::py_getvalue, METH_VARARGS,"Get value of a 'value' object" }, @@ -32,8 +30,8 @@ PyMethodDef py::func_tbl[] = {NULL, NULL, 0, NULL} // sentinel }; -const C *py::py_doc = - "py/pyext - python external object for PD and Max/MSP, (C)2002-2004 Thomas Grill\n" +const char *py::py_doc = + "py/pyext - python external object for PD and Max/MSP, (C)2002-2005 Thomas Grill\n" "\n" "This is the pyext module. Available function:\n" "_send(args...): Send a message to a send symbol\n" @@ -42,15 +40,13 @@ const C *py::py_doc = #endif "_samplerate(): Get system sample rate\n" "_blocksize(): Get current blocksize\n" - "_inchannels(): Get number of audio in channels\n" - "_outchannels(): Get number of audio out channels\n" "_getvalue(name): Get value of a 'value' object\n" "_setvalue(name,float): Set value of a 'value' object\n" ; -V py::tick(V *) +void py::tick(void *) { Lock(); @@ -73,15 +69,15 @@ V py::tick(V *) Unlock(); } -V py::m_stop(int argc,const t_atom *argv) +void py::m_stop(int argc,const t_atom *argv) { if(thrcount) { Lock(); - I wait = PY_STOP_WAIT; + int wait = PY_STOP_WAIT; if(argc >= 1 && CanbeInt(argv[0])) wait = GetAInt(argv[0]); - I ticks = wait/PY_STOP_TICK; + int ticks = wait/PY_STOP_TICK; if(stoptick) { // already stopping if(ticks < stoptick) stoptick = ticks; @@ -106,32 +102,6 @@ PyObject *py::py_blocksize(PyObject *self,PyObject *args) return PyLong_FromLong(sys_getblksize()); } -PyObject *py::py_inchannels(PyObject *self,PyObject *args) -{ -#if FLEXT_SYS == FLEXT_SYS_PD - I ch = sys_get_inchannels(); -#elif FLEXT_SYS == FLEXT_SYS_MAX - I ch = sys_getch(); // not working -#else -#pragma message("Not implemented!") - ch = 0; -#endif - return PyLong_FromLong(ch); -} - -PyObject *py::py_outchannels(PyObject *self,PyObject *args) -{ -#if FLEXT_SYS == FLEXT_SYS_PD - I ch = sys_get_outchannels(); -#elif FLEXT_SYS == FLEXT_SYS_MAX - I ch = sys_getch(); // not working -#else -#pragma message("Not implemented!") - ch = 0; -#endif - return PyLong_FromLong(ch); -} - PyObject *py::py_send(PyObject *,PyObject *args) { // should always be a tuple -- cgit v1.2.1