Mercurial > hg > mood-conductor
changeset 39:874ac833c8e3 moodplay
new branch 'moodplay', audio client OSC
author | nothing@tehis.net |
---|---|
date | Thu, 07 May 2015 12:55:49 +0100 |
parents | b17a5b6f74a4 |
children | 7656f048bbdf |
files | visualclient2/gradients.pyc visualclient2/visclient.py |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/visualclient2/visclient.py Sun May 03 18:45:24 2015 +0100 +++ b/visualclient2/visclient.py Thu May 07 12:55:49 2015 +0100 @@ -21,6 +21,8 @@ import colorsys as cs +import OSC + scol = (0,255,0,255) ecol = (0,0,0,255) @@ -44,6 +46,7 @@ # detect display resolution import subprocess screenres = subprocess.Popen('xrandr | grep "\*" | cut -d" " -f4',shell=True, stdout=subprocess.PIPE).communicate()[0] +print screenres screenres = map(lambda x: int(x.strip()), screenres.split('x')) XF,YF = screenres print "Screen resolution: ",XF,YF @@ -69,6 +72,9 @@ # IP = "127.0.0.1:8030" # IP = "192.168.2.158:8030" IP = "138.37.95.215" # this is the IP of kakapo<=>golden +SCIP = "127.0.0.1" +SCPORT = 57120 +OSCADDR = "/mood-conductor-sc" HTTP_TIMEOUT = 3 SERVER_UPDATE_INTERVAL = 0.8 @@ -534,14 +540,16 @@ self.fullscreen = False self.init_reconnect = False self.suspend = False + + self.osc_client = OSC.OSCClient() pass def read_mood_data(self): '''Read the mood position and color information form csv file.''' - # file = 'moods.csv' - file = '../tags/mc_moodtags_lfm_curated2.csv' + file = 'moods.csv' + #file = '../tags/mc_moodtags_lfm_curated2.csv' with open(file) as mf: data = mf.readlines()[1:] for line in data : @@ -759,10 +767,13 @@ self.movingBlob.draw() new = BlobTrail(self.bg,self.movingBlob.x,self.movingBlob.y,mood=self.movingBlob.mood,fade=18) self.bt.insert(0,new) + # axis pg.draw.line(self.bg, (G,G,G), (int(X/2.0),0),(int(X/2.0),Y), 1) pg.draw.line(self.bg, (G,G,G), (0,int(Y/2.0)),(X,int(Y/2.0)), 1) + self.sendCoordinates(xavg, yavg) + # indicators for i in self.indicators.itervalues() : i.draw() @@ -1040,6 +1051,11 @@ self.start_update_thread() self.indicators["config"].off().now(self.screen) + def sendCoordinates(self, xcoord, ycoord): + oscmsg = OSC.OSCMessage() + oscmsg.setAddress(OSCADDR) + oscmsg.append((xcoord, ycoord)) + self.osc_client.sendto(oscmsg, (SCIP, SCPORT)) def quit(self): print "Quitting.."