diff options
author | Kjetil S. Matheussen <ksvalast@users.sourceforge.net> | 2004-01-21 08:58:03 +0000 |
---|---|---|
committer | Kjetil S. Matheussen <ksvalast@users.sourceforge.net> | 2004-01-21 08:58:03 +0000 |
commit | 1e66ed693be9b6989185f72689ab0db4d14f96cb (patch) | |
tree | 2b161f43c0da337050d33d6f6acb3894bd3fcff0 /supercollider | |
parent | c505ea212542507cf65c98fc4cb5b3040ff7a5ea (diff) |
Convert all floats to ints before sending to the synth
svn path=/trunk/; revision=1277
Diffstat (limited to 'supercollider')
-rw-r--r-- | supercollider/python/supercollider.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/supercollider/python/supercollider.py b/supercollider/python/supercollider.py index 9a4ff3f0..c5d0f42b 100644 --- a/supercollider/python/supercollider.py +++ b/supercollider/python/supercollider.py @@ -24,7 +24,7 @@ # -Kjetil. -import OSC,tempfile,xreadlines,os,time +import OSC,tempfile,xreadlines,os,time,types standardport=57110 startnode=1001; @@ -45,12 +45,17 @@ class Server: def __init__(self,magic,port=standardport): if magic!=1234: print "Server.__init__: Are you sure you know what you are doing?" - print "Seems like probably wanted to use the 'localServer' variable." + print "Seems like you probably wanted to use the 'localServer' variable." self.port=port self.freenode=startnode; self.freebuffer=startbuffer; def sendMsg(self,command,*args): - OSC.Message(command,args).sendlocal(self.port) + def floatToInt(x): + if type(x)==types.FloatType: + return int(x) + else: + return x + OSC.Message(command,map(floatToInt,args)).sendlocal(self.port) def sendgetMsg(self,command,*args): apply(self.sendMsg,[command]+list(args)) time.sleep(1) |