can't create print object with object_new_typed
Hi.
I need to create a print object from within my external, and I'm trying to do it with object_new_typed.
What I found out is that if I try to instantiate it after a print has been created in a Max patch (because I typed it in, or because I have loaded a patch containing one) everything is fine. But if no print object has been instantiated before, then object_new_typed returns NULL.
I suspect this has to do with print being an internal object, and somehow its class not being correctly initialized by object_new_typed - I think I had already met this problem before...
... what can I do???
Thanks!
aa
in fact, instantiating my print object with newinstance() seems to work. I'm not sure this won't generate problems, though... any advice?
aa
I just updated the link in that post, but here it is for convenience:
https://github.com/jamoma/JamomaModular/blob/master/library/source/jcom.core.cpp#L159
Hi Tim.
Thank you for the link.
What I'm not sure of is why you need to instantiate the object with newinstance, then free it, and then re-instantiate it with object_new_typed. It is not that important, as long as things work ;) , but I'd like to understand more...
Thank you!
aa
To be honest, I wrote that code 10 years ago and I don't really remember why it is like that. I vaguely recall that I had to do that to make it work, but I was pretty inexperienced and wasn't really sure what I was doing at that point. Sorry for the less-than-substantial answer on this one. At any rate, I do know that the code works and I haven't had any problems with it.