コード例 #1
0
def all_handler(addr, tags, stuff, source):
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    f_out.write(OSC.getUrlStr(source)+'; ')
    print "with addr : %s" % addr
    f_out.write(addr+'; ')
    print "typetags %s" % tags
    print "data %s" % stuff
    f_out.write(addr+'; ')
    f_out.write(str(stuff[0])+'; ')
    f_out.write(str(time.time())+'; ')
    f_out.write('humanreadable: '+datetime.fromtimestamp(int(time.time())).strftime('%Y-%m-%d %H:%M:%S'))
    f_out.write('\n')
コード例 #2
0
def all_handler(addr, tags, stuff, source):
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    f_out.write(OSC.getUrlStr(source)+'; ')
    print "with addr : %s" % addr
    f_out.write(addr+'; ')
    print "typetags %s" % tags
    print "data %s" % stuff
    for smth in stuff:
        print smth
        f_out.write(str(smth))
        f_out.write('; ')
    f_out.write(str(time.time())+'; ')
    f_out.write('\n')
コード例 #3
0
def all_handler(addr, tags, stuff, source):
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    f_out.write(OSC.getUrlStr(source) + '; ')
    print "with addr : %s" % addr
    f_out.write(addr + '; ')
    print "typetags %s" % tags
    print "data %s" % stuff
    for smth in stuff:
        print smth
        f_out.write(str(smth))
        f_out.write('; ')
    f_out.write(str(time.time()) + '; ')
    f_out.write('\n')
コード例 #4
0
ファイル: soundUI.py プロジェクト: Vadiza/sage-3.5b
 def osc_printing_handler(self, addr, tags, stuff, source):
     msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
     sys.stdout.write("OSCServer Got: '%s' from %s\n" % (msg_string, OSC.getUrlStr(source)))
     # send a reply to the client.
     msg = OSC.OSCMessage("/printed")
     msg.append(msg_string)
     return msg
コード例 #5
0
def trata(addr, tags, dados, origem):
    m = "%s [%s] %s" % (addr, tags, str(dados))
    #t="%s enviou: %s\n" % (osc.getUrlStr(origem), m)
    t=str((osc.getUrlStr(origem), m))
    print t
    with open("log-golly.txt", "a") as f:
        f.write(t)
コード例 #6
0
ファイル: syncjams.py プロジェクト: baymax84/SyncJams
 def _drop(self, message, addr, tags, packet, source, route=None):
     logging.debug("DROPPED (%s) from %s" % (message, OSC.getUrlStr(source)))
     logging.debug("\taddr: %s" % addr)
     logging.debug("\ttypetags: %s" % tags)
     logging.debug("\tdata: %s" % packet)
     if route:
         logging.debug("\troute: %s" % route)
コード例 #7
0
def transport_handler(addr, tags, args, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "args %s" % args
    print "---"
コード例 #8
0
ファイル: luxosc.py プロジェクト: mattbrailsford/LuxOSC
def printer(addr, tags, stuff, source):
   	print "---"
    	print "received new osc msg from %s" % OSC.getUrlStr(source)
    	print "with addr : %s" % addr
    	print "typetags %s" % tags
    	print "data %s" % stuff
    	print "---"
コード例 #9
0
def trata(addr, tags, dados, origem):
    m = "%s [%s] %s" % (addr, tags, str(dados))
    #t="%s enviou: %s\n" % (osc.getUrlStr(origem), m)
    t = str((osc.getUrlStr(origem), m))
    print t
    with open("log-golly.txt", "a") as f:
        f.write(t)
コード例 #10
0
ファイル: server.py プロジェクト: compcore/LaserVoting
def countsHandler(addr,tags,stuff,source):
    print '---'
    print 'new msg from %s' % OSC.getUrlStr(source)
    print 'with addr: %s' % addr
    print 'typetags %s' % tags
    print 'data %s' %stuff
    print '---'
コード例 #11
0
ファイル: main.py プロジェクト: mizumasa/RealSenseFaceDetect
 def printMsg(self, addr, tags, stuff, source):
     self.flag = True
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
コード例 #12
0
ファイル: inputosc.py プロジェクト: xuelanglv/eegsynth
def forward_handler(addr, tags, data, source):
    global prefix
    global scake
    global offset

    if debug > 1:
        print("---")
        print("source %s" % OSC.getUrlStr(source))
        print("addr   %s" % addr)
        print("tags   %s" % tags)
        print("data   %s" % data)

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    if tags == 'f' or tags == 'i':
        # it is a single scalar value
        key = prefix + addr.replace('/', '.')
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        patch.setvalue(key, val)

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            # append the index to the key, this starts with 1
            key = prefix + addr.replace('/', '.') + '.%i' % (i + 1)
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            patch.setvalue(key, val)
コード例 #13
0
ファイル: inputosc.py プロジェクト: stephenwhitmarsh/eegsynth
def python2_message_handler(addr, tags, data, source):
    global monitor, patch, prefix, output_scale, output_offset

    monitor.debug("addr = %s, tags = %s, data = %s, source %s" %
                  (addr, tags, data, OSC.getUrlStr(source)))

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    if tags == 'f' or tags == 'i':
        # it is a single scalar value
        key = prefix + addr.replace('/', '.')
        val = EEGsynth.rescale(data[0],
                               slope=output_scale,
                               offset=output_offset)
        patch.setvalue(key, val)

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            # append the index to the key, this starts with 1
            key = prefix + addr.replace('/', '.') + '.%i' % (i + 1)
            val = EEGsynth.rescale(data[i],
                                   slope=output_scale,
                                   offset=output_offset)
            patch.setvalue(key, val)
            monitor.update(key, val)
コード例 #14
0
def handle_root(addr, tags, data, source):
	print "---"
	print "received new osc msg from %s" % OSC.getUrlStr(source)
	print "with addr : %s" % addr
	print "typetags %s" % tags
	print "data %s" % data
	print "---"
コード例 #15
0
ファイル: receive_OSC.py プロジェクト: alx-s/ABCDerres
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received from :  %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags : %s" % tags
    print "data : %s" % stuff
    print "---"
コード例 #16
0
ファイル: inputosc.py プロジェクト: techphy/eegsynth
def forward_handler(addr, tags, data, source):
    global prefix
    global scake
    global offset

    if debug > 1:
        print "---"
        print "source %s" % OSC.getUrlStr(source)
        print "addr   %s" % addr
        print "tags   %s" % tags
        print "data   %s" % data

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    key = prefix + addr.replace('/', '.')

    if tags == 'f' or tags == 'i':
            # it is a single value
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        r.set(key, val)             # send it as control value
        if addr in button_list:
            r.publish(key, val)      # send it as trigger

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            # append the index to the key, this starts with 0
            r.set(key + '.%i' % i, val)
コード例 #17
0
ファイル: max.py プロジェクト: markkleeb/MusicalTurk
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    url="http://www.musicalturk.com/loops/add"
 

    shutil.move('/Users/Kleeb2/Documents/MaxPatches/MusicalTurk/'+ str(stuff[0]), "/Users/Kleeb2/Documents/Web/Python/Thesis/"+str(stuff[0])) 
    filename = str(stuff[0])
    #filename =  '/Users/Kleeb2/Documents/Web/Python/LocalThesis/max.py'
    title = 'test'#str(count).zfill(3)
    date = str(datetime.date.today()) 
    values = [('title', title), ('postedby',date)]
    try:
    	files = {'loop': open(filename, 'rb')}
    except:
    	print 'no file'
    try:
    	r = requests.post(url, files=files, data=values)
    	print r.text
    except:
    	print 'Fail'
コード例 #18
0
def forward_handler(addr, tags, data, source):
    if debug>1:
      print "---"
      print "source %s" % OSC.getUrlStr(source)
      print "addr   %s" % addr
      print "tags   %s" % tags
      print "data   %s" % data

    if addr[0]!='/':
      # ensure it starts with a slash
      addr = '/' + addr

    # the scale and offset are used to map OSC values to Redis values
    scale  = patch.getfloat('output', 'scale', default=1)
    offset = patch.getfloat('output', 'offset', default=0)

    # the results will be written to redis as "osc.1.faderA" etc.
    key = patch.getstring('output', 'prefix') + addr.replace('/', '.')

    if tags=='f' or tags=='i':
        # it is a single value
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        r.set(key, val)             # send it as control value
        if addr in button_list:
            r.publish(key,val)      # send it as trigger

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            # append the index to the key, this starts with 0
            r.set(key + '.%i' % i, val)
コード例 #19
0
def printer(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
コード例 #20
0
def handle_root(addr, tags, data, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    print "---"
コード例 #21
0
ファイル: pyosc1.py プロジェクト: RoelAdriaans/PyTouchOSC
def fader_handler(addr, tags, data, source):
    print "---"
    print "received FADER new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    split = addr.split("/")
    print "split", split
    # split[2] is nu faderx, we want the id
    fadernr = int(split[2][-1:])
    print "fadernr = ", fadernr
    # Add one and loop aftre we are at 5
    next_fader = (fadernr % 5) + 1
    return_addr = "/1/fader%s" % next_fader
    print "Return addres", return_addr
    msg = OSC.OSCMessage()
    msg.setAddress(return_addr)
    msg.append(data)
    c.send(msg)
    print "return message %s" % msg
    print "---"
    if 1 <= fadernr <= 4 and data[0] >= 0.5:
        msg = OSC.OSCMessage()
        toggle_addr = "/1/toggle%s" % fadernr
        msg.setAddress(toggle_addr)
        msg.append(1.0)
        c.send(msg)
        print "return message %s" % msg
    else:
        msg = OSC.OSCMessage()
        toggle_addr = "/1/toggle%s" % fadernr
        msg.setAddress(toggle_addr)
        msg.append(0.0)
        c.send(msg)
        print "return message %s" % msg
コード例 #22
0
ファイル: launch.py プロジェクト: jts3k/PiNotes
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received from :  %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags : %s" % tags
    print "data : %s" % stuff
    print "---"
コード例 #23
0
ファイル: inputosc.py プロジェクト: nicofarr/eegsynth
def forward_handler(addr, tags, data, source):
    global prefix
    global scake
    global offset

    if debug > 1:
        print("---")
        print("source %s" % OSC.getUrlStr(source))
        print("addr   %s" % addr)
        print("tags   %s" % tags)
        print("data   %s" % data)

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    if tags == 'f' or tags == 'i':
        # it is a single value
        key = prefix + addr.replace('/', '.')
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        patch.setvalue(key, val)

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            # append the index to the key, this starts with 0
            key = prefix + addr.replace('/', '.') + '.%i' % i
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            patch.setvalue(key, val)
コード例 #24
0
def forward_handler(addr, tags, data, source):
    print "---"
    print "source %s" % OSC.getUrlStr(source)
    print "addr   %s" % addr
    print "tags   %s" % tags
    print "data   %s" % data

    scale = EEGsynth.getfloat('processing', 'scale', config, r)
    if scale is None:
        scale = 1

    offset = EEGsynth.getfloat('processing', 'offset', config, r)
    if offset is None:
        offset = 0

    # apply the scale and offset
    for i in range(len(data)):
        data[i] = EEGsynth.rescale(data[i], scale, offset)

    # the results will be written to redis as "osc.1.faderA" etc.
    key = config.get('output', 'prefix') + addr.replace('/', '.')

    if tags == 'f' or tags == 'i':
        # it is a single value
        val = data[0]
        r.set(key, val)  # send it as control value
        if addr in button_list:
            r.publish(key, val)  # send it as trigger

    else:
        # it is a list, send it as a list of control values
        val = data
        r.set(key, val)
コード例 #25
0
 def no_match_handler(self,addr, tags, stuff, source):
     text=''
     text+= "no match for new osc msg from %s" % OSC.getUrlStr(source)+'\n'
     text+= "with addr : %s" % addr+'\n'
     text+= "typetags %s" % tags+'\n'
     text+= "data %s" % stuff+'\n'
     self.add_status(text+'\n')
コード例 #26
0
 def no_match_handler(self, addr, tags, stuff, source):
     text = ''
     text += "no match for new osc msg from %s" % OSC.getUrlStr(
         source) + '\n'
     text += "with addr : %s" % addr + '\n'
     text += "typetags %s" % tags + '\n'
     text += "data %s" % stuff + '\n'
     self.add_status(text + '\n')
コード例 #27
0
ファイル: syncjams.py プロジェクト: werneroi/SyncJams
 def _drop(self, message, addr, tags, packet, source, route=None):
     logging.debug("DROPPED (%s) from %s" %
                   (message, OSC.getUrlStr(source)))
     logging.debug("\taddr: %s" % addr)
     logging.debug("\ttypetags: %s" % tags)
     logging.debug("\tdata: %s" % packet)
     if route:
         logging.debug("\troute: %s" % route)
コード例 #28
0
ファイル: go2.py プロジェクト: knyar/pieva2
def printing_handler(addr, tags, stuff, source):
    msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
    print "OSCServer Got: '%s' from %s\n" % (msg_string, OSC.getUrlStr(source))
            
            # send a reply to the client.
    msg = OSC.OSCMessage("/printed")
    msg.append(msg_string)
    return msg
コード例 #29
0
ファイル: AudioLayer.py プロジェクト: SIGMusic/LeapMusic
def bgblue_handler(addr, tags, stuff, source):
    if layer.PRINT_BLUE:
        print "---"
        print "received new osc bgrgb msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
コード例 #30
0
ファイル: AudioLayer.py プロジェクト: SIGMusic/LeapMusic
def finger_handler(addr, tags, stuff, source):
    if layer.PRINT_FINGER:
        print "---"
        print "received new osc finger msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
        time.sleep(.5)
コード例 #31
0
ファイル: AudioLayer.py プロジェクト: SIGMusic/LeapMusic
def shape_handler(addr, tags, stuff, source):
    if layer.PRINT_SHAPE:
        print "---"
        print "received new osc shape msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "shape=" + stuff[0]
        print "---"
コード例 #32
0
def polydelay_handler(addr, tags, args, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "args %s" % args
    print "---"
    method = args.pop(0)
    getattr(poly, method)(args)    
コード例 #33
0
ファイル: AudioLayer.py プロジェクト: SIGMusic/LeapMusic
def boundary_handler(addr, tags, stuff, source):
    if layer.PRINT_BOUNDARY:
        print "---"
        print "received new osc boundary msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
        time.sleep(.5)
コード例 #34
0
def printing_handler(addr, tags, data, source):
""" A useful handler for dbugging. Prints the OSC message
"""
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    print "---"
コード例 #35
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
    #leds = stuff[0].encode('string-escape').split('\\x')
    #print leds
    sleep(2)
コード例 #36
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
    str1 = "".join(str(x) for x in stuff)
    global oscString
    oscString = str1
コード例 #37
0
def pair_handler(addr, tags, data, client_address):
    print "osc://%server%server ->" % (OSC.getUrlStr(client_address), addr),
    print "(tags, data): (%server, %server)" % (tags, data)
    unicode_str1 = data[0][2:]
    ut8_1 = eval("u'\u" + unicode_str1 + "'").encode("utf8")
    unicode_str2 = data[1][2:]
    ut8_2 = eval("u'\u" + unicode_str2 + "'").encode("utf8")
    c.morphLoopTile(ut8_1, ut8_2).save("./out/" + unicode_str1 + "_" +
                                       unicode_str2 + ".png")
    return
コード例 #38
0
ファイル: BigAluminiumHead.py プロジェクト: samatt/rwet
def printing_handler (addr, tags, stuff, source):
	print "---"
	print "received new osc msg from %s" % OSC.getUrlStr(source)
	print "with addr : %s" % addr
	print "typetags %s" % tags
	print "data %s" % stuff
	global test 
	test = stuff
	print len(test)
	print "---"	
コード例 #39
0
def polydelay_handler(addr, tags, data, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    # Call any function that's input stuff = ['function', 'data']
    function = stuff.pop(0)
    getattr(p, function)(stuff)
コード例 #40
0
def test_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    msg = OSC.OSCMessage()
    msg.setAddress(addr)
    msg.append(stuff)
    print "return message %s" % msg
    print "---"
コード例 #41
0
def test_handler(addr, tags, stuff, source):
	print "---"
	print "received new osc msg from %s" % OSC.getUrlStr(source)
	print "with addr : %s" % addr
	print "typetags %s" % tags
	print "data %s" % stuff
	msg = OSC.OSCMessage()
	msg.setAddress(addr)
	msg.append(stuff)
	print "return message %s" % msg
	print "---"
コード例 #42
0
ファイル: basic_receive.py プロジェクト: gourneau/Python-RTW
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
    d = {}
    addr = addr.replace('/1/','')
    d[addr] = stuff[0]
    conn.send(simplejson.dumps(d), destination='/topic/test')
コード例 #43
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received from :  %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags : %s" % tags
    print "data : %s" % stuff
    print "---"
    print "gpio is %s" % stuff[1]
    GPIO.output(4, stuff[0])
    GPIO.output(17, stuff[1])
    GPIO.output(27, stuff[2])
コード例 #44
0
def repeater_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    count = stuff[0]
    message = stuff[1]
    full_message = repeater(count, message)
    osc_client.send( OSC.OSCMessage("/repeater/message", full_message ) )
コード例 #45
0
def test_handler(addr, tags, stuff, source):
	print("---")
	print("received new osc msg from %s" % OSC.getUrlStr(source))
	print("with addr : %s" % addr)
	print("typetags %s" % tags)
	print("data %s" % stuff)
	msg = OSC.OSCMessage()
	msg.setAddress(addr)
	msg.append(stuff)
	c.send(msg)
	print("return message %s" % msg)
	print("---")
コード例 #46
0
ファイル: osc_server.py プロジェクト: ilzxc/m158a-2014
def repeater_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    count = stuff[0]
    message = stuff[1]
    full_message = repeater(count, message)
    osc_client.send(OSC.OSCMessage("/repeater/message", full_message))
コード例 #47
0
 def msg_data(self, addr, tags, stuff, source):
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
     try:
         if len(stuff) > 1:
             self.d[stuff[0]] = stuff[1]
     except:
         print("error")
     return
コード例 #48
0
ファイル: main.py プロジェクト: mizumasa/RealSenseFaceDetect
 def kill(self, addr, tags, stuff, source):
     self.flag = False
     try:
         self.pipeline.stop()
         print "[PY] stop pyrealsense"
     except:
         print "[PY] error stop pyrealsense"
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
コード例 #49
0
def alone_handler(addr, tags, data, client_address):
    print "gan osc://%server%server ->" % (OSC.getUrlStr(client_address),
                                           addr),
    print "(tags, data): (%server, %server)" % (tags, data)
    unicode_str1 = data[0][2:]
    print unicode_str1
    ut8_1 = eval("u'\u" + unicode_str1 + "'").encode("utf8")
    print ut8_1
    log.append(ut8_1)
    if len(log) > 1:
        img = c.morphLoopTile(log[-1], log[-2])
        img.save("./out/" + unicode_str1 + "_.png")
    return
コード例 #50
0
def launchpad_handler(addr, tags, args, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "args %s" % args
    print "---"
    method = args.pop(0)
    if method == 'refresh':
        launch.refresh(poly)
    elif method == 'press':
        launch.press(poly,args)
    else:
        getattr(launch, method)(*args)
コード例 #51
0
ファイル: swarm.py プロジェクト: nagyistge/EighthPlague
def attractor_handler(addr, tags, stuff, source):
    print "---"
    print "Received new osc msg from %s" % OSC.getUrlStr(source)
    print "With addr : %s" % addr
    print "Typetags %s" % tags
    global attractors
    attractor = random.choice(attractors) #modify a random attractor
    for item in stuff:
        print "data %f" % item
    # Assign dimension values
    for i in range(NDIMS):
        attractor.position.x[i] = int( min(max(stuff[i],0.0),1.0) * DIMLIMIT )
    print "Dim %d val: %d" % (i,attractor.position.x[i])
    print "---"
コード例 #52
0
def message_handler(addr, tags, stuff, source):
    # ECHO MESSAGE TO MACHINES
    msg = OSC.OSCMessage()
    msg.setAddress(addr)
    msg.append(stuff)
    for i in range(len(machinesIP)) : 
        oscClients[i].send(msg)
    # PRINT MESSAGE
    if printMessage :    
        print "---"
        print "received new osc msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
コード例 #53
0
ファイル: pyosc1.py プロジェクト: RoelAdriaans/PyTouchOSC
def random_multi(addr, tags, data, source):
    print "---"
    print "received random_multi osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    if randommulti is None and data[0] == 1:
        # Start random thread
        print "Start RandomMulti"
        rm = RandomMulti()
        global randommulti

        randommulti = threading.Thread(target=rm.run)
        randommulti.daemon = True
        randommulti.start()
コード例 #54
0
ファイル: oscRemote.py プロジェクト: hoshijirushi/Vega
	def ping_handler(self,addr, tags, stuff, source):
		
		# save address where ping came from
		pingSource = OSC.getUrlStr(source).split(':')[0]
		if settings.get('remoteControlAddress') != pingSource:
			settings.set('remoteControlAddress',pingSource)
		
		# read the port of the remote control programm from settings
		port = settings.get('remoteControlPort')
		
		# send pong message back
		client = OSC.OSCClient()
		msg = OSC.OSCMessage()
		msg.setAddress("/vega/pong")
		msg.append(1234)
		client.sendto(msg, (pingSource, port))
コード例 #55
0
ファイル: main.py プロジェクト: ygdrasilcave/RCS4MAP
def osc_parse(addr, tags, stuff, source):
    global new_osc_msg, msg_tg
    print('<----- OSC in: ')
    print("	received new OSC msg from %s" % OSC.getUrlStr(source))
    print("	with addr : %s" % addr)
    print("	typetags %s" % tags)
    print("	data %s" % stuff)
    print("	---")
    if addr in configure.osc_subscriber:
        print('address pattern: pass')
        if (tags == 's'):
            print('typetag: pass')
            #m = addr + ' ' + stuff[0].strip()
            #bot.sendMessage(masterId, m)
            new_osc_msg = True
            msg_tg = addr + ' ' + stuff[0].strip()
コード例 #56
0
ファイル: go.py プロジェクト: knyar/pieva2
    def pairing_handler(self, addr, tags, stuff, source):

        msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
        print "Got pairing message: '%s' from %s\n" % (msg_string, OSC.getUrlStr(source))
        self.paired = 1
        global updateMode

        print "Subscribing in", ("continuous" if updateMode else "event" ), "mode"
        #self.c2 = OSC.OSCClient()
        #self.c2.connect(send_address)
        subreq = OSC.OSCMessage("/MashMachine/Global/subscribeObjectsID")
        #  /MashMachine/Global/subscribeObjectsPosition
        subreq.append(listen_address[0])

        #subreq.append(updateMode)
        self.c2.send(subreq)
コード例 #57
0
ファイル: go.py プロジェクト: knyar/pieva2
    def pairing_handler(self, addr, tags, stuff, source):

        msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
        print "Got pairing message: '%s' from %s\n" % (msg_string,
                                                       OSC.getUrlStr(source))
        self.paired = 1
        global updateMode

        print "Subscribing in", ("continuous"
                                 if updateMode else "event"), "mode"
        #self.c2 = OSC.OSCClient()
        #self.c2.connect(send_address)
        subreq = OSC.OSCMessage("/MashMachine/Global/subscribeObjectsID")
        #  /MashMachine/Global/subscribeObjectsPosition
        subreq.append(listen_address[0])

        #subreq.append(updateMode)
        self.c2.send(subreq)
コード例 #58
0
ファイル: main.py プロジェクト: mizumasa/RealSenseFaceDetect
 def imageSaved(self, addr, tags, stuff, source):
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
     filename = stuff[0]
     qrname = uploadImgur(filename)
     if (qrname == "none"):
         msg2 = OSC.OSCMessage()
         msg2.setAddress("/image/uploaderror")
         msg2.append(qrname)
         self.c.send(msg2)
     msg = OSC.OSCMessage()
     msg.setAddress("/image/uploaded")
     msg.append(qrname)
     self.c.send(msg)
     return