本文整理汇总了Python中OSC.OSCClient方法的典型用法代码示例。如果您正苦于以下问题:Python OSC.OSCClient方法的具体用法?Python OSC.OSCClient怎么用?Python OSC.OSCClient使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSC
的用法示例。
在下文中一共展示了OSC.OSCClient方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: freeze_playfile
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def freeze_playfile(self, new_file, dry_value=1., loop_status=True):
"""
default synth (freeze)
"""
# OSC Client (i.e. send OSC to SuperCollider)
osc_client = OSC.OSCClient()
osc_client.connect( ( self.sc_IP, self.sc_Port ) )
#TODO: write to $DATE_performance.log
print("\n\n***\n\t (sending OSC) Playing %s/%s\n\n"%(os.environ["PWD"],new_file))
msg = OSC.OSCMessage()
msg.setAddress("/playfreeze") # (file,voice_number)
msg.append( "%s/%s"%(os.environ["PWD"],new_file) )
msg.append( self.enabled_voice-1) #convert to [0..7] range
try:
osc_client.send(msg)
except Exception,e:
print(e)
#TODO: get duration from msg (via API)
# time.sleep(duration)
#()
#class
示例2: activate
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def activate(self):
if len(self.args) > 0:
self.ip = self.args[0]
if len(self.args) > 1:
self.port = int(self.args[1])
if len(self.args) > 2:
self.address = self.args[2]
# init network
print "Selecting OSC streaming. IP: ", self.ip, ", port: ", self.port, ", address: ", self.address
self.client = OSCClient()
self.client.connect((self.ip, self.port))
# From IPlugin: close connections, send message to client
示例3: __init__
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def __init__(self):
super(FakeClient, self).__init__()
self.listen_address = (OSC_default_address, OSC_default_port)
self.c = OSC.OSCClient()
示例4: get_osc_client
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def get_osc_client(host='localhost', port=defaults['port'], say_hello=False):
# String, int -> OSCClient
client = OSCClient()
client.connect((host, port))
# TODO Make this work
if say_hello:
send_simple_message(client, "/hello", timeout=None)
return client
示例5: send_simple_message
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def send_simple_message(client, path, data=[], timeout=None):
# OSCClient, String, String, int -> None
msg = OSCMessage(path)
for d in data:
msg.append(d)
client.send(msg, timeout)
示例6: update_state_fallback
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def update_state_fallback(path, args, types, src):
global state
global osc_desc_state
# print("got unknown message '%s' from '%s'" % (path, src.url))
# for a, t in zip(args, types):
# print("argument of type '%s': %s" % (t, a))
msg = path[1:]
value = args[0]
print("Received %s %s"%(path,args))
if msg[-3:]=="/on":
# print("ON/OFF: %s", value)
desc = msg[:-3]
osc_desc_state[desc] = True if value==1 else False
print( "%s state %i"%(desc,osc_desc_state[desc]) )
return
if msg in osc_descriptors:
desc = msg
state[ desc ] = value
print( "MIR state updated! %s: %f"%(desc,value) )
print("Value %s"%value)
# OSC Client (i.e. send OSC to SuperCollider)
# osc_client = OSC.OSCClient()
# sc_Port = 57120
# sc_IP = '127.0.0.1' #Local SC server
#sc_IP = '10.142.39.109' #Remote server
# Virtual Box: Network device config not in bridge or NAT mode
# Select 'Network host-only adapter' (Name=vboxnet0)
# sc_IP = '192.168.56.1' # Remote server is the host of the VM
# osc_client.connect( ( sc_IP, sc_Port ) )
### Signal handler (ctrl+c)
示例7: setup_OSC_client
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def setup_OSC_client(self, address):
"""Setup a new OSC client"""
self.OSC_client = OSC.OSCClient()
self.OSC_client.connect(address)
self.do_we_have_a_client = True
示例8: __init__
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def __init__(self, maxVoices, ip, port):
self.playing = []
self.ip = ip
self.port = port
self.osc = OSC.OSCClient()
self.osc.connect((ip, port))
示例9: __init__
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import OSCClient [as 别名]
def __init__ (self, master):
self.master =master
self.PureData = PureData()
self.loc =self.dragged =0
tk.Frame.__init__ (self, master)
self.AllModules = list()
self.Cables = list()
self.osc = OSC.OSCClient()
self.osc.connect((IP, PORT))
self.menubar = Menu(self)
menu = Menu(self.menubar, tearoff=0)
self.menubar.add_cascade(label="File", menu=menu)
menu.add_command(label="Save", command=self.Save)
menu.add_command(label="Load", command=self.Load)
menu.add_command(label="New")
menu.add_command(label="Exit", command=self.killEmAll)
menu = Menu(self.menubar, tearoff=0)
self.menubar.add_cascade(label="Choose Module", menu=menu)
for module in sorted(modules.keys()):
menu.add_command(label=module, command=(lambda module :lambda :self.AllModules.append(Module(self.canvas, module, CanvasWidth/2, CanvasHeight/2, self, self.osc)))(module))
menu = Menu(self.menubar, tearoff=0)
self.menubar.add_cascade(label="Cable Color", menu=menu)
for color in chooseCableColor.getAllColors():
menu.add_command(label=color, command=(lambda color :lambda :chooseCableColor.setCurrentColor(color))(color))
self.canvas =tk.Canvas (self, width =CanvasWidth, height =CanvasHeight,
relief =tk.RIDGE, background ="white", borderwidth =1)
menubar = Menu(root)
try:
self.master.config(menu=self.menubar)
except AttributeError:
# master is a toplevel window (Python 1.4/Tkinter 1.63)
self.master.tk.call(master, "config", "-menu", self.menubar)
# chooseModules(self.canvas, 10, 10, self)
self.buildCase()
self.canvas.pack (expand =1, fill =tk.BOTH)
#mp = self.midiParameter(self.master, self.canvas)