Пример #1
0
def sendObjectValue(objectName, typeName, typeValue, value, port, ipToSend):
    message = "/SpatDIF/%s/%s/%s" % (typeName, objectName, typeValue)
    print "sending ", value, " to path %s to port %i" % (message, port)
    if ipToSend:
        Message(message, value).sendto(ipToSend, port)
    else:
        Message(message, value).sendlocal(port)
Пример #2
0
def deprecatedOscExample() : # by Xavier Oliver
	if not (len(sys.argv)==1 or len(sys.argv)==2) :
		print "usage: sendControlsOSC [host]\n"	
		sys.exit(1)

	if len(sys.argv)==2 :
		host = sys.argv[1]
		print "using host:", host
	else:
		host = ""
		print "using local host"

	procname="-"
	print ">Processing name?"
	procname=sys.stdin.readline()

	print ">Control name?"
	ctrlname=sys.stdin.readline()

	while True:
		print ">Control value?"
		value=float(sys.stdin.readline())

		dest = "/"+procname[:-1]+"/"+ctrlname[:-1]
		if host :
			Message(dest, [value]).sendto(host, 7000)
		else :
			Message(dest, [value]).sendlocal(7000)
Пример #3
0
def main():
    typename = None
    if (configured == 0):
        return
    if Blender.event == 'FrameChanged':
        frame = Blender.Get('curframe')
        Message("/SpatDIF/sync/FrameChanged", [frame]).sendlocal(7000)
        return

    if Blender.bylink == True and Blender.event == 'ObjectUpdate':
        object = Blender.link
        location = object.mat.translationPart()
        roll, descention, yaw = object.mat.toEuler()
        pitch = -descention
        rotation = (yaw, pitch, roll)
        ports = [7000]
        # try to get the ports on object name:
        if re.search('_p([0-9_]+)$', object.name) != None:
            ports = []
            portsInName = re.search("_p([0-9_]+)$",
                                    object.name).group(1).split("_")
            for portString in portsInName:
                ports.append(int(portString))

        objectId = object.name.replace(".", "_")
        if isSource(object):
            typename = 'source'
            sources = getSources()
            if not SendObjectsNames:
                objectId = sources.index(object)
            for port in ports:
                sendObjectValue(objectId, typename, "xyz", location, port)
                sendObjectValue(objectId, typename, "ypr", rotation, port)
#			print "UPDATE L Source "+str(objectNumber)+" Port"+str(port)+" "+str(location)
            return
        if isListener(object):
            listeners = getListeners()
            typename = 'listener'
            if not SendObjectsNames:
                objectId = listeners.index(object)
            for port in ports:
                sendObjectValue(objectId, typename, "xyz", location, port)
                sendObjectValue(objectId, typename, "ypr", rotation, port)
#			print "UPDATE L Listener "+str(objectNumber)+" Port"+str(port)+" "+str(location)
            return
        if not typename:
            return
Пример #4
0
def sendPlay(objectName,voice,value=1,loop=0,port=7000):
	message="/SpatDIF/source/%s/sampler/%s/setLoop" % (objectName,voice)
	Message(message,[int(loop)]).sendlocal(port)
	message="/SpatDIF/source/%s/sampler/%s/play" % (objectName,voice)
	Message(message,[int(value)]).sendlocal(port)
Пример #5
0
def sendObjectValue(objectId, typeName, typeValue, value, port):
    message = "/SpatDIF/%s/%i/%s" % (typeName, objectId, typeValue)
    Message(message, value).sendlocal(port)
Пример #6
0
def send(path, datalist) :
	floatlist = [float(element) for element in datalist]
	if host :
		Message(path, floatlist).sendto(host, 7000)
	else :
		Message(path, floatlist).sendlocal(7000)