What i would is to have a instance of “your osc” in ofApp at the same level as gui, and in those gui elements put a callback that you listen on ofApp and inside those callbacks you call your osc… hope that makes sense
Is only my opinion but i have the feeling that you are complicating things, sometimes i better to start from the begining… what you want to do? the schema you posted works perfectly with the option i told you.
I have an OSC class that holds all my setup and network functions. Currently (for example) my sliders all have different ID’s given to them in their setup. In the sliders.mouseMoved I have it calculating the output then sending a function to it’s child OSC class.
I think I am having issues with understanding the events. Before, I had a similar solution without using listeners but was having issues of only wanting to call the osc function when that slider was moved. That is when I created multiple OSC sub-classes, but I am trying to get away from that now.
Except when I do this, the GUI Class gives me the error:
“9. In instantiation of function template specialization ‘ofAddListener<ofEvent<float, std::__1::recursive_mutex>, std::__1::basic_string, GUI>’ requested here”
I mean yes, it started out as a GUI but then has morphed. Probably need to refactor soon. Unfortunately, im away from the computer for a while and the code is messy (as you can probably guess). What would you say needs looking at so I know what to include?
I love using ofEventListener objects to do the listening. Since they’re objects, they’re destroyed when they go out of scope, and you don’t have to delete the listener like with ofAddListener. You can use lambda functions with ofEventListener, and I’m thinking that the lambda can capture multiple arguments to pass to its function. If you capture ofParamter types, they have to be const if I remember correctly.