OSC Listeners and multiple methods


#1

As a rusty C++ hacker, I'm trying to understand the OSCReceiver implementation. As far as I can tell, I have to create a new subclass for every address to which I want to listen. Is there no way to have a single class with multiple methods so that rather than just specifying "this" as the argument to addListener, one could instead specify a method within a class so that one could just have a collection of methods in a single class to handle various OSC addresses?


#2

Never mind ---  the Github example is misleading --- it suggests you're supposed to use multiple inheritence for this stuff instead of using composition.


#3

You can also create an OSCReceiver::Listener (the one without the "OSCAddress" in the name) and then you'll get all the OSC traffic. You can then filter it yourself in the oscMessageReceived callback in any way you like. Definitely no need to create another object for another address, let alone another subclass!


#4

Yeah, that's what I ended up doing. Again, thanks for responding.