Commit 44332544 authored by Bruno Laurencich's avatar Bruno Laurencich

using Xinne osc4py3 repo

parent 1d66c206
......@@ -4,3 +4,6 @@
[submodule "requests"]
path = requests
url = https://github.com/requests/requests.git
[submodule "osc4py3_git_xinne"]
path = osc4py3_git_xinne
url = https://github.com/Xinne/osc4py3.git
......@@ -18,6 +18,9 @@ else:
from . import remote_runner
from . import utils as u
from . import receive
from sys import path
from os.path import join, abspath, dirname
path.append(join(dirname(abspath(__file__)), "osc4py3_git_xinne"))
import bpy
......@@ -79,6 +82,8 @@ class Chord_Properties(bpy.types.AddonPreferences):
show_advanced = props.BoolProperty( name="Show advanced panel", default = False )
debug_osc = props.BoolProperty( name="Debug osc to console", default = False )
capture_quat_patt = props.StringProperty( name = "Capture OSC pattern",
description = "Regex pattern to filter bone quaternion data only", default = r"^/Chordata/(\w.*)" )
......
Metadata-Version: 1.1
Name: osc4py3
Version: 1.0.4
Summary: Python3 package for Open Sound Control (OSC) communications.
Home-page: http://perso.limsi.fr/pointal/dev:osc4py3
Author: Laurent Pointal
Author-email: laurent.pointal@limsi.fr
License: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
Download-URL: https://sourcesup.renater.fr/projects/osc4py3/
Description: OSC for Python3
===============
:author: Laurent Pointal <laurent.pointal@limsi.fr> <laurent.pointal@laposte.net>
:organization: CNRS - LIMSI
:copyright: CNRS - 2013-2018
:license: CeCILL-2.1
:version: 1.0.3
`Module documentation <http://osc4py3.readthedocs.org/>`_
`Subversion repository & bug tracking <https://sourcesup.renater.fr/scm/viewvc.php?root=osc4py3>`_
(on french academic SourceSup site).
`Developer page <https://perso.limsi.fr/pointal/dev:osc4py3>`_
.. note::
Testers feedback welcome. This development was finally not tested in its
initial planning, any problem / bug / info are welcome.
What is it?
-----------
This module is an implementation of `Open Sound Control (OSC)`_ message
transport protocol within a Python3 package.
.. _Open Sound Control (OSC): http://opensoundcontrol.org/
Manage different sides of OSC in possibly different contexts:
- encoding/decoding of OSC message packets (including bundles)
- routing of incoming messages based on selector regexps or globbing
- timed messages with possible delay period
- named client/server for sending/subscribing
- different scheduling models (single process, totally multithread, only multithread for communications)
- extra processing of packets (hack points to encrypt/decrypt, sign/verify…)
Note: routing, timed messages, named client/server, scheduling models make a complex system
(see the “big picture” in doc). The oscbuildparse module of osc4py3 package can be used as
is and provides nice OSC packets encoding/decoding functions usable in your own message
transmission scheme.
Installation
------------
Unless someone built a package for your OS distro, the simplest procedure
is to use ``pip`` to install the module:
pip install osc4py3
If you have no admin access to install things on you computer, you may install
a virtualenv and run pip inside this virtual env, or you can do a local user
installation:
pip install --user osc4py3
Keywords: communication,sound,network,open sound control,osc
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Multimedia :: Sound/Audio
OSC for Python3
===============
:author: Laurent Pointal <laurent.pointal@limsi.fr> <laurent.pointal@laposte.net>
:organization: CNRS - LIMSI
:copyright: CNRS - 2013-2018
:license: CeCILL-2.1
:version: 1.0.3
`Module documentation <http://osc4py3.readthedocs.org/>`_
`Subversion repository & bug tracking <https://sourcesup.renater.fr/scm/viewvc.php?root=osc4py3>`_
(on french academic SourceSup site).
`Developer page <https://perso.limsi.fr/pointal/dev:osc4py3>`_
.. note::
Testers feedback welcome. This development was finally not tested in its
initial planning, any problem / bug / info are welcome.
What is it?
-----------
This module is an implementation of `Open Sound Control (OSC)`_ message
transport protocol within a Python3 package.
.. _Open Sound Control (OSC): http://opensoundcontrol.org/
Manage different sides of OSC in possibly different contexts:
- encoding/decoding of OSC message packets (including bundles)
- routing of incoming messages based on selector regexps or globbing
- timed messages with possible delay period
- named client/server for sending/subscribing
- different scheduling models (single process, totally multithread, only multithread for communications)
- extra processing of packets (hack points to encrypt/decrypt, sign/verify…)
Note: routing, timed messages, named client/server, scheduling models make a complex system
(see the “big picture” in doc). The oscbuildparse module of osc4py3 package can be used as
is and provides nice OSC packets encoding/decoding functions usable in your own message
transmission scheme.
Installation
------------
Unless someone built a package for your OS distro, the simplest procedure
is to use ``pip`` to install the module:
pip install osc4py3
If you have no admin access to install things on you computer, you may install
a virtualenv and run pip inside this virtual env, or you can do a local user
installation:
pip install --user osc4py3
Metadata-Version: 1.1
Name: osc4py3
Version: 1.0.4
Summary: Python3 package for Open Sound Control (OSC) communications.
Home-page: http://perso.limsi.fr/pointal/dev:osc4py3
Author: Laurent Pointal
Author-email: laurent.pointal@limsi.fr
License: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
Download-URL: https://sourcesup.renater.fr/projects/osc4py3/
Description: OSC for Python3
===============
:author: Laurent Pointal <laurent.pointal@limsi.fr> <laurent.pointal@laposte.net>
:organization: CNRS - LIMSI
:copyright: CNRS - 2013-2018
:license: CeCILL-2.1
:version: 1.0.3
`Module documentation <http://osc4py3.readthedocs.org/>`_
`Subversion repository & bug tracking <https://sourcesup.renater.fr/scm/viewvc.php?root=osc4py3>`_
(on french academic SourceSup site).
`Developer page <https://perso.limsi.fr/pointal/dev:osc4py3>`_
.. note::
Testers feedback welcome. This development was finally not tested in its
initial planning, any problem / bug / info are welcome.
What is it?
-----------
This module is an implementation of `Open Sound Control (OSC)`_ message
transport protocol within a Python3 package.
.. _Open Sound Control (OSC): http://opensoundcontrol.org/
Manage different sides of OSC in possibly different contexts:
- encoding/decoding of OSC message packets (including bundles)
- routing of incoming messages based on selector regexps or globbing
- timed messages with possible delay period
- named client/server for sending/subscribing
- different scheduling models (single process, totally multithread, only multithread for communications)
- extra processing of packets (hack points to encrypt/decrypt, sign/verify…)
Note: routing, timed messages, named client/server, scheduling models make a complex system
(see the “big picture” in doc). The oscbuildparse module of osc4py3 package can be used as
is and provides nice OSC packets encoding/decoding functions usable in your own message
transmission scheme.
Installation
------------
Unless someone built a package for your OS distro, the simplest procedure
is to use ``pip`` to install the module:
pip install osc4py3
If you have no admin access to install things on you computer, you may install
a virtualenv and run pip inside this virtual env, or you can do a local user
installation:
pip install --user osc4py3
Keywords: communication,sound,network,open sound control,osc
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: CEA CNRS Inria Logiciel Libre License, version 2.1 (CeCILL-2.1)
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Multimedia :: Sound/Audio
README.txt
setup.py
osc4py3/__init__.py
osc4py3/as__common.py
osc4py3/as_allthreads.py
osc4py3/as_comthreads.py
osc4py3/as_eventloop.py
osc4py3/oscbuildparse.py
osc4py3/oscchannel.py
osc4py3/oscdispatching.py
osc4py3/oscdistributing.py
osc4py3/oscmethod.py
osc4py3/oscnettools.py
osc4py3/oscpacketoptions.py
osc4py3/oscpeeradapt.py
osc4py3/oscscheduling.py
osc4py3/osctcp.py
osc4py3/osctoolspools.py
osc4py3/oscudpmc.py
osc4py3.egg-info/PKG-INFO
osc4py3.egg-info/SOURCES.txt
osc4py3.egg-info/dependency_links.txt
osc4py3.egg-info/top_level.txt
osc4py3/demos/__init__.py
osc4py3/demos/demoslogger.py
osc4py3/demos/rundemo.py
osc4py3/demos/speedudpcli.py
osc4py3/demos/speedudpcommon.py
osc4py3/demos/speedudpsrv.py
osc4py3/tests/__init__.py
osc4py3/tests/buildparse.py
osc4py3/tests/channel.py
osc4py3/tests/dispatching.py
osc4py3/tests/method.py
osc4py3/tests/nettools.py
osc4py3/tests/testslogger.py
osc4py3/tests/toolspools.py
osc4py3/tests/udp.py
osc4py3/tests/udpbc.py
osc4py3/tests/udpmc.py
\ No newline at end of file
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# File: osc4py3/__init__.py
"""Use OSC with Python3.
"""
__version__ = "1.0.4"
__all__ = []
import sys
# Allow Python2 for documentation generation.
if "sphinx" not in sys.modules:
# Prevent using the package with unsupported Python version.
if sys.version_info.major < 3 or (sys.version_info.major == 3 and sys.version_info.minor<2):
print(r"/!\ osc4py3 only runs with Python3.2 or greater.")
sys.exit(-1)
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# File: osc4py3/as__common.py
# <pep8 compliant>
"""
Each :mod:`as_eventloop`, :mod:`as_allthreads` and :mod:`as_comthreads`
module define the same set of functions documented here.
"""
# Share code and documentation for as_xxx modules.
from . import oscmethod
__all__ = [
"osc_startup",
"osc_terminate",
"osc_process",
"osc_method",
"osc_send",
"osc_udp_server",
"osc_udp_client",
"osc_multicast_server",
"osc_multicast_client",
"osc_broadcast_server",
"osc_broadcast_client",
]
def osc_startup(**kwargs):
"""\
Once call startup function for all osc processing in the event loop.
Create the global dispatcher and register it for all packets and messages.
Create threads for background processing when used with as_allthreads or
as_comthreads scheduling.
:param logger: Python logger to trace activity.
Default to None
:type logger: logging.Logger
:param execthreadscount: number of execution threads for methods to
create. Only used with as_allthreads scheduling.
Default to 10.
:type execthreadscount: int
:param writethreadscount: number of write threads for packet sending to
create. Only used with as_allthreads scheduling.
Default to 10.
:type writethreadscount: int
"""
pass
def osc_terminate():
"""\
Once call termination function for clean the exit of process.
"""
pass
def osc_process():
"""\
Function to call from your event loop to receive/process OSC messages.
"""
pass
def osc_method(addrpattern, function, argscheme=oscmethod.OSCARG_DATAUNPACK, extra=None):
"""\
Add a method filter handler to automatically call a function.
Note: there is no unregister function at this level of osc4py use.
:param addrpattern: OSC pattern to match
:type addrpattern: str
:param function: code to call with the message arguments
:type function: callable
:param argscheme: scheme for handler function arguments.
By default message data are transmitted, flattened as N parameters.
:type argscheme: tuple
:param extra: extra parameters for the function (must be specified in argscheme too).
:type extra: anything
"""
pass
def osc_send(packet, names):
"""\
Send the packet using channels via names.
:param packet: the message or bundle to send.
:type packet: OSCMessage or OSCBundle
:param names: name of target channels (can be a string, list or set).
:type names: str or list or set
"""
pass
def osc_udp_server(name, address, port):
"""\
Create an UDP server channel to receive OSC packets.
:param name: internal identification of the channel server.
:type name: str
:param address: network address for binding UDP socket
:type address: str
:param port: port number for binding UDP port
:type port: int
"""
pass
def osc_udp_client(name, address, port):
"""\
Create an UDP client channel to send OSC packets.
:param name: internal identification of the channel client.
:type name: str
:param address: network address for binding UDP socket
:type address: str
:param port: port number for binding UDP port
:type port: int
"""
pass
def osc_multicast_server(name, address, port):
"""\
Create a multicast server to receive OSC packets.
:param name: internal identification of the channel server.
:type name: str
:param address: network address for binding socket
:type address: str
:param port: port number for binding port
:type port: int
"""
pass
def osc_multicast_client(name, address, port, ttl):
"""\
Create a multicast client channel to send OSC packets.
:param name: internal identification of the channel client.
:type name: str
:param address: multicast network address for binding socket
:type address: str
:param port: port number for binding port
:type port: int
:param ttl: time to leave for multicast packets.
Default to 1 (one hop max).
:type ttl: int
"""
pass
def osc_broadcast_server(name, address, port):
"""\
Create a broadcast server channel to receive OSC packets.
:param name: internal identification of the UDP server.
:type name: str
:param address: network address for binding UDP socket
:type address: str
:param port: port number for binding UDP port
:type port: int
"""
pass
def osc_broadcast_client(name, address, port, ttl):
"""\
Create a broadcast client channel to send OSC packets.
:param name: internal identification of the channel client.
:type name: str
:param address: broadcast network address for binding socket
:type address: str
:param port: port number for binding port
:type port: int
:param ttl: time to leave for broadcast packets.
Default to 1 (one hop max).
:type ttl: int
"""
pass
def apply_docs(namespace):
# Associate documentation to functions in as_xxx module.
for name in __all__:
setattr(namespace[name], '__doc__', getattr(globals()[name], '__doc__'))
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# File: osc4py3/as_allthreads.py
# <pep8 compliant>
"""Use of osc4py3 in own created threads.
Functions defined here allow to use OSC completely from its own threads.
Even message method execution is done in a background thread.
"""
from . import oscscheduling
from . import oscdispatching
from . import oscchannel
from . import oscmethod
from . import osctoolspools
from . import oscdistributing
from . import as__common # All doc strings are shared here.
# Useful methods of this module.
__all__ = [
"osc_startup",
"osc_terminate",
"osc_process",
"osc_method",
"osc_send",
"osc_udp_server",
"osc_udp_client",
"osc_multicast_server",
"osc_multicast_client",
"osc_broadcast_server",
"osc_broadcast_client", ]
dispatcher = None
generallogger = None
execute_queue = None # WorkQueue to execute methods in own pool of threads.
write_queue = None # WorkQueue to transmit packets in own pool of threads.
def osc_startup(**kwargs):
global dispatcher, generallogger, execute_queue, write_queue
if dispatcher is not None:
return
if 'logger' in kwargs:
generallogger = kwargs['logger']
dispatcher = oscdispatching.Dispatcher("global", {
"logger": generallogger,
})
oscdispatching.register_global_dispatcher(dispatcher)
# This monitoring thread will look at sockets.
oscscheduling.get_global_socket_monitor(generallogger)
# This thread will get, decode and process received raw packets.
oscdistributing.create_rawpackets_thread(generallogger)
# This thread will encode and transmit packets to send.
oscdistributing.create_sendingpackets_thread(generallogger)
# This thread will process delayed bundles.
oscdispatching.create_delayed_thread(generallogger)
# To execute methods in a pool of threads.
execthreadscount = kwargs.get("execthreadscount", 10)
if execthreadscount > 0:
execute_queue = osctoolspools.WorkQueue(generallogger)
execute_queue.add_working_threads(execthreadscount)
# To send pending packets.
writethreadscount = kwargs.get("writethreadscount", 10)
if writethreadscount > 0:
write_queue = osctoolspools.WorkQueue()
write_queue.add_working_threads(writethreadscount)
def osc_terminate():
global dispatcher, manager, execute_queue, write_queue
if dispatcher is None:
return
if execute_queue is not None:
execute_queue.terminate()
execute_queue = None
oscscheduling.terminate_global_socket_monitor()
oscscheduling.terminate_global_polling_monitor()
oscdistributing.terminate_sendingpackets_thread()
oscdistributing.terminate_rawpackets_thread()
oscdispatching.terminate_delayed_thread()
oscdispatching.unregister_global_dispatcher()
dispatcher = None
write_queue.terminate()
write_queue = None
def osc_process():
"""Function to call from your event loop to receive/process OSC messages.
"""
pass # All processing in other threads.
def osc_method(addrpattern, function, argscheme=oscmethod.OSCARG_DATAUNPACK, extra=None):
# We associate the method to the workqueue to have concurrent processing
# of methods if it has been defined.
apf = oscmethod.MethodFilter(addrpattern, function, logger=generallogger,
workqueue=execute_queue, argscheme=argscheme,
extra=extra)
oscdispatching.register_method(apf)
def osc_send(packet, names):
oscdistributing.send_packet(packet, names)
def osc_udp_server(address, port, name):
from . import oscudpmc # Only import if necessary.
chan = oscudpmc.UdpMcChannel(name, "r",
{
'udpread_host': address,
'udpread_port': port,
'monitor': oscchannel.SCHED_SELECTTHREAD,
'auto_start': True, # The channel will automaticaly register
# with monitor..
'logger': generallogger,
})
def osc_udp_client(address, port, name):
global channels
from . import oscudpmc # Only import if necessary.
chan = oscudpmc.UdpMcChannel(name, "w",
{
'udpwrite_host': address,
'udpwrite_port': port,
'udpwrite_nonblocking': True,
"write_workqueue": write_queue,
'monitor': oscchannel.SCHED_SELECTTHREAD,
'auto_start': True,
'logger': generallogger,
})
def osc_multicast_server(address, port, name):
from . import oscudpmc # Only import if necessary.
chan = oscudpmc.UdpMcChannel(name, "r",
{
'udpread_host': address,
'udpread_port': port,
'monitor': oscchannel.SCHED_SELECTTHREAD,
'auto_start': True,
'mcast_enabled': True,
'logger': generallogger,
})
def osc_multicast_client(address, port, name, ttl=1):
from . import oscudpmc # Only import if necessary.
chan = oscudpmc.UdpMcChannel(name, "w",
{
'udpwrite_host': address,
'udpwrite_port': port,
'udpwrite_ttl': ttl,
"udpwrite_nonblocking": True,
"write_workqueue": write_queue,
'monitor': oscchannel.SCHED_SELECTTHREAD,
'auto_start': True,
'mcast_enabled': True,
'logger': generallogger,
})
def osc_broadcast_server(address, port, name):
global channels
from . import oscudpmc # Only import if necessary.
chan = oscudpmc.UdpMcChannel(name, "r",
{
'udpread_host': address,
'udpread_port': port,
'monitor': oscchannel.SCHED_SELECTTHREAD,
'auto_start': True,
'bcast_enabled': True,
'logger': generallogger,
})
def osc_broadcast_client(address, port, name, ttl=1):
from . import oscudpmc # Only import if necessary.
chan = oscudpmc.UdpMcChannel(name, "w",
{
'udpwrite_host': address,
'udpwrite_port': port,
'udpwrite_ttl': ttl,
"udpwrite_nonblocking": True,
"write_workqueue": write_queue,
'monitor': oscchannel.SCHED_SELECTTHREAD,
'auto_start': True,
'bcast_enabled': True,
'logger': generallogger,
})
as__common.apply_docs(globals())
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# File: osc4py3/as_comthreads.py
# <pep8 compliant>
"""Use of osc4py3 in own created threads for communication.
Functions defined here allow to use OSC with a mixed scheduling whehre
communications and encoding/decoding are realized in background
threads, but methods calls are processed in an event loop.
"""
from . import oscscheduling
from . import oscdispatching
from . import oscchannel
from .