attwad/python-osc

Getting wildcard information in arguments

betov75 opened this issue · 2 comments

Hi! Thanks for your work.
Is there a way I can get the wildcard info? Example:
/track/fx//param/
Can I get the info filtered by the wild card? Like the track number and param number?

Those are not OSC params sent by a client right? If those are static then you can save that info in a class with methods as handlers for example:

class TrackHandler:
  def __init__(track, param):
    self.track = track
    self.param = param

  def osc_handler(self, address: str, *osc_arguments: List[Any]):
    # Do what you want with osc args, self.track and self.params are accessible as well.

from pythonosc.dispatcher import Dispatcher
disp = Dispatcher()
handler = TrackHandler("track1", "param1")
disp.map("/track1/fx/param1/", handler.osc_handler)
# etc

Hi! Thank you very much for that answer, that's exactly what I wanted to know. Have a great day!