From 0ed7a8b68dd73e2b0473b8127aeca99f3bac9061 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 1 Apr 2009 21:13:09 +0000 Subject: cleaned up grill externals - replaced with svn:externals to svn.grrrr.org/ext/trunk/ svn path=/trunk/; revision=10951 --- externals/grill/py/scripts/buffer.py | 60 ------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 externals/grill/py/scripts/buffer.py (limited to 'externals/grill/py/scripts/buffer.py') diff --git a/externals/grill/py/scripts/buffer.py b/externals/grill/py/scripts/buffer.py deleted file mode 100644 index 46c47991..00000000 --- a/externals/grill/py/scripts/buffer.py +++ /dev/null @@ -1,60 +0,0 @@ -# py/pyext - python script objects for PD and MaxMSP -# -# 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. -# - -"""This is an example script for the py/pyext object's buffer support. - -PD/Max buffers can be mapped to Python arrays. -Currently, there are three implementations: -Numeric, numarray and Numeric3 (for all of them see http://numeric.scipy.org) -""" - -import sys - -try: - import pyext -except: - print "ERROR: This script must be loaded by the PD/Max py/pyext external" - -try: - from numarray import * -except: - print "Failed importing numarray module:",sys.exc_value - -def mul(*args): - # create buffer objects - # as long as these variables live the underlying buffers are locked - c = pyext.Buffer(args[0]) - a = pyext.Buffer(args[1]) - b = pyext.Buffer(args[2]) - - # slicing causes Python arrays (mapped to buffers) to be created - # note the c[:] - to assign contents you must assign to a slice of the buffer - c[:] = a[:]*b[:] - -def add(*args): - c = pyext.Buffer(args[0]) - a = pyext.Buffer(args[1]) - b = pyext.Buffer(args[2]) - - # this is also possible, but is probably slower - # the + converts a into a Python array, the argument b is taken as a sequence - # depending on the implementation this may be as fast - # as above or not - c[:] = a+b - -def fadein(target): - a = pyext.Buffer(target) - # in place operations are ok - a *= arange(len(a),type=Float32)/len(a) - -def neg(target): - a = pyext.Buffer(target) - # in place transformation (see Python array ufuncs) - negative(a[:],a[:]) - # must mark buffer content as dirty to update graph - # (no explicit assignment occurred) - a.dirty() -- cgit v1.2.1