Dev (#6) - multiple objects using the same callback (#71) - Message List
Hi. I'd like some information about how to get my object passed to the callback function, if this is possible.
Background: I'm working on a new version of wiimote for Pure-Data. The old one draws back to the 0.4 version of libcwiid. It also had the same problem, inherent to the way externals in PD have to be built. It comes down to the following: it must be possible to create several objects of the same type in pd, in this case several wiimote objects, all connecting to another controller.
Now, the callback function does not allow to pass a pointer to the structure of the external, which makes it impossible to give data back to the the structure. In the 0.6 version of the library, there is a comment in wmdemo right before the callback function. It says that "The ID is to distinguish between multiple wiimotes using the same callback". But what is the ID refered to here? Is it part of the mesg? I cannot find anything like it in the header file. Or do you mean mesg_count? And is there also another function to give me this ID directly so I can use it in my structure?
The way the original external solved the problem is by hardcoding a fixed set of 8 copies for the callback function. I was hoping that this is not needed anymore with the new library?
As for now, I'll try out the function cwiid_get_mesg with a timer of about 20 ms. But of course that's hardly an elegant solution.
Anyway, thanks for reading.