當前位置: 首頁>>代碼示例>>Python>>正文


Python OSC.OSCClient方法代碼示例

本文整理匯總了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 
開發者ID:sonidosmutantes,項目名稱:apicultor,代碼行數:27,代碼來源:SuperColliderServer.py

示例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 
開發者ID:neurotechuoft,項目名稱:Wall-EEG,代碼行數:15,代碼來源:streamer_osc.py

示例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() 
開發者ID:PedroLopes,項目名稱:muscle-plotter,代碼行數:6,代碼來源:anoto_mouse_emulator.py

示例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 
開發者ID:house-of-enlightenment,項目名稱:house-of-enlightenment,代碼行數:13,代碼來源:osc_utils.py

示例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) 
開發者ID:house-of-enlightenment,項目名稱:house-of-enlightenment,代碼行數:8,代碼來源:osc_utils.py

示例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) 
開發者ID:sonidosmutantes,項目名稱:apicultor,代碼行數:37,代碼來源:PlayCtrlState.py

示例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 
開發者ID:adamrgodfrey,項目名稱:RoadKingsApocalypse,代碼行數:7,代碼來源:osc.py

示例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)) 
開發者ID:computerstaat,項目名稱:PDModular,代碼行數:8,代碼來源:conductor.py

示例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) 
開發者ID:computerstaat,項目名稱:PDModular,代碼行數:48,代碼來源:SynthBuilder.py


注:本文中的OSC.OSCClient方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。