Hiho,
I've used it quite a bit :)
On Saturday 29 December 2012 08:40:15 Nathaniel Virgo wrote:
> I'm sorry for posting an off-topic question, but there doesn't seem to be
> an official palce to ask pyOSC questions and I thought there might be some
> expertise here.
pyOSC also is more easy to work cross platform, as you don't depend on C-
> I'm writing a Python program that will intercommunicate with SuperCollider
> via OSC. I originally started using pyliblo, but I realised that it doesn't
> quite meet my needs (there's no way to remove a callback once it's been
> added), so I've switched to pyOSC.
libraries being installed...
It seems to me this is a question of defining your address namespace well, and
> My question is, in pyOSC, how can I filter messages by OSC type tags? It
> seems from the example code that callbacks are added with something like
>
> server.addMsgHandler("/my/path", callback_func)
>
> but then callback_func has to know how to handle an OSC message of any
> format, e.g.
>
> ['/my/path', 1.0]
> ['/my/path', 42, 64, 6.283]
> ['/my/path', "foo", "bar", "baz"]
> etc.
>
> This seems to mean that I have to put error checking code in every single
> callback, to make sure that the message has the right format, which is very
> annoying. But then again, there's a lot of stuff in pyOSC that isn't
> demonstrated in the example code, so I wondered whether anyone knows of a
> better way?
the types of data that you send with each.
If you use the same address tag '/my/path' for a lot of different types of
messages, I think the namespace is not well defined.
You do however also get the types of the arguments, so you could filter based
on the type tags of the message.
A default fallback function is:
def fallback(self, path, args, types, src):
print( "got unknown message '%s' from '%s'" % (path, src.get_url()) )
for a, t in zip(args, types):
print( "argument of type '%s': %s" % (t, a) )
sincerely,
Marije
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/