[PD-cvs] externals/grill/py/scripts buffer.py,NONE,1.1 threads.py,1.5,1.6

Thomas Grill xovo at users.sourceforge.net
Wed Mar 9 05:58:13 CET 2005


Update of /cvsroot/pure-data/externals/grill/py/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19856/scripts

Modified Files:
	threads.py 
Added Files:
	buffer.py 
Log Message:
fixes for detached operation and single-threaded version
use lock count instead of message queuing to avoid py->py messaging deadlock
support for buffer objects (preliminary)
updated build system
little restructuring
fixes for single-threaded compilation
added support for numarray


--- NEW FILE: buffer.py ---
# py/pyext - python script objects for PD and MaxMSP
#
# Copyright (c) 2002-2005 Thomas Grill (gr at grrrr.org)
# For information on usage and redistribution, and for a DISCLAIMER OF ALL
# WARRANTIES, see the file, "license.txt," in this distribution.  
#

"""This is an example script for the py/pyext object's buffer support.

PD/Max buffers can be imported to and exported from numarray arrays.
For numarray see http://numeric.scipy.org
It will probably once be replaced by Numeric

- _import(buffer): copy contents from the buffer to a new numarray object
- _export(buffer,numarray): export contents of numarray object to the buffer
"""

import sys

try:
    import pyext
except:
    print "ERROR: This script must be loaded by the PD/Max pyext external"

try:    
    from numarray import *
except:
    print "Failed importing numarray module:",sys.exc_value

def mul(*args):
    c = pyext.Buffer(args[0])
    dst = c.array()
    dst[:] = 0
    a = pyext.Buffer(args[1]).array()
    b = pyext.Buffer(args[2]).array()
    dst += a*b
    c.dirty()   

def add(*args):
    c = pyext.Buffer(args[0])
    dst = c.array()
    dst[:] = 0
    a = pyext.Buffer(args[1]).array()
    b = pyext.Buffer(args[2]).array()
    dst += a+b
    c.dirty()   

Index: threads.py
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/py/scripts/threads.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** threads.py	10 Jan 2005 05:00:56 -0000	1.5
--- threads.py	9 Mar 2005 04:58:10 -0000	1.6
***************
*** 40,44 ****
  		for i in xrange(self.loops):
  			# if _shouldexit is true, the thread ought to stop
! 			if self._shouldexit: break
  
  			self._outlet(n,i)
--- 40,46 ----
  		for i in xrange(self.loops):
  			# if _shouldexit is true, the thread ought to stop
! 			if self._shouldexit: 
! 				print "BREAK"
! 				break
  
  			self._outlet(n,i)





More information about the Pd-cvs mailing list